                    var count = 0;
                    var timeoutHandle;
                    var flagreview = [];
                    var statusview = [];
                    var myObj1 = [];
                    var myObj2 = [];
                    var tbody = document.querySelector("#tablebody");
                    var trdata = 0;
                    var myObj;
                    var submitedans = [];
                    var reviewtabbody = document.querySelector("#reviewtabbody");
                    var flag = 0;
                    var ReviewIncomplete = 0;
                    var total_attended;
                    var counter = -1;
                    var timing = 0;
                    var done = 0;

                    window.onload = function () {

                        $(".ui-dialog-titlebar-close").css("background", "#006DAA");

                        // document.getElementById("divreveiw").style.display="none"
                        changeHashOnLoad();
                        countdown(15);

                        $(function () {
                            $("#ReviewerDialog").dialog({
                                autoOpen: false,
                                modal: true,
                                title: "End Exam",
                                width: 440.6,
                                buttons: {
                                    OK: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#ReviewerDialog").dialog('close');
                                    });
                                },
                                close: function () {
                                    $(this).dialog("close");
                                }

                            });
                            $("#EndReviewButton").click(function () {
                                $(".clsbtnpos").click()
                                $("span.ui-dialog-title").text('End Review');
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $(".ui-dialog-titlebar-close").css("background", "#006DAA")
                                $(".ui-dialog-buttonset").addClass("position-center");
                                $('.ui-dialog-buttonpane').find('button:contains("Yes")')[0].accessKey = "Y";
                                $('.ui-dialog-buttonpane').find('button:contains("Yes")')[0].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">Y</span>es</span>';
                                $('.ui-dialog-buttonpane').find('button:contains("No")')[0].accessKey = "N";
                                $('.ui-dialog-buttonpane').find('button:contains("No")')[0].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">N</span>o</span>';
                                $("#EndReviewDialog").html("<div class='WarningImage info-dialog ui-dialog-content ui-widget-content'> <ul class='dialogUL' style='margin-top: 0px'><li tabindex='-1' class='messageText rc-fonts-Message'>You have chosen to end the current review, but have <span id='tot'></span> incomplete/unseen questions.  If you click Yes, you will NOT be able to return to this review.<br><br>Are you sure you want to end this review?</li></ul></div>").dialog("open");
                                $("#tot").text(sessionStorage.getItem('tot'))
                            });
                        });
                        $(function () {
                            $("#dialog").dialog({
                                autoOpen: false,
                                modal: true,
                                width: 680,
                                height: 350,
                                buttons: {
                                    Close: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#dialog").dialog('close');
                                    });
                                },
                                close: function () {
                                    $(this).dialog("close");
                                }
                            });
                            $("#NavigatorButton").click(function () {
                                $(".clsbtnpos").click()
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $(".ui-dialog-buttonset").removeClass("position-center");
                                $(".ui-dialog-titlebar-close").css("background", "#006DAA");
                                $(".ui-dialog-titlebar-close").addClass("closebtn");
                                $('.ui-dialog-buttonpane').find('button:contains("Close")')[0].accessKey = "C";
                                $('.ui-dialog-buttonpane').find('button:contains("Close")')[0].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">C</span>lose</span>';
                                listQuestions();
                                $(".ui-dialog-title").html('<span id="ui-id-1" class="ui-dialog-title rc-fonts-Message"><span class="NavigatorImage"></span><span class="ui-exam-dialog-title rc-fonts-Message" id="titletextNavigator<span> - select a question to go to it</span>" style="width: 610px;">Navigator<span> - select a question to go to it</span></span></span>')
                                $("#dialog").dialog("open");
                            });
                        });
                        $(function () {
                            $("#EndReviewDialog").dialog({
                                autoOpen: false,
                                modal: true,
                                title: "End Exam",
                                width: 440.6,
                                buttons: {
                                    Yes: function () {
                                        $(this).dialog("close");
                                        $(".ui-icon-closethick").addClass("clsbtnpos");
                                        $(".clsbtnpos").click()
                                        $("span.ui-dialog-title").text('End Review Confirmation');
                                        $('.ui-dialog-buttonpane').find('button:contains("Yes")')[1].accessKey = "Y";
                                        $('.ui-dialog-buttonpane').find('button:contains("Yes")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">Y</span>es</span>';
                                        $('.ui-dialog-buttonpane').find('button:contains("No")')[1].accessKey = "N";
                                        $('.ui-dialog-buttonpane').find('button:contains("No")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">N</span>o</span>';
                                        $("#EndReviewConfDialog").html("<div class='WarningImage info-dialog ui-dialog-content ui-widget-content'> <ul class='dialogUL' style='margin-top: 0px'><li tabindex='-1' class='messageText rc-fonts-Message'>Please confirm that you want to end this review.  If you click<br>Yes, you will NOT be able to return to this review and answer<br>the <span id='totconf'></span> questions you have not completed.<br><br>Are you sure you want to end this review?</li></ul></div>").dialog("open");
                                        $("#totconf").text(sessionStorage.getItem('tot'))
                                    },
                                    No: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#EndReviewDialog").dialog('close');
                                    });
                                },
                                close: function () {
                                    $(this).dialog("close");
                                }
                            });
                            $("#EndReviewButton").click(function () {
                                $(".clsbtnpos").click()
                                $("span.ui-dialog-title").text('End Review');
                                $(".ui-dialog-titlebar-close").css("background", "#006DAA")
                                $(".ui-dialog-buttonset").addClass("position-center");
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $("#EndReviewDialog").html("<div class='WarningImage info-dialog ui-dialog-content ui-widget-content'> <ul class='dialogUL' style='margin-top: 0px'><li tabindex='-1' class='messageText rc-fonts-Message'>You have chosen to end the current review, but have <span id='tot'></span> incomplete/unseen questions.  If you click Yes, you will NOT be able to return to this review.<br><br>Are you sure you want to end this review?</li></ul></div>").dialog("open");
                                $("#tot").text(sessionStorage.getItem('tot'))
                            });
                        });
                        $(function () {
                            $("#InstructionDialog").html("<div id='instructionsWindow' style='overflow: hidden auto; display: block; width: auto; min-height: 58px; max-height: none; height: auto;' class='InformationImage info-dialog ui-dialog-content ui-widget-content'><ul class='dialogUL'><li tabindex='-1' class='messageText rc-fonts-Message'>Below is a summary of your answers. You can review your questions in three (3) different ways.<br><br>The buttons in the lower right-hand corner correspond to these choices:<br><br>1. Review all of your questions and answers.<br>2. Review questions that are incomplete.<br>3. Review questions that are flagged for review. (Click the 'flag' icon to change the flag for review status.)<br><br>You may also click on a question number to link directly to its location in the exam.</li></ul></div>").dialog({
                                autoOpen: false,
                                modal: true,
                                title: "Review Instructions",
                                width: 440.6,
                                buttons: {
                                    Close: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#InstructionDialog").dialog('close');
                                    });
                                },
                                close: function () {
                                    $(this).dialog("close");
                                }
                            });
                            $("#ReviewInstructionsButton").click(function () {
                                $(".clsbtnpos").click();

                                $('.ui-dialog-buttonpane').find('button:contains("Close")')[1].accessKey = "C";
                                $('.ui-dialog-buttonpane').find('button:contains("Close")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">C</span>lose</span>';
                                $(".ui-dialog-titlebar-close").css("background", "#006DAA")
                                $(".ui-dialog.ui-widget-content").css("width", "65%")
                                $(".ui-dialog-buttonset").addClass("position-center");
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $("span.ui-dialog-title").text('Review Instructions');
                                $("#InstructionDialog").dialog("open");
                            });
                        });
                        $(function () {
                            $("#EndReviewConfDialog").dialog({
                                autoOpen: false,
                                modal: true,
                                title: "End Review Confirmation",
                                width: 440.6,
                                buttons: {
                                    Yes: function () {
                                        $(this).dialog("close");
                                        $("#readMe").hide();
                                        $("#divreveiw").hide();
                                        Noneallbuttons();
                                        $("#EndExamDiv").css("display", "block");
                                        $("#EndExamButton").css("display", "block");
                                    },
                                    No: function () {
                                        $(this).dialog("close");
                                    }
                                },
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#EndReviewConfDialog").dialog('close');
                                    });
                                },
                                close: function () {
                                    $(this).dialog("close");
                                }
                            });
                        });
                        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')[0].split('=')[1]
                            .split('#');
                        switch (hashes[0]) {
                            case 'E':
                                myObj = {
                                    "Question": [{
                                        "Id": "1",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Verdana; font-size: 11pt'>Which of the following criteria have differences between management accounting and financial accounting?</span></p><p></p><p><img src='images/English/img1.png'></p></div>",
                                        "Option1": "All of the above",
                                        "Option2": "Only (ii) (iii) & (iv)",
                                        "Option3": "Only (i) (ii) & (iii)",
                                        "Option4": "Only (iv)",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "2",
                                        "Question": "<div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='527' style='width: 100%;'><p><span style='font-family: Verdana; font-size: 11pt'>Chathura is a wholesale rice seller. As at 30th September 2015 he had 600kgs of rice valued at Rs.65 per kilo at his stores.</span></p><p></p><p><span style='font-family: Verdana; font-size: 11pt'>The movements of the stocks during the first week of the month of October 2015 are as follows.</span></p><p></p><p><img src='images/English/img2.png' style='vertical-align: middle' alt=''></p><p></p><p><span style='font-family: Verdana; font-size: 11pt'>If Chathura uses First in First out (FIFO) method to value his stocks, the value of the stock as at the end of 06th October 2015 is:</span></p><p></p></div>",
                                        "Option1": "Rs.54,500",
                                        "Option2": "Rs.55,400",
                                        "Option3": "Rs.54,860",
                                        "Option4": "All options are incorrect",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "3",
                                        "Question": "<div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='30' style='width: 100%;'><p><span style='font-family: Verdana; font-size: 11pt'>Simplify: (5√ xy3)(x-1y-2)</span></p><p></p></div>",
                                        "Option1": "1/x7/5.y4/5",
                                        "Option2": "1/x4/5.y7/5",
                                        "Option3": "x7/5.y4/5",
                                        "Option4": "x4/5.y7/5",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "4",
                                        "Question": "<div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='30' style='width: 100%;'><p><span style='font-family: Verdana; font-size: 11pt'>When the price of good X falls, the quantity demanded of that good increases</span></p><p><span style='font-family: Verdana; font-size: 11pt'>at a greater proportion than the price change. This indicates that:</span></p><p></p></div>",
                                        "Option1": "Good X faces a unitary elastic demand",
                                        "Option2": "Good X faces an elastic demand",
                                        "Option3": "Good X faces a perfectly inelastic demand",
                                        "Option4": "Good X faces an inelastic demand",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "5",
                                        "Question": "<div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='315' style='width: 100%;'><p><span style='font-family: Verdana; font-size: 11pt'>Following information is given in respct of different activity levels and the corresponding total costs.</span></p><p></p><p><img src='images/English/img5.png' style='vertical-align: middle' alt=''></p><p></p><p></p><span style=' font-family:Verdana; font-size: 11pt'><span> cost per unit is constant whereas the total fixed cost steps up by 10% when the activity level exceeds 9999 units.</span></p><p></p><p><span style='font-family: Verdana; font-size: 11pt'>The total cost of the company at an activity level of 10,000 units is:</span></p><p></p></div>",
                                        "Option1": "Rs.265,000",
                                        "Option2": "Rs.260,000",
                                        "Option3": "Rs.237,500",
                                        "Option4": "Rs.272,500",
                                        "Correct_ans": "1"
                                    }]
                                };
                                break;
                            case 'S':
                                myObj = {
                                    "Question": [{
                                        "Id": "6",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Verdana;font-size: 14pt'>පහත සඳහන් නිර්ණායක අතුරින් මුල්‍ය ගිණුම්කරණය සහ කළමනාකරණ ගිණුම්කරණය යන ගිණුම්කරණ අතර ඇති වෙනස හා සම්බත්ධ නිර්ණායකයන් මොනවාද?</span></p><p></p><p><img src='Images/sha/img1.png'></p></div>",
                                        "Option1": "ඉහත සඳහන් සියල්ලම",
                                        "Option2": "(ii), (iii) සහ (iv) පමණි",
                                        "Option3": "(i), (ii) සහ (iii) පමණි",
                                        "Option4": "(iv) පමණි",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "2",
                                        "Question": "<div class=' tt undef-width block-leading verticalPadding' zfaminwidth='564' '><div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='564'><p><span style='font-family: Iskoola Pota; font-size: 14pt'>චතුර යනු සහල් තොග ලෙස අලෙවි කරන අලෙවිකරුවෙකි. 2015 සැප්තැම්බර් 30 දිනට ඔහුගේ ගබඩාව තුල කිලෝග්‍රෑම් 1 ක් රු.65 ක් වටිනා සහල් කිලෝ ග්‍රෑම් 500 ක් පැවතුනි.</span></p><p></p><p><span style='font-family: Iskoola Pota; font-size: 14pt'>2015 &nbsp;ඔක්තෝම්බර් මස තොග සංචලනය පහත පරිදි වේ. </span></p><p></p><p><img src='Images/sha/img2.png' style='vertical-align: middle' alt=''></p><p></p><p><span style='font-family: Iskoola Pota; font-size: 14pt'>චතුර විසින් ප්‍රථම මිලදී ගැනුම් ප්‍රථම නිකුත් කිරීමේ ක්‍රමවේදය අනුගමනය කරයි නම්, 2015 ඔක්තෝම්බර් &nbsp;06 වන දිනට පවතින තොගයේ වටිනාකම වන්නේ,</span></p><p></p></div></div>",
                                        "Option1": "රු.54,500",
                                        "Option2": "රු.55,400",
                                        "Option3": "රු.54,860",
                                        "Option4": "ඉහත සඳහන් කිසිවක් නොවේ",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "3",
                                        "Question": "<div class='tt undef-width block-leading verticalPadding' zfaminwidth='30' style='width: 604px;'><div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='30' style='width: 602px;'><p><span style='font-family: Iskoola Pota; font-size: 14pt'>සුළු කරන්න : (5√ xy3)(x-1y-2)</span></p><p></p></div></div>",
                                        "Option1": "1/x7/5.y4/5",
                                        "Option2": "1/x4/5.y7/5",
                                        "Option3": "x7/5.y4/5",
                                        "Option4": "x4/5.y7/5",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "4",
                                        "Question": "<div class='tt undef-width block-leading verticalPadding' zfaminwidth='30' ><div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='30' ><p><span style='font-family: Iskoola Pota; font-size: 14pt'>X නමැති භාණ්ඩයේ මිල පහල යන විට එම භාණ්ඩයේ ඉල්ලුම් ප්‍රමාණය මිල වෙනස් වන සිග්‍රතාවයට වඩා වැඩි සිග්‍රතාවයකින් වැඩිවේ. මෙයින් පෙන්නුම් කරන්නේ,</span></p><p></p></div></div>",
                                        "Option1": "X නමැති භාණ්ඩය සදහා ඒකීය ඉල්ලුම් නම්‍යතාවක් පවති.",
                                        "Option2": "X නමැති භාණ්ඩය සදහා නම්‍ය ඉල්ලුම් නම්‍යතාවක් පවති.",
                                        "Option3": "X නමැති භාණ්ඩය සදහා පුර්ණ අනම්‍ය ඉල්ලුම් නම්‍යතාවක් පවති.",
                                        "Option4": "X නමැති භාණ්ඩය සදහා අනම්‍ය ඉල්ලුම් නම්‍යතාවක් පවති.",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "5",
                                        "Question": "<div class='tt undef-width block-leading noPadding' leafdatatype='text' zfaminwidth='296' style='width: 1284px;'><p><span style='font-family: Iskoola Pota; font-size: 14pt'>පහත සදහන් තොරතුරු එක් එක් ක්‍රියාකාරී මට්ටම් සහ ඊට අදාළ වන මුළු පිරිවැය හා සම්බන්ධ වේ.</span></p><p></p><p><img src='Images/sha/Img5.png' style='vertical-align: middle' alt=''></p><p></p><p><span style='font-family: Iskoola Pota; font-size: 14pt'>ඒකකයක විචල්‍ය පිරිවැය ස්ථාවර වන අතර ක්‍රියාකාරී මට්ටම ඒකක 9,999 ඉක්මවන විට මුළු ස්ථාවර පිරිවැය 10% න් වැඩිවේ.</span></p><p></p><p><span style='font-family: Iskoola Pota; font-size: 14pt'>ක්‍රියාකාරී මට්ටම ඒකක 10,000 ක් වන අවස්ථාවේදී ව්‍යාපාරයේ මුළු පිරිවැය වන්නේ,</span></p><p></p></div>",
                                        "Option1": "රු.265,000",
                                        "Option2": "රු.260,000",
                                        "Option3": "රු.237,500",
                                        "Option4": "රු.272,500",
                                        "Correct_ans": "1"
                                    }]
                                };
                                break;
                            case 'T':
                                myObj = {
                                    "Question": [{
                                        "Id": "11",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Latha; font-size: 11pt'>பின்வரும் அடிப்படைகளில் முகாமைக் கணக்கீட்டிற்கும் நிதிக் கணக்கீட்டிற்கும் இடையிலான வேறுபாடாக இருப்பவை எவை?</span></p><p></p><p><img src='images/Tamil/img1.png'></p></div>",
                                        "Option1": "மேற்கூறிய அனைத்தும்",
                                        "Option2": "(ii) , (iii) மற்றும் (iv) மாத்திரம்",
                                        "Option3": "(i) , (ii) மற்றும் (iii) மாத்திரம்",
                                        "Option4": "(iv) மாத்திரம்",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "2",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Latha; font-size: 11pt'>சதுர ஒரு அரிசி மொத்த வியாபாரி ஆவார். 30 செப்டம்பர் 2015 அன்று அவரது களஞ்சியத்தில் கிலோ ஒன்று ரூபா. 65 விலையான 600 கிலோ அரிசி காணப்பட்டது. 2015</p></span><p></p><p><span> அக்டோபர் மாதத்தின் முதலாவது வாரத்தின் போதான இருப்பு நகர்வுகள் பின்வருமாறு:</span></p><p></p><p><img src='images/Tamil/img2.png'></p><span><p>சதுர தனது இருப்புக்களை மதிப்பிடுவதற்காக முதல் உள் முதல் வெளி முறையைப் பயன்படுத்தினால், 06அக்டோபர் 2015 இல் உள்ள இருப்புக்களின் பெறுமதி என்ன?</p></span></div>",
                                        "Option1": "ரூபா. 54,500",
                                        "Option2": "ரூபா. 55,400",
                                        "Option3": "ரூபா. 54,860",
                                        "Option4": "அனைத்து விடைகளும் சரியானவை",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "3",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Latha; font-size: 11pt'>எளிமைப்படுத்துக:</span></p><p></p><p><img src='images/Tamil/img3.png'></p></div>",
                                        "Option1": "1/x7/5.y4/5",
                                        "Option2": "1/x4/5.y7/5",
                                        "Option3": "x7/5.y4/5",
                                        "Option4": "x4/5.y7/5",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "4",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Latha; font-size: 11pt'>X பண்டத்தின் விலை வீழ்ச்சியடையும் போது, அந்தப் பணத்திற்கான கேள்வித் தொகையானது விலை மாற்ற வீதாசாரத்தை வீடாக கூடுதலான தொகையினால் அதிகரிக்கிறது. இதன் மூலம் வெளிப்படுத்தப் படுவது:</span></p><p></p></div>",
                                        "Option1": "X பண்டம் ஒருமை நெகிழ்ச்சியை கொண்டுள்ளது.",
                                        "Option2": "X பண்டம் நெகிழ்ச்சி வாய்ந்த கேள்வியைக் கொண்டுள்ளது.",
                                        "Option3": "X பண்டம் அறவே நெகிழ்ச்சியற்ற கேள்வியைக் கொண்டுள்ளது.",
                                        "Option4": "X பண்டம் நெகிழ்ச்சியற்ற கேள்வியைக் கொண்டுள்ளது.",
                                        "Correct_ans": "1"
                                    }, {
                                        "Id": "5",
                                        "Question": "<div class='tt undef-width block-leading noPadding'><p><span style='font-family: Latha; font-size: 11pt'>வேறுபட்ட செயற்பாட்டு மட்டங்கள் மற்றும் தொடர்புபட்ட மொத்தக் கிரயங்கள் தொடர்பான தகவல்கள் கீழே தரப்பட்டுள்ளன.</span></p><p></p><p><img src='images/Tamil/img5.png'></p><span><p>செயற்பாட்டு மட்டமானது 9999 அலகுகளைத் தாண்டி அதிகரிக்கும் போது அலகுக்கான மாறும் கிரயமானது நிலையானதாக காணப்பட, மொத்த நிலையான கிரயமானது 10% இனால் படிமுறையாக அதிகரிக்கிறது.</p></span><span><p>10,000 அலகுகள் செயற்பாட்டு மட்டத்தில் கம்பனியின் மொத்தக் கிரயம் என்ன?</p></span></div>",
                                        "Option1": "ரூபா 265,000",
                                        "Option2": "ரூபா 260,000",
                                        "Option3": "ரூபா 237,500",
                                        "Option4": "ரூபா 272,500",
                                        "Correct_ans": "1"
                                    }]
                                };
                                break;
                        }
                        loadfirstquestion();
                        document.getElementById("itemCardinal").innerHTML = myObj.Question.length;
                        $('#ReviewAllButton').click(function () {
                            blockNavigationsbuttons();
                            document.getElementById("divreveiw").style.display = "none";
                            count = 0;
                            flag = 0;
                            ReviewIncomplete = 0;
                            LoadQuestion(0);
                        })

                    };

                    function listQuestions() {
                        var rows = "";
                        $(".ui-dialog").css("top", "20%")
                        $(".ui-dialog").css("left", "27%")
                        $(".ui-dialog").css("width", "50%");
                        $(".ui-dialog").css("height", "60%");
                        $(".ui-dialog-content").css("height", "70%");
                        total_attended = myObj.Question.length - submitedanscount();
                        sessionStorage.setItem("tot", total_attended)
                        document.getElementById("navigatorFooter").innerHTML = total_attended + " Unseen/Incomplete";
                        length = myObj.Question.length;
                        $('#navigator >tbody > tr').slice(1).remove();
                        var table = document.getElementById("navigator");
                        var statusdata;
                        var statuscomp;
                        for (var k = 1; k <= length; k++) {
                            if (flagreview[k - 1] == 1) {
                                flagclass = "FlaggedTrueLabelImage";
                            } else {
                                flagclass = ""
                            }
                            if (statusview[k - 1] == 2) {
                                statusdata = "Complete";
                            } else if (statusview[k - 1] == 1) {
                                statuscomp = "status rc-fonts-Message unseenOrIncomplete";
                                statusdata = "InComplete";
                            } else {
                                statuscomp = "status rc-fonts-Message unseenOrIncomplete";
                                statusdata = "UnSeen"
                            }
                            if ((k - 1) == count)
                                selectclass = "navpoint selectedRowColor";
                            else if (k % 2 == 0)
                                selectclass = "navpoint even";
                            else
                                selectclass = "navpoint odd";
                            rows = "<tr class='" + selectclass + " '><td>" + "<button id='" + k +
                                "' onclick='LoadQuestiononNavigation(this)' from='' style='color:black'>Question" + k + "</button><br>" +
                                "</td><td class='" + statuscomp + " '>" + statusdata + "</td><td class='reviewFlag'>" +
                                "<span class='" + flagclass +
                                "' style='display: inline-block; width: 35px; height: 26px;background-repeat: no-repeat'>&nbsp;</span>" +
                                "</td></tr>";
                            $("#navigator tr:last").after(rows);
                        }

                    }

                    function loadfirstquestion() {
                        unhideqnandreviewbtn();
                        count = 0;
                        flag = 0;
                        if (document.getElementById("readMe").style.display == "none") {
                            count = 0;
                            document.getElementById("divreveiw").style.display = "none";
                            document.getElementById("NextButton").style.display = "block";
                            document.getElementById("NavigatorButton").style.display = "none";
                            document.getElementById("PreviousButton").style.display = "none";
                            document.getElementById("readMe").style.display = "block";
                            document.getElementById("calculatorButton").style.display = "block";
                            document.getElementById("ReviewAllButton").style.display = "none"
                            document.getElementById("ReviewIncompleteButton").style.display = "none"
                            document.getElementById("ReviewFlaggedButton").style.display = "none"
                            document.getElementById("EndReviewButton").style.display = "none"
                            document.getElementById("ReviewInstructionsButton").style.display = "none"
                            document.getElementById("ReviewScreenButton").style.display = "block"
                        }
                        document.getElementById("itemOrdinal").innerHTML = count + 1;
                        bindquesandopt(0)
                        if (flagreview[0] == 0) {
                            $("#FlagForReviewItemButton").removeClass();
                        }
                        if ($("#Options input[type=radio]:checked").val() != undefined) {
                            statusview[count] = 2;
                        } else {
                            statusview[count] = 1;
                        }
                    };

                    function Prev() {
                        if (flag != 1 && ReviewIncomplete != 1) {
                            count--;
                            if (count < 0) {
                                count++;
                            } else {
                                LoadQuestion(count);
                            }
                        } else if (flag == 1) {
                            dataobj = flagreview;
                            if (dataobj.length - 1 < myObj.Question.length && myObj1.length == 0) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            } else if (myObj1.length != getcountofarray(flagreview)) {
                                myObj1 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            }
                            if (counter <= 0) {
                                counter++;
                                document.getElementById("PreviousButton").style.display = "none";

                            } else {
                                counter--;
                                LoadQuestion(myObj1[counter]);
                                if (counter == 0) {
                                    document.getElementById("PreviousButton").style.display = "none";
                                }
                            }
                        } else if (ReviewIncomplete == 1) {
                            dataobj = submitedans;
                            if (dataobj.length - 1 < myObj.Question.length && myObj2.length == 0) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            } else if (myObj2.length != getcountofarray(submitedans)) {
                                myObj2 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            }
                            if (counter <= 0) {
                                counter++;
                                document.getElementById("PreviousButton").style.display = "none";

                            } else {
                                counter--;
                                LoadQuestion(myObj2[counter]);
                                if (counter == 0) {
                                    document.getElementById("PreviousButton").style.display = "none";
                                }
                            }
                        }

                    }

                    function Next() {

                        if (flag == 1) {
                            dataobj = flagreview;
                            if (dataobj.length - 1 < myObj.Question.length && myObj1.length == 0) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            } else if (myObj1.length != getcountofarray(flagreview)) {
                                myObj1 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            }
                            if (dataobj.length > 0 && isArrayEmpty(flagreview)) {
                                if (counter > myObj1.length - 2) {
                                    counter--;
                                    counter = -1
                                    count = 0;
                                    flag = 0;
                                    bindreviewpage();
                                    document.getElementById("ReviewScreenButton").style.display = "none"
                                    blockReviewbuttons();
                                    hideqnandreviewbtn();
                                } else {
                                    counter++;
                                    document.getElementById("ReviewScreenButton").style.display = "block";
                                    document.getElementById("divreveiw").style.display = "none";
                                    blockReviewbuttons();
                                    blockNavigationsbuttons();

                                    count = 0;
                                    LoadQuestion(myObj1[counter]);
                                    if (counter == 0) {
                                        document.getElementById("PreviousButton").style.display = "none";
                                    }

                                }
                            } else {
                                if (document.getElementById("divreveiw").style.display == "block") {
                                    flag = 0;
                                    $("span.ui-dialog-title").text('No Questions Flagged');
                                    $(".ui-icon-closethick").addClass("clsbtnpos");
                                    $(".clsbtnpos").click()
                                    $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].accessKey = "O";
                                    $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">O</span>K</span>';
                                    $("#ReviewerDialog").html("<div id='NoSelectedItems' style='overflow: hidden auto; display: block; width: auto; min-height: 58px; max-height: none; height: auto;' class='InformationImage info-dialog ui-dialog-content ui-widget-content'><ul class='dialogUL'><li tabindex='-1' class='messageText rc-fonts-Message'>No questions have been flagged for review.  Please make your selections and try again.</li></ul></div>").dialog("open");
                                    return;
                                } else {
                                    counter--;
                                    counter = -1
                                    count = 0;
                                    flag = 0;
                                    bindreviewpage();
                                    document.getElementById("ReviewScreenButton").style.display = "none"
                                    blockReviewbuttons();
                                    hideqnandreviewbtn();
                                }
                            }


                        } else if (ReviewIncomplete == 1) {

                            dataobj = submitedans;
                            if (dataobj.length <= myObj.Question.length && (myObj2.length == 0)) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            } else if (myObj2.length != getcountofarray(submitedans) || myObj2.length == Math.round(myObj.Question.length / 2)) {
                                myObj2 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            }
                            if (submitedans.length != myObj2.length) {
                                if (counter > myObj2.length - 2) {
                                    if (document.getElementById("divreveiw").style.display == "block") {
                                        ReviewIncomplete = 0;
                                        $("span.ui-dialog-title").text('No Incomplete Questions');
                                        $(".ui-icon-closethick").addClass("clsbtnpos");
                                        $(".clsbtnpos").click()
                                        $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].accessKey = "O";
                                        $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">O</span>K</span>';
                                        $("#ReviewerDialog").html("<div id='NoIncompleteItems' style='overflow: hidden auto; display: block; width: auto; min-height: 58px; max-height: none; height: auto;' class='InformationImage info-dialog ui-dialog-content ui-widget-content'><ul class='dialogUL'><li tabindex='-1' class='messageText rc-fonts-Message'>There are no incomplete questions to review.</li></ul></div>").dialog("open");
                                        return;
                                    } else {
                                        counter--;
                                        counter = -1
                                        flag == 0;
                                        count = 0;
                                        bindreviewpage();
                                        document.getElementById("ReviewScreenButton").style.display = "none"
                                        blockReviewbuttons();
                                        hideqnandreviewbtn();
                                    }

                                } else {
                                    counter++;
                                    document.getElementById("ReviewScreenButton").style.display = "block";
                                    document.getElementById("divreveiw").style.display = "none";
                                    blockReviewbuttons();
                                    blockNavigationsbuttons();
                                    count = 0;
                                    LoadQuestion(myObj2[counter]);
                                    if (counter == 0) {
                                        document.getElementById("PreviousButton").style.display = "none";
                                    }
                                }
                            } else {
                                ReviewIncomplete = 0;
                                $("span.ui-dialog-title").text('No Incomplete Questions');
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $(".clsbtnpos").click()
                                $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].accessKey = "O";
                                $('.ui-dialog-buttonpane').find('button:contains("OK")')[1].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">O</span>K</span>';
                                $("#ReviewerDialog").html("<div id='NoIncompleteItems' style='overflow: hidden auto; display: block; width: auto; min-height: 58px; max-height: none; height: auto;' class='InformationImage info-dialog ui-dialog-content ui-widget-content'><ul class='dialogUL'><li tabindex='-1' class='messageText rc-fonts-Message'>There are no incomplete questions to review.</li></ul></div>").dialog("open");
                                return;
                            }
                        } else {
                            count++;
                            if (count > myObj.Question.length - 1) {
                                count--;
                                bindreviewpage();
                                blockReviewbuttons();
                                hideqnandreviewbtn();
                                document.getElementById("ReviewScreenButton").style.display = "none"
                            } else {
                                LoadQuestion(count);
                            }
                        }

                    }


                    function countdown(minutes) {
                        var seconds = 60;
                        var mins = minutes;
                        $(function () {
                            $("#TimerDialog").dialog({
                                autoOpen: false,
                                modal: false,
                                title: "End Exam",
                                width: 440.6,
                                buttons: {
                                    OK: function () {
                                        $(this).dialog("close");
                                        Noneallbuttons();
                                        document.getElementById("divreveiw").style.display = "none";
                                        $("#ItemOrdinalKnownButton").css("display", "none");
                                        $("#toolbar-flags").css("display", "none");
                                        $("#EndExamDiv").css("display", "block");
                                        $("#EndExamButton").css("display", "block");
                                    }
                                },
                                close: function () {
                                    $(this).dialog("close");
                                    Noneallbuttons();
                                    document.getElementById("divreveiw").style.display = "none";
                                    $("#ItemOrdinalKnownButton").css("display", "none");
                                    $("#toolbar-flags").css("display", "none");
                                    $("#EndExamDiv").css("display", "block");
                                    $("#EndExamButton").css("display", "block");
                                }
                            });
                        });
                        $(function () {
                            $("#WarningTimerDialog").dialog({
                                autoOpen: false,
                                modal: true,
                                title: "5 Minute Warning",
                                width: 440.6,
                                open: function (event, ui) {
                                    $('.ui-widget-overlay').bind('click', function () {
                                        $("#EndReviewConfDialog").dialog('close');
                                    });
                                }

                            });
                        });

                        function tick() {
                            var counter = document.getElementById("timeRemaining");
                            var current_minutes = mins - 1

                            seconds--;
                            counter.innerHTML =
                                current_minutes.toString() + ":" + (seconds < 10 ? "0" : "") + String(seconds);
                            if (seconds > 0) {
                                timeoutHandle = setTimeout(tick, 1000);
                            } else {
                                if (mins > 1) {
                                    setTimeout(function () {
                                        countdown(mins - 1);
                                    }, 1000);
                                }
                            }
                            if (current_minutes < 5 && timing == 0) {
                                timing = 1;
                                $(".ui-dialog-buttonset").addClass("position-center");
                                $(".ui-dialog-titlebar-close").css("background", "#006DAA");
                                $("span.ui-dialog-title").html("<span class='Clock'></span><span class='ui-exam-dialog-title rc-fonts-Message' id='titletext5MinuteWarning' style='width:280px;'>5 Minute Warning</span>");
                                $(".ui-dialog.ui-widget-content").css("width", "");
                                $("#TimeRemainingSectionButton").addClass("locked");
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $(".clsbtnpos").click()
                                $("#WarningTimerDialog").html(
                                    "<div class='tt content-root undef-width block-leading verticalPadding'><div class='sub-root undef-width' ><div class=' tt undef-width block-leading noPadding' ><div class=' tt undef-width block-leading noPadding' leafdatatype='text' ><p class='paragraph-center'><span style='font-family: Arial; font-size: 11pt'>You have 5 minutes remaining</span></p></div></div></div></div>"
                                ).dialog("open");
                            }
                            if (current_minutes == 0 && seconds == 0) {
                                $(".ui-dialog-buttonset").addClass("position-center");
                                $(".ui-icon-closethick").addClass("clsbtnpos");
                                $("#timerContents").text("Time Expired");
                                $("#WarningTimerDialog").dialog("close");
                                $("span.ui-dialog-title").text("End Exam")
                                $(".clsbtnpos").click()
                                $('.ui-dialog-buttonpane').find('button:contains("OK")')[0].accessKey = "O";
                                $('.ui-dialog-buttonpane').find('button:contains("OK")')[0].innerHTML = '<span class="ui-button-text rc-fonts-Message"><span class="accesskey">O</span>K</span>';
                                $("#TimerDialog").html(
                                    "<div id='TimeExpired' style='overflow: hidden auto; display: block; width: auto; min-height: 58px; max-height: none; height: auto;' class='InformationImage info-dialog ui-dialog-content ui-widget-content'><ul class='dialogUL'><li tabindex='-1' class='messageText rc-fonts-Message'>Your time has expired. Click OK to continue.</li></ul></div>"
                                ).dialog("open");
                            }
                        }
                        tick();
                    }

                    function LoadQuestion(count) {
                        unhideqnandreviewbtn();
                        $('#Options').find('input[type=radio]:checked').removeAttr('checked');
                        if (submitedans != null) {
                            $('#Options').find('input[value=' + submitedans[count] + ']').prop("checked", true);
                        }
                        if ($("#Options input[type=radio]:checked").val() == undefined) {
                            statusview[count] = 1;
                        }
                        if (flagreview[count] == 1) {
                            $("#FlagForReviewItemButton").removeClass("FlagForReviewItemButtonUnselected");
                            $("#FlagForReviewItemButton").addClass("FlagForReviewItemButtonSelected");
                        } else {
                            $("#FlagForReviewItemButton").removeClass("FlagForReviewItemButtonSelected");
                            $("#FlagForReviewItemButton").addClass("FlagForReviewItemButtonUnselected");
                        }
                        if (count < 1) {
                            document.getElementById("itemOrdinal").innerHTML = count + 1;
                            document.getElementById("PreviousButton").style.display = "none";
                            bindquesandopt(count)
                        } else if (count > 0) {
                            document.getElementById("itemOrdinal").innerHTML = count + 1;
                            document.getElementById("PreviousButton").style.display = "block";
                            document.getElementById("NextButton").style.display = "block";
                            bindquesandopt(count)
                        } else {
                            document.getElementById("itemOrdinal").innerHTML = count + 1;
                            document.getElementById("NextButton").style.display = "block";
                            bindquesandopt(count)
                        }
                    }

                    function flagforreview(count) {
                        if (ReviewIncomplete == 1) {
                            count = myObj2[counter];
                            counter--;
                        } else if (flag == 1) {
                            count = myObj1[counter];
                            counter--;
                        }
                        if (flagreview.length > 0) {
                            if (flagreview[count] == 1) {
                                delete flagreview[count];
                                $("#FlagForReviewItemButton").removeClass("FlagForReviewItemButtonSelected");
                                $("#FlagForReviewItemButton").addClass("FlagForReviewItemButtonUnselected");
                            } else {
                                flagreview[count] = 1;
                                $("#FlagForReviewItemButton").removeClass("FlagForReviewItemButtonUnselected");
                                $("#FlagForReviewItemButton").addClass("FlagForReviewItemButtonSelected");
                            }
                        } else {
                            flagreview[count] = 1;
                            $("#FlagForReviewItemButton").removeClass("FlagForReviewItemButtonUnselected");
                            $("#FlagForReviewItemButton").addClass("FlagForReviewItemButtonSelected");
                        }
                    }

                    function Timercontent() {
                        if (document.getElementById("timerContents").style.display == "") {
                            document.getElementById("timerContents").style.display = "none";
                        } else {
                            document.getElementById("timerContents").style.display = "";
                        }
                    }

                    function Questioncontent() {
                        if (document.getElementById("itemCounterWrapper").style.display == "") {
                            document.getElementById("itemCounterWrapper").style.display = "none";
                        } else {
                            document.getElementById("itemCounterWrapper").style.display = "";
                        }
                    }

                    function LoadQuestiononNavigation(obj) {
                        ReviewIncomplete = 0;
                        flag = 0
                        if (document.getElementById("readMe").style.display == "none") {
                            document.getElementById("readMe").style.display = "block"
                            document.getElementById("divreveiw").style.display = "none";
                            document.getElementById("NextButton").style.display = "block";
                            document.getElementById("NavigatorButton").style.display = "none";
                            document.getElementById("PreviousButton").style.display = "block";
                            document.getElementById("calculatorButton").style.display = "block";
                            document.getElementById("ReviewAllButton").style.display = "none"
                            document.getElementById("ReviewIncompleteButton").style.display = "none"
                            document.getElementById("ReviewFlaggedButton").style.display = "none"
                            document.getElementById("EndReviewButton").style.display = "none"
                            document.getElementById("ReviewInstructionsButton").style.display = "none"
                            document.getElementById("ReviewScreenButton").style.display = "block"
                        }
                        $("#dialog").dialog('close');
                        $("#ex1").hide();
                        $("body").removeClass("jquery-modal blocker current");
                        count = obj.attributes.id.value - 1;
                        LoadQuestion(count);
                    }

                    function changeHashOnLoad() {
                        window.location.href += '#';
                        setTimeout('changeHashAgain()', '50');
                    }

                    function changeHashAgain() {
                        window.location.href += '1';
                    }

                    var storedHash = window.location.hash;
                    window.setInterval(function () {
                        if (window.location.hash != storedHash) {
                            window.location.hash = storedHash;
                        }
                    }, 50);

                    $('#Options').find('input[type=radio]').click(function () {

                        if (flag == 1) {
                            if (flagreview.length - 1 < myObj.Question.length && myObj1.length == 0) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            } else if (myObj1.length != getcountofarray(flagreview)) {
                                myObj1 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (flagreview[k] != undefined)
                                        myObj1.push(k);
                                }
                            }
                        } else if (ReviewIncomplete == 1) {
                            if (submitedans.length <= myObj.Question.length && (myObj2.length == 0)) {
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            } else if (myObj2.length != getcountofarray(submitedans)) {
                                myObj2 = [];
                                for (var k = 0; k < myObj.Question.length; k++) {
                                    if (submitedans[k] == undefined)
                                        myObj2.push(k);
                                }
                            }
                            statusview[myObj2[counter]] = 2;
                            submitedans[myObj2[counter]] = $("#Options input[type=radio]:checked").val();
                            counter--;
                        } else {
                            statusview[count] = 2;
                            submitedans[count] = $("#Options input[type=radio]:checked").val()
                        }
                    });
                    $('.CollapseButton').click(function () {
                        $(".buttonTextAlign")[0].className = "ui-button buttonTextAlign ExpandButton"
                        if ($(".expandable")[0].style.display == "block") {
                            $('.expandable').css("display", "none")
                            $(".buttonTextAlign")[0].className = "ui-button buttonTextAlign ExpandButton"
                        } else {
                            $(".buttonTextAlign")[0].className = "ui-button buttonTextAlign CollapseButton"
                            $('.expandable').css("display", "block")
                        }

                    })

                    function ReviewIncompleteButton() {
                        $(".ui-dialog-buttonset").addClass("position-center");
                        $(".ui-dialog-titlebar-close").css("background", "#006DAA")
                        flag = 0;
                        ReviewIncomplete = 1;
                        Next();

                    }

                    function bindreviewpage() {
                        flag = 0;
                        ReviewIncomplete = 0;

                        $(".CollapseButton").css("height", "24px");
                        $(".CollapseButton").css("border", "none")
                        var elements = $();
                        document.getElementById("divreveiw").style.display = "block"
                        total_attended = myObj.Question.length - submitedanscount();
                        sessionStorage.setItem("tot", total_attended)
                        document.getElementById("incompleteCount").innerHTML = total_attended;
                        length = myObj.Question.length;
                        $('#reviewtab').empty();
                        var table = document.getElementById("reviewtab");
                        var statusdata;
                        var statuscomp;
                        for (var k = 1; k <= length; k++) {
                            if (flagreview[k - 1] == 1) {
                                flagclass = "FlagForReviewReviewScreenButtonselected";
                            } else {
                                flagclass = "FlagForReviewReviewScreenButtonUnselected"
                            }
                            if (statusview[k - 1] == 2) {
                                statusdata = "";
                            } else if (statusview[k - 1] == 1) {
                                statuscomp = "status rc-fonts-Message unseenOrIncomplete";
                                statusdata = "InComplete";
                            } else {
                                statuscomp = "status rc-fonts-Message unseenOrIncomplete";
                                statusdata = "UnSeen"
                            }
                            if ((k - 1) == count)
                                selectclass = "navpoint selectedRowColor";
                            else if (k % 2 == 0)
                                selectclass = "navpoint even";
                            else
                                selectclass = "navpoint odd";
                            var flagre = k - 1;
                            $('#reviewtab').append('<div id="div' + k + '" style="border-bottom:1px solid lightgray"><div  class="reviewItemTitleAndStatus"><button id=' + k + ' onclick="flagforreview(' + flagre + ');bindreviewpagefrompage()" class="FlagForReviewReviewScreenButton ' + flagclass + '" style="margin-top: 3px;height:28px !important;margin-left: -41px;"></button><button id=' + k + '  onclick="LoadQuestiononNavigation(this)" class="Content reviewItemTitle ui-button rc-fonts-Small" style="background: none;border: none;">Question ' + k + '</button><div class="rc-fonts-Small reviewComplete" style="color:red">' + statusdata + '</div></div></div>')
                            $('#reviewtab').append('</div>');
                        }
                        var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&')[0].split('=')[1]
                            .split('#');;
                        switch (hashes[0]) {
                            case 'E':
                                $(".buttonTextAlign")[1].innerHTML = "English Section"
                                break;
                            case 'S':
                                $(".buttonTextAlign")[1].innerHTML = "Sinhala Section"
                                break;
                            case 'T':
                                $(".buttonTextAlign")[1].innerHTML = "Tamil Section"
                                break;
                        }

                        $("#div5").css("border-bottom", "");

                    }

                    function bindreviewpagefrompage() {
                        if (flag == 1 || ReviewIncomplete == 1) {
                            counter = -1;
                        }
                        hideqnandreviewbtn()
                        bindreviewpage();
                        blockReviewbuttons();
                        document.getElementById("ReviewScreenButton").style.display = "none"
                    }

                    function bindflageddata() {
                        $(".ui-dialog-titlebar-close").css("background", "#006DAA")
                        $(".ui-dialog-buttonset").addClass("position-center");
                        ReviewIncomplete = 0;
                        flag = 1;
                        Next();
                    }

                    function bindquesandopt(count) {                                                
                        document.getElementById("SubjectName").innerHTML = myObj.Question[count].subject;
                        document.getElementById("Question").innerHTML = myObj.Question[count].Question;
                        document.getElementById("OptionA").innerHTML = myObj.Question[count].OptionA;
                        document.getElementById("OptionB").innerHTML = myObj.Question[count].OptionB;
                        document.getElementById("OptionC").innerHTML = myObj.Question[count].OptionC;
                        document.getElementById("OptionD").innerHTML = myObj.Question[count].OptionD;
                    }

                    function blockReviewbuttons() {
                        document.getElementById("NextButton").style.display = "none";
                        document.getElementById("NavigatorButton").style.display = "none";
                        document.getElementById("PreviousButton").style.display = "none";
                        document.getElementById("readMe").style.display = "none";
                        document.getElementById("calculatorButton").style.display = "none";
                        document.getElementById("ReviewAllButton").style.display = "block"
                        document.getElementById("ReviewIncompleteButton").style.display = "block"
                        document.getElementById("ReviewFlaggedButton").style.display = "block"
                        document.getElementById("EndReviewButton").style.display = "block"
                        document.getElementById("ReviewInstructionsButton").style.display = "block"
                    }

                    function blockNavigationsbuttons() {
                        document.getElementById("NextButton").style.display = "block";
                        document.getElementById("NavigatorButton").style.display = "none";
                        document.getElementById("PreviousButton").style.display = "block";
                        document.getElementById("readMe").style.display = "block";
                        document.getElementById("calculatorButton").style.display = "block";
                        document.getElementById("ReviewAllButton").style.display = "none"
                        document.getElementById("ReviewIncompleteButton").style.display = "none"
                        document.getElementById("ReviewFlaggedButton").style.display = "none"
                        document.getElementById("EndReviewButton").style.display = "none"
                        document.getElementById("ReviewInstructionsButton").style.display = "none"
                        document.getElementById("ReviewScreenButton").style.display = "block"
                    }

                    function Noneallbuttons() {
                        document.getElementById("NextButton").style.display = "none";
                        document.getElementById("NavigatorButton").style.display = "none";
                        document.getElementById("PreviousButton").style.display = "none";
                        document.getElementById("readMe").style.display = "none";
                        document.getElementById("calculatorButton").style.display = "none";
                        document.getElementById("ReviewAllButton").style.display = "none"
                        document.getElementById("ReviewIncompleteButton").style.display = "none"
                        document.getElementById("ReviewFlaggedButton").style.display = "none"
                        document.getElementById("EndReviewButton").style.display = "none"
                        document.getElementById("ReviewInstructionsButton").style.display = "none"
                        document.getElementById("ReviewScreenButton").style.display = "none"
                        document.getElementById("timer").style.display = "none"
                    }

                    function hideqnandreviewbtn() {
                        document.getElementById("itemCounter").style.display = "none"
                        document.getElementById("FlagForReviewItemButton").style.display = "none"
                    }

                    function unhideqnandreviewbtn() {
                        document.getElementById("itemCounter").style.display = "block"
                        document.getElementById("FlagForReviewItemButton").style.display = "block"
                    }

                    function submitedanscount() {
                        var c = 0;
                        for (i in submitedans) // in returns key, not object
                            if (submitedans[i] != undefined)
                                c++;

                        return c;
                    }

                    function getcountofarray(obj) {
                        var c = 0;
                        for (i in obj) // in returns key, not object
                            if (obj[i] != undefined)
                                c++;

                        return c;
                    }

                    function sortTable(n) {
                        var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0;
                        table = document.getElementById("navigator");
                        switching = true;
                        //Set the sorting direction to ascending:
                        dir = "asc";
                        /*Make a loop that will continue until
                        no switching has been done:*/
                        while (switching) {
                            //start by saying: no switching is done:
                            switching = false;
                            rows = table.rows;
                            /*Loop through all table rows (except the
                            first, which contains table headers):*/
                            for (i = 1; i < (rows.length - 1); i++) {
                                //start by saying there should be no switching:
                                shouldSwitch = false;
                                /*Get the two elements you want to compare,
                                one from current row and one from the next:*/
                                x = rows[i].getElementsByTagName("TD")[n];
                                y = rows[i + 1].getElementsByTagName("TD")[n];
                                /*check if the two rows should switch place,
                                based on the direction, asc or desc:*/
                                if (dir == "asc") {
                                    if (n == 0) {
                                        $("#sorting2").removeClass();
                                        $("#sorting3").removeClass();
                                        $("#sorting1").addClass("UpArrowImage");
                                        $("#sorting1").removeClass("DownArrowImage");
                                    } else if (n == 1) {
                                        $("#sorting1").removeClass();
                                        $("#sorting3").removeClass();
                                        $("#sorting2").addClass("DownArrowImage");
                                        $("#sorting2").removeClass(" UpArrowImage");
                                    } else {
                                        $("#sorting2").removeClass();
                                        $("#sorting1").removeClass();
                                        $("#sorting3").addClass("UpArrowImage");
                                        $("#sorting3").removeClass("DownArrowImage");
                                    }
                                    if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) {
                                        //if so, mark as a switch and break the loop:                                                            
                                        shouldSwitch = true;
                                        break;
                                    }
                                } else if (dir == "desc") {
                                    if (n == 0) {
                                        $("#sorting2").removeClass();
                                        $("#sorting3").removeClass();
                                        $("#sorting1").addClass("DownArrowImage");
                                        $("#sorting1").removeClass("UpArrowImage");
                                    } else if (n == 1) {
                                        $("#sorting1").removeClass();
                                        $("#sorting3").removeClass();
                                        $("#sorting2").addClass("UpArrowImage");
                                        $("#sorting2").removeClass("DownArrowImage");
                                    } else {
                                        $("#sorting2").removeClass();
                                        $("#sorting1").removeClass();
                                        $("#sorting3").addClass("DownArrowImage");
                                        $("#sorting3").removeClass("UpArrowImage");
                                    }
                                    if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) {
                                        //if so, mark as a switch and break the loop:                                
                                        shouldSwitch = true;
                                        break;
                                    }
                                }
                            }
                            if (shouldSwitch) {
                                /*If a switch has been marked, make the switch
                                and mark that a switch has been done:*/
                                rows[i].parentNode.insertBefore(rows[i + 1], rows[i]);
                                switching = true;
                                //Each time a switch is done, increase this count by 1:
                                switchcount++;
                            } else {
                                /*If no switching has been done AND the direction is "asc",
                                set the direction to "desc" and run the while loop again.*/
                                if (switchcount == 0 && dir == "asc") {
                                    if (n == 0) {
                                        $("#sorting2").removeClass();
                                        $("#sorting3").removeClass();
                                        $("#sorting1").addClass("DownArrowImage");
                                        $("#sorting1").removeClass("UpArrowImage");
                                    }
                                    dir = "desc";
                                    switching = true;
                                }
                            }
                        }
                    }

                    function endtest() {
                        window.location.href = "https://home.pearsonvue.com/";
                    }

                    function Close() {
                        document.getElementById("calcDisp").style.display = "none";
                    }

                    function isArrayEmpty(Obj) {
                        for (var key in Obj) {
                            if (Obj.hasOwnProperty(key)) {
                                return true;
                            }
                        }
                        return false;
                    }