function GetUrlGui()
{var sharableUrl;var instructionText;var openLeft=true;var anchorText="GMAT Practice Test Results";var title="Get Link";this.setSharableUrl=function(inputUrl)
{sharableUrl=inputUrl;}
this.setInstructionText=function(inputText)
{instructionText=inputText;}
this.setOpenLeft=function(inputDirection)
{if(inputDirection==true)
{openLeft=true;}
else
{openLeft=false;}}
this.setAnchorText=function(sharableUrlAnchorText)
{anchorText=sharableUrlAnchorText;}
this.setTitle=function(inputTitle)
{title=inputTitle;}
this.getGuiHtml=function()
{var randDomId=Math.floor(Math.random()*1111);var urlDispHtml='';urlDispHtml+='<a href="#" onclick="ToggleGetUrlGui.toggleGetUrlDisplay(\'ajaxq-get-url-'+randDomId+'\', \'ajaxq-get-url-hyperlink-'+randDomId+'\', '+openLeft+'); return false;" id="ajaxq-get-url-hyperlink-'+randDomId+'">Get Link</a>';urlDispHtml+='<div class="ajaxq-get-url-disabled" id="ajaxq-get-url-'+randDomId+'">';urlDispHtml+='<div class="ajaxq-get-url-header">'+title+'</div>';urlDispHtml+='<div class="ajaxq-get-url-body">';urlDispHtml+='<p class="ajaxq-get-url-sub-header">Paste This Link in an IM, Email, or Message Board</p>';urlDispHtml+='<input type="text" value="'+sharableUrl+'" onclick="this.select();" id="ajaxq-get-url-'+randDomId+'-textbox" size="55" readonly="readonly" />';urlDispHtml+='<p class="ajaxq-get-url-sub-header">Paste This HTML Link Code in a Website</p>';urlDispHtml+='<input type="text" value="&lt;a href=&quot;'+sharableUrl+'&quot;&gt;'+sharableUrl+'&lt;/a&gt;" onclick="this.select();" size="55" readonly="readonly" />';urlDispHtml+='<div class="ajaxq-get-url-footer">';urlDispHtml+='<input type="submit" class="input-button" value="Close" onclick="ToggleGetUrlGui.toggleGetUrlDisplay(\'ajaxq-get-url-'+randDomId+'\', \'ajaxq-get-url-hyperlink-'+randDomId+'\', '+openLeft+');" />';urlDispHtml+='</div>';urlDispHtml+='</div>';urlDispHtml+='</div>';return urlDispHtml;}}
var ToggleGetUrlGui={toggleGetUrlDisplay:function(domId,parentDomId,openLeft)
{if(document.getElementById(domId)==null||document.getElementById(domId)==undefined||document.getElementById(parentDomId)==null||document.getElementById(parentDomId)==undefined)
{ErrorLogger.logError("AjaxSessionGuiDriver.toggleGetUrlDisplay invoked with DOM ID(s) that did not exist: "+domId+" and "+parentDomId);return false;}
if(openLeft==null||openLeft==undefined||openLeft==true)
{openLeft=true;}
else
{openLeft=false;}
if(document.getElementById(domId).className=="ajaxq-get-url-disabled")
{element=document.getElementById(parentDomId);var y=0;for(var e=element;e;e=e.offsetParent)
{y+=e.offsetTop;}
var x=0;element=document.getElementById(parentDomId);while(element)
{x+=element.offsetLeft;element=element.offsetParent;}
document.getElementById(domId).className="ajaxq-get-url-enabled";if(openLeft)
{document.getElementById(domId).style.left=(x-400)+"px";}
else
{document.getElementById(domId).style.left=(x)+"px";}
document.getElementById(domId+"-textbox").select();document.getElementById("ajaxq-div-overlay").className="ajaxq-div-overlay-enabled";}
else if(document.getElementById(domId).className="ajaxq-get-url-enabled")
{document.getElementById(domId).className="ajaxq-get-url-disabled";document.getElementById("ajaxq-div-overlay").className="ajaxq-element-disabled";}
return false;}};var GlobalVariables={AjaxRootDirectory:"gmat-practice-test/",AjaxQuestionContextShareDirectory:"gmat-practice-test/",END_OF_QUESTION_LIST:89014999,CLOCK_COUNTING_MODE_COUNTDOWN:89898989,CLOCK_COUNTING_MODE_COUNTUP:8989898329,ANSWER_LEFT_BLANK:"None",TYPE_STATIC_QUIZ:1,TYPE_CAT_QUIZ:2,TYPE_CAT_TEST_FULL:3,CAT_SECTION_VERBAL:1,CAT_SECTION_QUANT:0,SHARE_PERMISSIONS_USER_ONLY:0,SHARE_PERMISSIONS_PUBLIC_URL:4,SHARE_PERMISSIONS_PUBLIC_LIST:5,QUESTION_LIST_TYPE_QUANT_CAT:0,QUESTION_LIST_TYPE_VERBAL_CAT:1,PREFIX_QUESTION_LIST_TYPE_QUANT_CAT:9999,PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT:9998,SECONDS_AVAILABLE_ON_AWA:1800,SECONDS_AVAILABLE_ON_QUANT:4500,SECONDS_AVAILABLE_ON_VERBAL:4500,AWA_TYPE_ARGUMENT_ESSAY:0,AWA_TYPE_ISSUE_ESSAY:1,AUTHORIZATION_ACCESS_PERMISSIONS_OWNER:1,AUTHORIZATION_ACCESS_PERMISSIONS_READER:0,AJAX_SERVER_OPERATION_STATUS_SUCCESS:0,AJAX_SERVER_OPERATION_STATUS_ERR_NO_PARAM:1001,AJAX_SERVER_OPERATION_STATUS_ERR_PARAM_INVALID:1002,AJAX_SERVER_OPERATION_STATUS_ERR_DATABASE:1003,AJAX_SERVER_OPERATION_STATUS_ERR_DUPLICATE_ALREADY_EXISTS:1006,AJAX_SERVER_OPERATION_STATUS_ERR_NO_USER_ID:1004,AJAX_SERVER_OPERATION_STATUS_ERR_NO_COOKIES:1111,AJAX_SERVER_OPERATION_STATUS_SUCCESS_ALREADY_EXISTS:600,PRACTICE_TEST_STATE_NOT_BEGUN:0,PRACTICE_TEST_STATE_AWA_ISSUE_BEGUN:1,PRACTICE_TEST_STATE_AWA_ISSUE_COMPLETED:2,PRACTICE_TEST_STATE_AWA_ARGUMENT_BEGUN:3,PRACTICE_TEST_STATE_AWA_ARGUMENT_COMPLETED:4,PRACTICE_TEST_STATE_QUANT_BEGUN:5,PRACTICE_TEST_STATE_QUANT_COMPLETED:6,PRACTICE_TEST_STATE_VERBAL_BEGUN:7,PRACTICE_TEST_STATE_TEST_COMPLETED:8,PRACTICE_TEST_MAX_VERBAL_QUESTIONS:41,PRACTICE_TEST_MAX_QUANT_QUESTIONS:37,QC_NT_ANCILLARY_STATE_NEW_TEST:0,QC_NT_ANCILLARY_STATE_AWA_ISSUE_INSTRUCTIONS:1,QC_NT_ANCILLARY_STATE_AWA_ISSUE:2,QC_NT_ANCILLARY_STATE_AWA_ARGUMENT_INSTRUCTIONS:3,QC_NT_ANCILLARY_STATE_AWA_ARGUMENT:4,QC_NT_ANCILLARY_STATE_QUANT_INSTRUCTIONS:5,QC_NT_ANCILLARY_STATE_VERBAL_INSTRUCTIONS:6,getAjaxRootDirectory:function()
{return GlobalVariables.getAbsoluteRootPath()+GlobalVariables.AjaxRootDirectory;},getPracticeTestDirectory:function()
{return GlobalVariables.AjaxRootDirectory.substring(0,GlobalVariables.AjaxRootDirectory.length-1);},getAjaxQuestionContextShareDirectory:function()
{return GlobalVariables.getAbsoluteRootPath()+GlobalVariables.AjaxQuestionContextShareDirectory;},getAbsoluteRootPath:function()
{return AJAX.getAbsoluteRootPath();},handleStarQuestionMouseOver:function(starQId,domId,domTextId)
{if(document.getElementById(domId).src.indexOf("/")==-1)
{var urlSplit=document.getElementById(domId).src.split("\\");}
else
{var urlSplit=document.getElementById(domId).src.split("/");}
var imgUrl=urlSplit[urlSplit.length-1];var baseImgUrl="";for(var i=0;i<urlSplit.length-1;i++)
{baseImgUrl+=urlSplit[i]+"/";}
if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(starQId)==true)
{document.getElementById(domId).src=baseImgUrl+"star_off.gif";return true;}
else if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(starQId)==false)
{document.getElementById(domId).src=baseImgUrl+"star_on.gif";return true;}},handleStarQuestionMouseOut:function(starQId,domId,domTextId)
{if(document.getElementById(domId).src.indexOf("/")==-1)
{var urlSplit=document.getElementById(domId).src.split("\\");}
else
{var urlSplit=document.getElementById(domId).src.split("/");}
var imgUrl=urlSplit[urlSplit.length-1];var baseImgUrl="";for(var i=0;i<urlSplit.length-1;i++)
{baseImgUrl+=urlSplit[i]+"/";}
if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(starQId)==true)
{document.getElementById(domId).src=baseImgUrl+"star_on.gif";if(document.getElementById(domTextId)!=null&&document.getElementById(domTextId)!=undefined)
{document.getElementById(domTextId).innerHTML="Remove&nbsp;Star";}
return true;}
else if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(starQId)==false)
{document.getElementById(domId).src=baseImgUrl+"star_off.gif";if(document.getElementById(domTextId)!=null&&document.getElementById(domTextId)!=undefined)
{document.getElementById(domTextId).innerHTML="Star&nbsp;Question";}
return true;}},changeStarQuestionState:function(starQId,domId,domTextId)
{if(document.getElementById(domId).src.indexOf("/")==-1)
{var urlSplit=document.getElementById(domId).src.split("\\");}
else
{var urlSplit=document.getElementById(domId).src.split("/");}
var imgUrl=urlSplit[urlSplit.length-1];var baseImgUrl="";for(var i=0;i<urlSplit.length-1;i++)
{baseImgUrl+=urlSplit[i]+"/";}
if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(starQId))
{MarkedQuestionRepositoryManager.removeQuestionIdFromRepository(starQId);document.getElementById(domId).src=baseImgUrl+"star_off.gif";if(document.getElementById(domTextId)!=null&&document.getElementById(domTextId)!=undefined)
{document.getElementById(domTextId).innerHTML="Star&nbsp;Question";}}
else
{MarkedQuestionRepositoryManager.addQuestionIdToRepository(starQId);document.getElementById(domId).src=baseImgUrl+"star_on.gif";if(document.getElementById(domTextId)!=null&&document.getElementById(domTextId)!=undefined)
{document.getElementById(domTextId).innerHTML="Remove&nbsp;Star";}}},isAwaEnabledInPracticeContext:function(inputQuestionContextId)
{var awaEnabled=GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'awa_enabled');if(awaEnabled==1)
{return true;}
else
{return false;}},getAdditionalInformationVariableForQuestionContext:function(inputQuestionContextId,variable)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(inputQuestionContextId))
{var additionalInformation=QuestionContextRepositoryManager.getQuestionContextById(inputQuestionContextId).getAdditionalInformation();if(typeof additionalInformation!='string'||additionalInformation==null||additionalInformation==undefined)
{return false;}
var criteria=new RegExp(variable+":[ ]{0,}([0-9]+)","i");var searchResult=additionalInformation.match(criteria);if(searchResult!=null&&searchResult[1]!=undefined&&searchResult[1]!=null)
{return searchResult[1];}
else
{return null;}}
return null;},setAdditionalInformationVariableForQuestionContext:function(inputQuestionContextId,variable,value)
{insertVariableFromScratch=function()
{var additionalInformation=QuestionContextRepositoryManager.getQuestionContextById(inputQuestionContextId).getAdditionalInformation();additionalInformation+=' '+variable+': '+value+';';QuestionContextRepositoryManager.getQuestionContextById(inputQuestionContextId).setAdditionalInformation(additionalInformation);}
if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,variable)!=null)
{var additionalInformation=QuestionContextRepositoryManager.getQuestionContextById(inputQuestionContextId).getAdditionalInformation();if(typeof additionalInformation!='string'||additionalInformation==null||additionalInformation==undefined)
{return false;}
var criteria=new RegExp("("+variable+":[ ]{0,}[0-9]+;)","i");while(additionalInformation.search(criteria)!=-1)
{var searchResult=additionalInformation.replace(criteria,'');additionalInformation=searchResult;}
QuestionContextRepositoryManager.getQuestionContextById(inputQuestionContextId).setAdditionalInformation(additionalInformation);insertVariableFromScratch();}
else if(QuestionContextRepositoryManager.doesQuestionContextExist(inputQuestionContextId))
{insertVariableFromScratch();}},assembleQuestionListsForTestByQCId:function(inputQuestionContextId,questionListAssembledCallback,inputErrorCatch)
{assembleQuestionLists=function()
{var verbalListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT)+new String(inputQuestionContextId));var verbalList=new QuestionList(verbalListId);verbalList.setListType(GlobalVariables.TYPE_CAT_TEST_FULL);verbalList.setCatSubSection(GlobalVariables.CAT_SECTION_VERBAL);if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_verbal_question_num')!=null)
{verbalList.setMaximumQuestionCount(parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_verbal_question_num')));}
else
{verbalList.setMaximumQuestionCount(GlobalVariables.PRACTICE_TEST_MAX_VERBAL_QUESTIONS);}
var quantListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT)+new String(inputQuestionContextId));var quantList=new QuestionList(quantListId);quantList.setListType(GlobalVariables.TYPE_CAT_TEST_FULL);quantList.setCatSubSection(GlobalVariables.CAT_SECTION_QUANT);if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_quant_question_num')!=null)
{quantList.setMaximumQuestionCount(parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_quant_question_num')));}
else
{quantList.setMaximumQuestionCount(GlobalVariables.PRACTICE_TEST_MAX_VERBAL_QUESTIONS);}
for(interaction in AjaxQuestionInteractionRepositoryManager._interactionRepository)
{if(typeof AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionContextId=='function'&&typeof AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionId=='function')
{var questionContextId=AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionContextId();var questionId=AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionId();if(questionContextId==inputQuestionContextId&&QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(questionId))
{var contentCategory=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(questionId).getQuestionCategoryType();if(contentCategory=="PS"||contentCategory=="DS")
{quantList.getQuestionListContents().push(questionId);}
else if(contentCategory=="RC"||contentCategory=="SC"||contentCategory=="CR")
{verbalList.getQuestionListContents().push(questionId);}}}}
try
{QuestionListRepositoryManager.addList(verbalList);QuestionListRepositoryManager.addList(quantList);}
catch(e)
{ErrorLogger.logCaughtError(e,"Error occurred in assembleQuestionListsForTestByQCId().assembleQuestionLists();");inputErrorCatch(e);return false;}
questionListAssembledCallback();}
downloadQuestionMetaData=function()
{var questionsIdsToGrab=new Array();for(interaction in AjaxQuestionInteractionRepositoryManager._interactionRepository)
{if(typeof AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionId=='function')
{var questionId=AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction].getQuestionId();questionsIdsToGrab.push(questionId);}}
if(questionsIdsToGrab.length<1)
{assembleQuestionLists();}
else
{var myQuestionMetaDataLoader=new HttpQuestionsMetaDataLoader();myQuestionMetaDataLoader.setCallbackUponSuccess(assembleQuestionLists);if(inputErrorCatch!=undefined&&inputErrorCatch!=null)
{myQuestionMetaDataLoader.setCallbackUponFailure(inputErrorCatch);}
myQuestionMetaDataLoader.loadQuestions(questionsIdsToGrab);}}
var myAjaxQuestionInteractionLoader=new HttpAjaxQuestionInteractionLoader();myAjaxQuestionInteractionLoader.setCallbackUponSuccess(downloadQuestionMetaData);myAjaxQuestionInteractionLoader.setCallbackUponFailure(inputErrorCatch);myAjaxQuestionInteractionLoader.setQuestionContextId(inputQuestionContextId);myAjaxQuestionInteractionLoader.loadInteractions();},determineStateOfPracticeTest:function(inputQuestionContextId,inputCallback,inputErrorCatch)
{determineState=function()
{questionListAssembled=function()
{var quantListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT)+new String(inputQuestionContextId));var quantList=QuestionListRepositoryManager.getListById(quantListId);var verbalListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT)+new String(inputQuestionContextId));var verbalList=QuestionListRepositoryManager.getListById(verbalListId);var practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_NOT_BEGUN;if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_raw_low')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_raw_low')!=undefined&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_raw_high')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_raw_high')!=undefined&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'verbal_percent_high')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'verbal_percent_high')!=undefined&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_percent_low')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'quant_percent_low')!=undefined)
{inputCallback(GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED);return false;}
if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'current_state')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'current_state')!=undefined)
{practiceTestStatus=GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'current_state');inputCallback(parseInt(practiceTestStatus));return false;}
if(quantList.getQuestionListContents().length>0)
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN;}
if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_quant_question_num')!=null)
{if(quantList.getQuestionListContents().length==parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_quant_question_num')))
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED;}}
else if(quantList.getQuestionListContents().length==GlobalVariables.PRACTICE_TEST_MAX_QUANT_QUESTIONS)
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED;}
if(verbalList.getQuestionListContents().length>0)
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN;}
if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_verbal_question_num')!=null)
{if((verbalList.getQuestionListContents().length)==parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(inputQuestionContextId,'max_verbal_question_num')))
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED;}}
else if((verbalList.getQuestionListContents().length)==GlobalVariables.PRACTICE_TEST_MAX_VERBAL_QUESTIONS)
{practiceTestStatus=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED;}
inputCallback(parseInt(practiceTestStatus));}
GlobalVariables.assembleQuestionListsForTestByQCId(inputQuestionContextId,questionListAssembled,inputErrorCatch);}
var myQcGrabber=new QuestionContextGrabber();myQcGrabber.setCallbackUponSuccess(determineState);myQcGrabber.setCallbackUponFailure(inputErrorCatch);myQcGrabber.setSearchMode(myQcGrabber.searchModeById);myQcGrabber.setSearchIds(inputQuestionContextId);myQcGrabber.query();},formatTimeToFinalAnswerDisplay:function(inputSeconds)
{if(GlobalVariables.validateValueAsNumber(inputSeconds)==false)
{ErrorLogger.logWarning("An invalid input passed to GlobalVariables.formatTimeToFinalAnswerDisplay(); Input = "+inputSeconds);return'';}
if(inputSeconds!=null||inputSeconds!=undefined)
{var seconds=Math.round(new Number(inputSeconds));if(seconds<10)
{return"0:0"+seconds;}
else if(seconds<60)
{return"0:"+seconds;}
var minutes=Math.floor(seconds/60);seconds=seconds%60;if(seconds<10)
{seconds="0"+seconds;}
return minutes+":"+seconds;}
else
{return'';}},formatUtcUnixTimestampDisplayAsText:function(inputTimestamp)
{var myDate=new Date(inputTimestamp*1000);var currentUtcUnixTimestamp=GlobalVariables.getCurrentUtcUnixTimestamp();var dateDifferenceInSeconds=currentUtcUnixTimestamp-inputTimestamp;var minutesDifference=Math.floor(dateDifferenceInSeconds/60);var monthAbbr=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");if(minutesDifference<1)
{return'A minute ago';}
else if(minutesDifference<60)
{return minutesDifference+' min ago';}
else if(minutesDifference==60||Math.floor(minutesDifference/60)==1)
{return'1 hour ago';}
else if(minutesDifference<(60*24))
{return Math.floor(minutesDifference/60)+' hours ago';}
else if(Math.floor(minutesDifference/(60*24))==1)
{return'1 day ago';}
else if(minutesDifference<(60*24*8))
{return Math.floor(minutesDifference/(60*24))+' days ago';}
else if(minutesDifference<(60*24*365))
{return monthAbbr[myDate.getMonth()-1]+' '+myDate.getDate();}
else
{return monthAbbr[myDate.getMonth()-1]+' '+myDate.getDate()+' '+myDate.getFullYear();}},getCurrentUtcUnixTimestamp:function()
{var d=new Date();var localTime=Math.round(d.getTime()/1000.0);return localTime+(60*60);var localOffset=d.getTimezoneOffset()*60;var utc=localTime+localOffset;return utc;},validateDbTimestamp:function(dbTimeStamp)
{var dateSearchPattern=new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}$");return dateSearchPattern.test(dbTimeStamp);},validateQuestionId:function(questionId)
{var questionIdSearchPattern=new RegExp("^[0-9]{1,5}$");return questionIdSearchPattern.test(questionId);},validateValueAsNumber:function(input)
{var inputSearchPattern=new RegExp("^[0-9]+$");return inputSearchPattern.test(input);},validateQuestionContextType:function(input)
{if(input==GlobalVariables.TYPE_CAT_QUIZ||input==GlobalVariables.TYPE_STATIC_QUIZ||input==GlobalVariables.TYPE_CAT_TEST_FULL)
{return true;}
else
{return false;}},validateCatSubsection:function(input)
{if(input==GlobalVariables.CAT_SECTION_VERBAL||input==GlobalVariables.CAT_SECTION_QUANT)
{return true;}
else
{return false;}},validateQuestionContentCategory:function(inputCat)
{var categoryString=new String(inputCat);if(categoryString.toUpperCase()==="PS"||categoryString.toUpperCase()==="DS"||categoryString.toUpperCase()==="CR"||categoryString.toUpperCase()==="SC"||categoryString.toUpperCase()==="RC")
{return true;}
return false;},validateQuestionAnswer:function(inputAns)
{var answerString=new String(inputAns);if(answerString.toUpperCase()==="A"||answerString.toUpperCase()==="B"||answerString.toUpperCase()==="C"||answerString.toUpperCase()==="D"||answerString.toUpperCase()==="E"||answerString==GlobalVariables.ANSWER_LEFT_BLANK)
{return true;}
return false;},validatePermissions:function(input)
{if(input==GlobalVariables.SHARE_PERMISSIONS_PUBLIC_URL||input==GlobalVariables.SHARE_PERMISSIONS_PUBLIC_LIST||input==GlobalVariables.SHARE_PERMISSIONS_USER_ONLY)
{return true;}
else
{return false;}},validateAuthorization:function(inputAuth)
{if(inputAuth==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER||inputAuth==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_READER)
{return true;}
else
{return false;}},prepareInputIdsForQuerystring:function(inputIds)
{var queryStringAppendix="";if(inputIds instanceof Array||inputIds.constructor.toString().indexOf("Array")!=-1)
{queryStringAppendix=inputIds.toString();}
else if(typeof inputIds=="string"||typeof inputIds=="number"||inputIds instanceof String||inputIds instanceof Number)
{queryStringAppendix=inputIds;}
else
{ErrorLogger.logWarning("In GlobalVariables.prepareInputIdsForQuerystring(), inputIds was of unrecognized format. Values: "+inputIds);queryStringAppendix=inputIds.toString();}
return queryStringAppendix;},baseConverter:function(number,ob,nb)
{number=number.toUpperCase();var list="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";var dec=0;for(var i=0;i<=number.length;i++)
{dec+=(list.indexOf(number.charAt(i)))*(Math.pow(ob,(number.length-i-1)));}
number="";var magnitude=Math.floor((Math.log(dec))/(Math.log(nb)));for(var i=magnitude;i>=0;i--)
{var amount=Math.floor(dec/Math.pow(nb,i));number=number+list.charAt(amount);dec-=amount*(Math.pow(nb,i));}
return number;}};function AjaxCore()
{var onSuccessCallbackfunction=null;var onFailureCallbackfunction=null;var currentXHR=null;this.getOpenXHR=function()
{return currentXHR;}
this.setOnReadySuccessCallbackfunction=function(callbackFunction)
{onSuccessCallbackfunction=callbackFunction;}
this.setOnFailureCallbackfunction=function(callbackFunction)
{onFailureCallbackfunction=callbackFunction;}
this.createXHR=function()
{var obj;try
{obj=new XMLHttpRequest();}
catch(e)
{try
{obj=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e)
{try
{obj=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{if(onFailureCallbackfunction!=null)
{var myError=new AjaxUnsupportedError("Browser does not support AJAX");myError.setLevel(ErrorLogger.ERROR_TYPE_FATAL);onFailureCallbackfunction(myError);}}}}
obj.onreadystatechange=function()
{var dumpText='';if(typeof obj.toString=='function')
{duumpText=obj.toString();}
if(obj.readyState==4)
{if(typeof getAllResponseHeaders=="function"&&obj.getAllResponseHeaders().length>1)
{dumpText+="Response Headers: "+obj.getAllResponseHeaders();}
if(obj.status==200)
{var responseType=obj.getResponseHeader("Content-Type");if(responseType=='text/xml')
{if(onSuccessCallbackfunction!=null)
{onSuccessCallbackfunction(obj.responseXML);}
else
{ErrorLogger.logWarning("In AjaxCore onreadystatechange, there is no callback function to handle text/xml response. Object Dump: "+duumpText);}}
else if(responseType=='text/plain')
{if(onSuccessCallbackfunction!=null)
{onSuccessCallbackfunction(obj.responseText);}
else
{ErrorLogger.logWarning("In AjaxCore onreadystatechange, there is no callback function to handle text/plain response.  Object Dump: "+duumpText);}}
else if(responseType=='text/html')
{if(onSuccessCallbackfunction!=null)
{onSuccessCallbackfunction(obj.responseText);}
else
{ErrorLogger.logWarning("In AjaxCore onreadystatechange, there is no callback function to handle text/html response.  Object Dump: "+duumpText);}}
else
{if(onFailureCallbackfunction!=null)
{var myError=new AjaxServerError("In AjaxCore onreadystatechange, there is an unrecognized responseType: "+responseType+". Object Dump: "+duumpText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);onFailureCallbackfunction(myError);}}}
else
{if(onFailureCallbackfunction!=null)
{var myError=new AjaxServerError("In AjaxCore onreadystatechange, response came with a status code of: "+obj.status+" and a status text of: "+obj.statusText+" and onFailure function= "+onFailureCallbackfunction+" and onSuccess function= "+onSuccessCallbackfunction+". Object Dump: "+dumpText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);onFailureCallbackfunction(myError);}}}}
currentXHR=obj;return obj;}}
function Question()
{var _questionId;var _questionHtml;var _hintHtml;var _explanationHtml;var _questionCategoryType;var _questionTitle;var _correctAnswer;var _passageId;this.setQuestionId=function(id)
{if(!GlobalVariables.validateQuestionId(id))
{var myError=new InvalidValueError("Attempted to set question id Question.setQuestionId() to: "+id);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionId=id;}
this.getQuestionId=function()
{return _questionId;}
this.setQuestionHtml=function(html)
{_questionHtml=html;}
this.getQuestionHtml=function()
{return _questionHtml;}
this.setHintHtml=function(html)
{_hintHtml=html;}
this.getHintHtml=function()
{return _hintHtml;}
this.setExplanationHtml=function(inputExplanationHtml)
{_explanationHtml=inputExplanationHtml;}
this.getExplanationHtml=function()
{return _explanationHtml;}
this.setQuestionCategoryType=function(questionType)
{if(!GlobalVariables.validateQuestionContentCategory(questionType))
{var myError=new InvalidValueError("Attempted to set question content category type in Question.setQuestionCategoryType() to: "+questionType+" with question id: "+this.getQuestionId());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionCategoryType=questionType;}
this.getQuestionCategoryType=function()
{return _questionCategoryType;}
this.setPassageId=function(passageId)
{_passageId=passageId;}
this.getPassageId=function()
{return _passageId;}
this.setQuestionTitle=function(inputQuestionTitle)
{_questionTitle=inputQuestionTitle;}
this.getQuestionTitle=function()
{return _questionTitle;}
this.setHintHtml=function(inputHintHtml)
{_hintHtml=inputHintHtml;}
this.getHintHtml=function()
{return _hintHtml;}
this.setCorrectAnswer=function(inputCorrectAnswer)
{if(!GlobalVariables.validateQuestionAnswer(inputCorrectAnswer))
{var myError=new InvalidValueError("Attempted to set question correct answer in Question.setCorrectAnswer() to: "+inputCorrectAnswer+" with question id: "+this.getQuestionId());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_correctAnswer=inputCorrectAnswer;}
this.getCorrectAnswer=function()
{return _correctAnswer;}}
function Passage()
{var _passageHtml;var _passageId;this.setPassageId=function(id)
{if(GlobalVariables.validateValueAsNumber(id))
{_passageId=id;}
else
{var myError=new InvalidValueError("Attempt to set passage id in Passage.setPassageId() failed with value: "+id);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}}
this.getPassageId=function()
{return _passageId;}
this.setPassageHtml=function(html)
{_passageHtml=html;}
this.getPassageHtml=function()
{return _passageHtml;}}
function AjaxQuestionInteraction(inputQuestionId)
{if(GlobalVariables.validateValueAsNumber(inputQuestionId)==false)
{var myError=new InvalidValueError("The constructor of AjaxQuestionInteraction received an invalid input of "+inputQuestionId);myError.setLevel(ERROR_TYPE_LOW);throw myError;}
var _this=this;var _questionId=inputQuestionId;var _questionContextId;var _timestamp;var _contextType;var _questionLoadTime;var _explanationLoadTime;var _millisecondsToShowAnswer;var _millisecondsToShowHint;var _millisecondsToShowExplanation;var _millisecondsAtQuestion;var _millisecondsToFinalAnswer;var _millisecondsExplanationWasViewed;var _selectedAnswer;var _isFinalized;var _isInDb;var _analyzable=null;this.beginQuestionTimer=function()
{_questionLoadTime=GlobalVariables.getCurrentUtcUnixTimestamp();}
this.getQuestionLoadTime=function()
{return _questionLoadTime;}
beginExplanationTimer=function()
{if(_explanationLoadTime==undefined||_explanationLoadTime==null)
{_explanationLoadTime=GlobalVariables.getCurrentUtcUnixTimestamp();}}
this.getIsFinalized=function()
{return _isFinalized;}
this.setIsFinalized=function(isFinalized)
{if(isFinalized!=true&&isFinalized!=false)
{var myError=new InvalidValueError("Attempted to call AjaxQuestionInteraction.setIsFinalized() by passing value "+isFinalized);myError.setLevel(ERROR_TYPE_LOW);throw myError;}
_isFinalized=isFinalized;}
this.getIsInDb=function()
{return _isInDb;}
this.setIsInDb=function(isInDb)
{if(isInDb!=true&&isInDb!=false)
{var myError=new InvalidValueError("Attempted to call AjaxQuestionInteraction.setIsInDb() by passing value "+isInDb);myError.setLevel(ERROR_TYPE_LOW);throw myError;}
_isInDb=isInDb;}
this.getSecondsToFinalAnswer=function()
{return(_millisecondsToFinalAnswer/1000);}
this.getMillisecondsToFinalAnswer=function()
{return _millisecondsToFinalAnswer;}
this.setMillisecondsToFinalAnswer=function(inputMs)
{if(GlobalVariables.validateValueAsNumber(inputMs)==false)
{var myError=new InvalidValueError("Attempted to call AjaxQuestionInteraction.setMillisecondsToFinalAnswer() by passing value "+inputMs);myError.setLevel(ERROR_TYPE_LOW);throw myError;}
_millisecondsToFinalAnswer=inputMs;}
this.getSecondsToShowAnswer=function()
{return(_millisecondsToShowAnswer/1000);}
this.getSecondsOnQuestion=function()
{return(_millisecondsAtQuestion/1000);}
this.getTimestamp=function()
{return _timestamp;}
this.setTimestamp=function(intTime)
{if(GlobalVariables.validateValueAsNumber(intTime)==false)
{var myError=new InvalidValueError("Attempted to call AjaxQuestionInteraction.setIsInDb() by passing value "+intTime);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_timestamp=intTime;}
this.getSelectedAnswer=function()
{return _selectedAnswer;}
this.setSelectedAnswer=function(ans)
{if(!GlobalVariables.validateQuestionAnswer(ans))
{var myError=new InvalidValueError("Attempted to set question correct answer in Question.setCorrectAnswer() to: "+ans+" with question id: "+this.getQuestionId()+" and question context id of "+this.getQuestionContextId());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_selectedAnswer=ans;}
this.setQuestionContextId=function(inputQuestionContextId)
{if(GlobalVariables.validateValueAsNumber(inputQuestionContextId)==false)
{var myError=new InvalidValueError("AjaxQuestionInteraction.setQuestionContextId() received an invalid input of "+inputQuestionContextId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionContextId=inputQuestionContextId;}
this.getQuestionContextId=function()
{return _questionContextId;}
this.setQuestionId=function(inputQuestionId)
{if(GlobalVariables.validateValueAsNumber(inputQuestionId)==false)
{var myError=new InvalidValueError("AjaxQuestionInteraction.setQuestionId() received an invalid input of "+inputQuestionId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionId=inputQuestionId;}
this.getQuestionId=function()
{return _questionId;}
this.setContextType=function(type)
{if(GlobalVariables.validateQuestionContextType(type)==false)
{var myError=new InvalidValueError("AjaxQuestionInteraction.setContextType() received an invalid input of "+type);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_contextType=type;}
this.getContextType=function()
{return _contextType;}
this.questionJustCompleted=function(inputSelectedAnswer)
{var currentTime=GlobalVariables.getCurrentUtcUnixTimestamp();if(_millisecondsAtQuestion==undefined||_millisecondsAtQuestion==null)
{_millisecondsAtQuestion=(currentTime-_questionLoadTime)*1000;}
if(_millisecondsToFinalAnswer==undefined||_millisecondsToFinalAnswer==null)
{_millisecondsToFinalAnswer=(currentTime-_questionLoadTime)*1000;}
_selectedAnswer=inputSelectedAnswer;_timestamp=GlobalVariables.getCurrentUtcUnixTimestamp();}
this.answerJustShown=function(inputSelectedAnswer)
{var currentTime=GlobalVariables.getCurrentUtcUnixTimestamp();if(_millisecondsToShowAnswer==undefined||_millisecondsToShowAnswer==null)
{_millisecondsToShowAnswer=(currentTime-_questionLoadTime)*1000;}
if(_millisecondsToFinalAnswer==undefined||_millisecondsToFinalAnswer==null)
{_millisecondsToFinalAnswer=(currentTime-_questionLoadTime)*1000;}
if(_selectedAnswer==null&&inputSelectedAnswer!=GlobalVariables.ANSWER_LEFT_BLANK)
{_analyzable=true;}
else
{_analyzable=false;}
_selectedAnswer=inputSelectedAnswer;}
this.explanationJustOpened=function(inputSelectedAnswer)
{var currentTime=GlobalVariables.getCurrentUtcUnixTimestamp();if(_millisecondsToShowExplanation==undefined||_millisecondsToShowExplanation==null)
{_millisecondsToShowExplanation=(currentTime-_questionLoadTime)*1000;beginExplanationTimer();}
if(_millisecondsToFinalAnswer==undefined||_millisecondsToFinalAnswer==null)
{_millisecondsToFinalAnswer=(currentTime-_questionLoadTime)*1000;}
if(_selectedAnswer==null&&inputSelectedAnswer!=GlobalVariables.ANSWER_LEFT_BLANK)
{_analyzable=true;}
else
{_analyzable=false;}
_selectedAnswer=inputSelectedAnswer;}
this.hintJustOpened=function()
{if(_millisecondsToShowHint==undefined||_millisecondsToShowHint==null)
{var currentTime=GlobalVariables.getCurrentUtcUnixTimestamp();_millisecondsToShowHint=(currentTime-_questionLoadTime)*1000;}}
this.explanationClosedPermanently=function()
{if(_explanationLoadTime!=undefined&&_explanationLoadTime!=null)
{var currentTime=GlobalVariables.getCurrentUtcUnixTimestamp();_millisecondsExplanationWasViewed=(currentTime-_explanationLoadTime)*1000;}}
receiveCaughtAQIError=function(e)
{if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED+" Consequently, the results of the question you just attempted were not saved.");}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED+" Consequently, the results of the question you just attempted were not saved.");}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_QUESTION_INTERACTION);ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxQuestionInteraction.insertIntoDb()");}}
this.insertIntoDb=function(callbackUponSuccess)
{try
{_this.setIsFinalized(true);var url="insertAjaxQuestionInteractionIntoDb?";if(_questionId!=null&&_questionId!=undefined)
{url+="question_id="+_questionId;}
else
{var myError=new RequiredFieldMissing("Question ID not specified when attempting to insert question interaction into DB");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(_questionContextId!=null&&_questionContextId!=undefined)
{url+="&question_context_id="+_questionContextId;}
else
{var myError=new RequiredFieldMissing("Question Context ID not specified when attempting to insert question interaction into DB");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(_millisecondsToShowAnswer!=null&&_millisecondsToShowAnswer!=undefined&&_selectedAnswer!=GlobalVariables.ANSWER_LEFT_BLANK)
{url+="&time_to_show_answer="+_millisecondsToShowAnswer;}
if(_contextType!=null&&_contextType!=undefined)
{url+="&question_context_type="+_contextType;}
else
{ErrorLogger.logWarning("No question context type specified when attempting to insert question interaction into database.");}
if(_millisecondsToFinalAnswer!=null&&_millisecondsToFinalAnswer!=undefined)
{url+="&time_to_final_answer="+_millisecondsToFinalAnswer;}
else
{var myError=new RequiredFieldMissing("Time to Final Answer not specified when attempting to insert question interaction into DB");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
if(_selectedAnswer!=null&&_selectedAnswer!=undefined&&_selectedAnswer!=GlobalVariables.ANSWER_LEFT_BLANK)
{url+="&selected_answer="+_selectedAnswer;}
if(_millisecondsToShowExplanation!=null&&_millisecondsToShowExplanation!=undefined)
{url+="&time_to_show_explanation="+_millisecondsToShowExplanation;}
if(_millisecondsToShowHint!=null&&_millisecondsToShowHint!=undefined)
{url+="&time_to_show_hint="+_millisecondsToShowHint;}
if(_millisecondsExplanationWasViewed!=null&&_millisecondsExplanationWasViewed!=undefined)
{url+="&time_spent_viewing_explanation="+_millisecondsExplanationWasViewed;}
if(_timestamp!=null&&_timestamp!=undefined)
{url+="&timestamp="+_timestamp;}
if(_millisecondsAtQuestion!=null&&_millisecondsAtQuestion!=undefined)
{url+="&time_spent_at_question="+_millisecondsAtQuestion;}
if(_analyzable!=null&&_analyzable!=undefined&&_analyzable==true)
{url+="&analyzable=1";}
receiveAjaxResponse=function(xmlDoc)
{if(xmlDoc==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{_this.setIsInDb(true);if(typeof callbackUponSuccess=='function'&&callbackUponSuccess!=undefined&&callbackUponSuccess!=null)
{callbackUponSuccess();}}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_QUESTION_INTERACTION);ErrorLogger.logError("Error occurred in saving Ajax Question Interaction to server. Server response text: "+xmlDoc);}}
myAjaxCore=new AjaxCore();myAjaxCore.setOnReadySuccessCallbackfunction(receiveAjaxResponse);myAjaxCore.setOnFailureCallbackfunction(receiveCaughtAQIError);myAjaxCore.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+url);myAjaxCore.getOpenXHR().send(null);}
catch(e)
{receiveCaughtAQIError(e);}
delete url;}}
function QuestionList(inputQuestionListId)
{if(GlobalVariables.validateValueAsNumber(inputQuestionListId))
{var _questionListId=inputQuestionListId;}
else
{var myError=new InvalidValueError("Question List ID not valid: "+inputQuestionListId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
var _questionListContents=new Array();var _title;var _listType;var _catSubSection;var _creator;var _createdTimestamp;var _maxQuestionCount;var _currentQuestionId;var _adminCreated;var _whetherQuestionsFullyDownloaded=false;this.loadQuestionListContentsFromArray=function(arr)
{if(arr instanceof Array==false)
{var myError=new InvalidValueError("Invalid input value supplied in QuestionList.loadQuestionListContentsFromArray(): "+arr.toString());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
else
{for(var i=0;i<arr.length;i++)
{_questionListContents.push(arr[i]);}}}
this.getQuestionListContents=function()
{return _questionListContents;}
this.setListType=function(type)
{if(GlobalVariables.validateQuestionContextType(type))
{_contextType=type;}
else
{var myError=new InvalidValueError("Invalid input value supplied in QuestionList.setListType(): "+type);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getListType=function()
{return _listType;}
this.getQuestionListId=function()
{return _questionListId;}
this.setWhetherQuestionsFullyDownloaded=function(inputVal)
{_whetherQuestionsFullyDownloaded=inputVal;}
this.getWhetherQuestionsFullyDownloaded=function()
{return _whetherQuestionsFullyDownloaded;}
this.setCatSubSection=function(section)
{if(GlobalVariables.validateCatSubsection(section))
{_catSubSection=section;}
else
{var myError=new InvalidValueError("Invalid input value supplied in QuestionList.setCatSubSection(): "+section);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getCatSubSection=function()
{return _catSubSection;}
this.setMaximumQuestionCount=function(count)
{_maxQuestionCount=count;}
this.getMaximumQuestionCount=function()
{if(_maxQuestionCount>_questionListContents.length)
{return _maxQuestionCount;}
else
{return _questionListContents.length;}}
this.setCurrentQuestionId=function(qId)
{if(GlobalVariables.validateQuestionId(qId))
{_currentQuestionId=qId;}}
this.getCurrentQuestionId=function()
{return _currentQuestionId;}
this.setAdminCreated=function(status)
{_adminCreated=status;}
this.getAdminCreated=function()
{return _adminCreated;}
this.getQuestionListTitle=function()
{return _title;}
this.setQuestionListTitle=function(inputTitle)
{_title=inputTitle;}
this.setQuestionListCreator=function(inputCreator)
{_creator=inputCreator;}
this.getQuestionListCreator=function()
{return _creator;}
this.setQuestionListCreatedTimestamp=function(inputTime)
{if(GlobalVariables.validateValueAsNumber(inputTime)==false)
{var myError=new InvalidValueError("Invalid input value supplied in QuestionList.setQuestionListCreatedTimestamp(): "+inputTime);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_createdTimestamp=inputTime;}
this.getQuestionListCreatedTimestamp=function()
{return _createdTimestamp;}
this.getCurrentQuestionNumber=function()
{for(var i=0;i<_questionListContents.length;i++)
{if(_questionListContents[i]==_currentQuestionId)
{return[i+1];}}}
this.getAbsoluteNextQuestionId=function()
{if(_currentQuestionId!=undefined||_currentQuestionId!=null)
{return this.getRelativeNextQuestionId(_currentQuestionId);}
else
{return this.getRelativeNextQuestionId(this.getFirstQuestionId());}}
this.getAbsoluteNextCatQuestionId=function(questionContextId,callbackFunction,callbackErrorFunction)
{if(_questionListContents.length>=this.getMaximumQuestionCount())
{callbackFunction(GlobalVariables.END_OF_QUESTION_LIST);}
nextCatQuestionIdReceived=function(qId)
{_questionListContents.push(qId);if(callbackFunction!=undefined&&callbackFunction!=null)
{callbackFunction(qId);}}
var requestUrl="getAbsoluteNextCatQuestionId?catSubsection="+this.getCatSubSection()+"&qcId="+questionContextId;var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(nextCatQuestionIdReceived);if(typeof callbackErrorFunction=='function')
{myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(callbackErrorFunction);}
myAjaxCoreQuestionContextRequest.createXHR().open("GET",requestUrl);myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);}
this.getRelativeNextQuestionId=function(questionId)
{for(var i=0;i<_questionListContents.length;i++)
{if(_questionListContents[i]==questionId)
{if(_questionListContents[i+1]!=undefined&&_questionListContents[i+1]!=null)
{return _questionListContents[i+1];}
else
{return GlobalVariables.END_OF_QUESTION_LIST;}}}
var myError=new TraverseQuestionListError("In QuestionList.getRelativeNextQuestionId(), could not find question after question id "+questionId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
this.getAbsolutePreviousQuestionId=function()
{if(_currentQuestionId!=undefined&&_currentQuestionId!=null)
{return this.getRelativePreviousQuestionId(_currentQuestionId);}
else
{return this.getRelativePreviousQuestionId(this.getFirstQuestionId());}}
this.getRelativePreviousQuestionId=function(questionId)
{for(var i=0;i<_questionListContents.length;i++)
{if(_questionListContents[i]==questionId)
{if(_questionListContents[i-1]!=undefined&&_questionListContents[i-1]!=null)
{return _questionListContents[i-1];}
else
{return GlobalVariables.END_OF_QUESTION_LIST;}}}
var myError=new TraverseQuestionListError("In QuestionList.getRelativePreviousQuestionId(), could not find question before question id "+questionId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
this.getFirstQuestionId=function()
{if(_questionListContents[0]==null||_questionListContents[0]==undefined)
{var myError=new TraverseQuestionListError("In QuestionList.getFirstQuestionId(), no first question existed in array of question ids.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
else
{return _questionListContents[0];}}}
function QuestionMetaData()
{var _questionId;var _questionCategoryType;var _questionTitle;var _correctAnswer;var _questionDifficulty;this.setQuestionCategoryType=function(inputCategory)
{if(!GlobalVariables.validateQuestionContentCategory(inputCategory))
{var myError=new InvalidValueError("Attempted to set question content category type in QuestionMetaData.setQuestionCategoryType() to: "+inputCategory+" with question id: "+this.getQuestionId());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionCategoryType=inputCategory;}
this.getQuestionCategoryType=function()
{return _questionCategoryType;}
this.setQuestionId=function(inputQuestionId)
{if(!GlobalVariables.validateQuestionId(inputQuestionId))
{var myError=new InvalidValueError("Attempted to set question id QuestionMetaData.setQuestionId() to: "+inputQuestionId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_questionId=inputQuestionId;}
this.getQuestionId=function()
{return _questionId;}
this.setQuestionTitle=function(title)
{_questionTitle=title;}
this.getQuestionTitle=function()
{return _questionTitle;}
this.setCorrectAnswer=function(inputAnswer)
{if(!GlobalVariables.validateQuestionAnswer(inputAnswer))
{var myError=new InvalidValueError("Attempted to set question correct answer in QuestionMetaData.setCorrectAnswer() to: "+inputAnswer+" with question id: "+this.getQuestionId());myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
_correctAnswer=inputAnswer;}
this.getCorrectAnswer=function()
{return _correctAnswer;}
this.setQuestionDifficulty=function(input)
{_questionDifficulty=input;}
this.getQuestionDifficulty=function()
{return _questionDifficulty;}}
function QuestionContext(inputContextId)
{if(GlobalVariables.validateValueAsNumber(inputContextId))
{var _questionContextId=inputContextId;}
else
{var myError=new InvalidValueError("Question Context ID not valid: "+inputContextId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
var _questionListIds=new Array();var _currentQuestionListId;var _questionContextTitle;var _questionContextCreatedDate=GlobalVariables.getCurrentUtcUnixTimestamp();var _questionContextPermissions;var _questionContextType;var _savingInformationDump;var _questionInteractionsFullyDownloaded=false;var _authorization;var _additionalInformation;var _currentPracticeTestState;this.getWhetherQuestionInteractionsFullyDownloaded=function()
{return _questionInteractionsFullyDownloaded;}
this.setWhetherQuestionInteractionsFullyDownloaded=function(inputVal)
{_questionInteractionsFullyDownloaded=inputVal;}
this.getQuestionContextId=function()
{return _questionContextId;}
this.getQuestionContextTitle=function()
{return _questionContextTitle;}
this.setQuestionContextTitle=function(inputTitle)
{_questionContextTitle=inputTitle;}
this.setCurrentPracticeTestState=function(inputState)
{_currentPracticeTestState=inputState;}
this.getCurrentPracticeTestState=function()
{return _currentPracticeTestState;}
this.setCreatedTimestamp=function(time)
{if(GlobalVariables.validateValueAsNumber(time))
{_questionContextCreatedDate=time;}
else
{var myError=new InvalidValueError("Invalid input value in QuestionContext.setCreatedTimestamp() :"+time);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.setAdditionalInformation=function(inputVal)
{_additionalInformation=inputVal;}
this.getAdditionalInformation=function()
{return _additionalInformation;}
this.getCreatedTimestamp=function()
{return _questionContextCreatedDate;}
this.setPermissions=function(inputPer)
{if(GlobalVariables.validatePermissions(inputPer))
{_questionContextPermissions=inputPer;}
else
{var myError=new InvalidValueError("Invalid input value in QuestionContext.setPermissions() :"+inputPer);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getPermissions=function()
{return _questionContextPermissions;}
this.setAuthorization=function(inputAuth)
{if(GlobalVariables.validateAuthorization(inputAuth))
{_authorization=inputAuth;}
else
{var myError=new InvalidValueError("Invalid input value in QuestionContext.setAuthorization() :"+inputAuth);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getAuthorization=function()
{return _authorization;}
this.setQuestionContextType=function(type)
{if(GlobalVariables.validateQuestionContextType(type))
{_questionContextType=type;}
else
{var myError=new InvalidValueError("Invalid input value supplied in QuestionContext.setQuestionContextType(): "+type);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getQuestionContextType=function()
{return _questionContextType;}
this.addQuestionListId=function(listId)
{if(GlobalVariables.validateValueAsNumber(listId))
{_questionListIds[_questionListIds.length]=listId;}
else
{var myError=new InvalidValueError("Invalid input value in QuestionContext.addQuestionListId() :"+listId);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getQuestionListIds=function()
{return _questionListIds;}
this.setCurrentQuestionListId=function(id)
{if(GlobalVariables.validateValueAsNumber(id))
{_currentQuestionListId=id;}
else
{var myError=new InvalidValueError("Invalid input value in QuestionContext.setCurrentQuestionListId() :"+id);myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}}
this.getCurrentQuestionListId=function()
{return _currentQuestionListId;}
this.getCurrentQuestionList=function()
{return QuestionListRepositoryManager.getListById(this.getCurrentQuestionListId());}}
var ErrorLogger={ERROR_TYPE_WARNING:0,ERROR_TYPE_LOW:1,ERROR_TYPE_SEVERE:2,ERROR_TYPE_FATAL:3,ERROR_TEXT_CANNOT_DOWNLOAD_MARKED_QUESTIONS:"We encountered a technical glitch in connecting to the server and downloading data from it. As a result, the Star Question functionality may not work properly. We apologize for any inconvenience.",ERROR_TEXT_CANNOT_SAVE_MARKED_QUESTION_CHANGE:"We encountered a technical glitch in connecting to the server and saving the change you made. We apologize for any inconvenience.",ERROR_TEXT_CANNOT_SAVE_QUESTION_INTERACTION:"We encountered a technical glitch in your Internet connection in contacting the server and saving the question you just worked. Please try to save the question again by clicking \"Next\". If this fails, please manually refresh the page and reload your current question by navigating to from My History.",ERROR_TEXT_COOKIES_NOT_SUPPORTED:"It appears that you do not have cookies enabled on your internet browser. Without cookies, some of the features of this website will not work properly.",ERROR_TEXT_AJAX_UNSUPPORTED:"It appears that your internet browser do not support the features necessary to fully utilize this website. Feel free to continue browswing, but know that the website may not function properly.",ERROR_TEXT_CONNECTION_FATALLY_LOST:"It appears that the connection between your browser and the server is lost.",ERROR_TEXT_CANNOT_LOAD_QUESTION_QCSQV:"We encountered a technical glitch in connecting to the server and downloading the question you requested. Please refresh the page the try again. If this problem persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL:"An error occurred in connecting to the server and loading list of questions you requested. Please refresh the page. If the problem persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_MHQCL:"An error occurred in connecting to the server and loading \"My History\". Please refresh the page. If the problem persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT:"An error occurred in connecting to the server and loading the new test. We apologize for this error. If this error persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_NEW_QUIZ_QCCN:"An error occurred in connecting to the server and loading the new quiz. We apologize for this error. If this error persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_FAQ:"An error occurred in connecting to the server and loading the Help &amp; FAQ page. We apologize for this error. If this error persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_QUESTION_QCNTPV:"We encountered a technical glitch in connecting to the server and downloading the practice test you requested. Please refresh the page the try again. If this problem persists, please contact us.",ERROR_TEXT_CANNOT_SAVE_ESSAY:"An error occurred in connecting to the server and saving your essay. Please try again shortly. If this error persists, please contact us.",ERROR_TEXT_CANNOT_LOAD_QCCN_COMPLETED:"An error occurred in connecting to the server and displaying your test results. Please try again shortly. If this error persists, please contact us.",ERROR_TEXT_NO_QUESTION_ANSWER_SELECTED:"You must select an answer in order to proceed.",errorCount:0,getAdditionalDataDump:function()
{var additionalDump='';additionalDump=' BEGIN ADDITIONAL DUMP: current gui state = :'+myAjaxSessionGuiDriver._currentState+";";if(typeof myQuestionContextProblemListViewGuiDriver=='undefined')
{additionalDump+='question context problem list view has not been instantiated;';}
else
{additionalDump+='question context context id: '+myQuestionContextProblemListViewGuiDriver.getQuestionContextId()+";";}
if(document.getElementById("time-counter-field")==undefined||document.getElementById("time-counter-field")==null)
{additionalDump+='current sqv time counter html does not exist in DOM;';}
else
{additionalDump+='current sqv time counter html: '+myQcSqvDriver.getTimeCounterHtml()+";";}
additionalDump+='current sqv question context id: '+myQcSqvDriver.getQuestionContextId()+";";if(QuestionContextRepositoryManager.doesQuestionContextExist(myQcSqvDriver.getQuestionContextId()))
{additionalDump+='current sqv current question id: '+myQcSqvDriver.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+";";}
additionalDump+='sqv quiz time interval: '+myQcSqvDriver.getTimeCountAutoUpdateReference()+";";return additionalDump;},logCaughtError:function(e,msg,dump)
{ErrorLogger.errorCount++;if(dump==undefined||dump==null)
{var finalDump='';}
else
{var finalDump=dump;}
var finalMessage='';if(typeof e.getName==='function')
{finalMessage+='Error Type: '+e.getName();}
if(typeof e.getMessage==='function')
{finalMessage+='Message: '+e.getMessage();}
if(e.message!=undefined&&typeof e.message.toString==='function')
{finalMessage+='Message: '+e.message.toString();}
if(e.errorType!=undefined&&e.errorType!=null)
{finalMessage+=e.errorType;}
if(msg==undefined||msg==null)
{finalMessage+='Input Message: '+msg;}
try
{ErrorLogger.sendFinalizedErrorStringToServer(e.name+" - Caught Error",finalMessage,"Dump: "+finalDump+ErrorLogger.getAdditionalDataDump());}
catch(e)
{}},logWarning:function(msg)
{},logError:function(msg)
{ErrorLogger.errorCount++;try
{var recordMsg=msg;recordMsg+=ErrorLogger.getAdditionalDataDump();ErrorLogger.sendFinalizedErrorStringToServer("LogError",recordMsg);}
catch(e)
{}},logUncaughtError:function(msg,url,line)
{try
{ErrorLogger.errorCount++;ErrorLogger.sendFinalizedErrorStringToServer("UncaughtError",msg,"Occurred on line "+line+" with URL "+url+ErrorLogger.getAdditionalDataDump());}
catch(e)
{}},sendFinalizedErrorStringToServer:function(eType,finalInputMessage,dump)
{try
{var myAjaxSocket=AJAX.createHttpRequest();var msgFinal=new String(finalInputMessage);if(myAjaxSocket!=null)
{myAjaxSocket.onreadystatechange=function(){}
var errorUrl=AJAX.getAbsoluteRootPath();errorUrl+="ajax/recordJavascriptError?type=";errorUrl+=eType+"&dump="+dump+"&count="+ErrorLogger.errorCount;errorUrl+="&message="+msgFinal;errorUrl+="&appName="+navigator.appName+"&appVersion="+navigator.appVersion+"&userAgent="+navigator.userAgent;myAjaxSocket.open("GET",errorUrl);myAjaxSocket.send(null);}}
catch(e)
{}}};window.onerror=ErrorLogger.logUncaughtError;function InvalidValueError(message)
{this.message=message;var _name="InvalidValueError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
InvalidValueError.prototype=new Error();function RequestedObjectDNEError(message)
{this.message=message;var _name="RequestedObjectDNEError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
RequestedObjectDNEError.prototype=new Error();function RequiredFieldMissing(message)
{this.message=message;var _name="RequiredFieldMissing";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
RequiredFieldMissing.prototype=new Error();function NoContentFound(message)
{this.message=message;var _name="NoContentFound";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
NoContentFound.prototype=new Error();function CookiesNotEnabled(message)
{this.message=message;var _name="CookiesNotEnabled";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
CookiesNotEnabled.prototype=new Error();function RequiredGuiObjectDNE(message)
{this.message=message;var _name="RequiredGuiObjectDNE";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
RequiredGuiObjectDNE.prototype=new Error();function TraverseQuestionListError(message)
{this.message=message;var _name="TraverseQuestionListError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
TraverseQuestionListError.prototype=new Error();function XmlParserDocumentError(message)
{this.message=message;var _name="XmlParserDocumentError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
XmlParserDocumentError.prototype=new Error();function AjaxUnsupportedError(message)
{this.message=message;var _name="AjaxUnsupportedError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return this.message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
AjaxUnsupportedError.prototype=new Error();function AjaxServerError(message)
{var _message=message;var _name="AjaxServerError";var _level;this.getName=function()
{return _name;}
this.getMessage=function()
{return _message;}
this.setLevel=function(input)
{_level=input;}
this.getLevel=function()
{return _level;}}
AjaxServerError.prototype=new Error();function AjaxQuestionContextSqvGuiDriver()
{var _this=this;var _currentlyProcessingChangeQuestionRequest=false;var _questionContextId;var _timeCountAutoUpdateReference;this.focusToQuestion=function(inputQuestionContextId,inputQuestionListId,inputQuestionId)
{handleCaughtFtQError=function(e)
{if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxQuestionContextSqvGuiDriver.focusToQuestion(); questionContextId = '+inputQuestionContextId+' and questionListId = '+inputQuestionListId+' and questionId = '+inputQuestionId);StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_QCSQV);}}
var questionContextId=inputQuestionContextId;var questionListId=inputQuestionListId;var questionId=inputQuestionId;questionLoaded=function()
{if(QuestionRepositoryManager.doesQuestionExist(questionId)==false)
{handleCaughtFtQError(new NoContentFound("Could not load Question"));}
QuestionContextRepositoryManager.getQuestionContextById(questionContextId).setCurrentQuestionListId(questionListId);window.clearInterval(_timeCountAutoUpdateReference);if(_this.getQuestionContext().getQuestionContextType()!=GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{myAjaxPracticeTestDriver.disableEntireTestClockUpdateReferences();_timeCountAutoUpdateReference=window.setInterval(_this.autoUpdateTimeCountField,1000);}
else if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()==GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{myAjaxPracticeTestDriver.disableEntireTestClockUpdateReferences();}
_this.handleQuestionChangeRequest(questionId);}
questionListLoaded=function()
{try
{if(QuestionContextRepositoryManager.doesQuestionContextExist(questionContextId)==false)
{var myError=new NoContentFound("Could not load Question Context");throw myError;}
if(QuestionListRepositoryManager.doesListExist(questionListId)==false)
{var myError=new NoContentFound("Could not load Question List");throw myError;}
var myQuestionGrabber=new QuestionGrabber(questionId);myQuestionGrabber.setCallbackUponSuccess(questionLoaded);myQuestionGrabber.setCallbackUponFailure(handleCaughtFtQError);myQuestionGrabber.loadQuestion();}
catch(e)
{handleCaughtFtQError(e);}}
questionContextLoaded=function()
{_this.setQuestionContextId(questionContextId);var myQlGrabber=new QuestionListGrabber();myQlGrabber.setSearchMode(myQlGrabber.searchModeById);myQlGrabber.setSearchIds(questionListId);myQlGrabber.setCallbackUponSuccess(questionListLoaded);myQlGrabber.setCallbackUponFailure(handleCaughtFtQError);myQlGrabber.loadQuestionList();}
var myQcGrabber=new QuestionContextGrabber();myQcGrabber.setCallbackUponSuccess(questionContextLoaded);myQcGrabber.setCallbackUponFailure(handleCaughtFtQError);myQcGrabber.setSearchMode(myQcGrabber.searchModeById);myQcGrabber.setSearchIds(questionContextId);myQcGrabber.query();}
this.userGuiDisplayPreferences=new Array();this.userGuiDisplayPreferences["showExplanationUponLoadingNewQuestion"]=false;this.userGuiDisplayPreferences["showCorrectAnswerUponLoadingNewQuestion"]=false;this.userGuiDisplayPreferences["showAnswerHintButtonWhenAvaiable"]=true;this.userGuiDisplayPreferences["showAnswerHintContentsUponLoadingNewQuestion"]=false;this.currentGuiDisplayProperties=new Array();this.currentGuiDisplayProperties["isCorrectAnswerShowing"]=false;this.currentGuiDisplayProperties["isAnswerExplanationShowing"]=false;this.currentGuiDisplayProperties["isMessageNotificationShowing"]=true;this.currentGuiDisplayProperties["isNextQuestionButtonShowing"]=true;this.currentGuiDisplayProperties["isPreviousQuestionButtonShowing"]=true;this.currentGuiDisplayProperties["isQuestionHintButtonShowing"]=true;this.currentGuiDisplayProperties["isQuestionHintContentsShowing"]=false;this.currentGuiDisplayProperties["isQuestionCountShowing"]=true;this.setQuestionContextId=function(inputContextId)
{_this._questionContextId=inputContextId;}
this.getQuestionContextId=function()
{return _this._questionContextId;}
this.getQuestionContext=function()
{return QuestionContextRepositoryManager.getQuestionContextById(this.getQuestionContextId());}
this.setQuestionContentsHtml=function(html)
{if(document.getElementById("ajaxq-question-contents")!=null&&document.getElementById("ajaxq-question-contents")!=undefined)
{document.getElementById("ajaxq-question-contents").innerHTML=html;}
else
{ErrorLogger.logError("Required GUI Object, ajaxq-question-contents, did not exist in DOM. Occurred in setQuestionContentsHtml(); HTML = "+html);}}
this.setExplanationContentsHtml=function(html)
{if(document.getElementById("ajaxq-explanation-contents")!=null&&document.getElementById("ajaxq-explanation-contents")!=undefined)
{var expQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(document.getElementById("paid-question-id-"+expQuestionId)!=undefined&&document.getElementById("paid-question-id-"+expQuestionId)!=null)
{Feedback.init("paid_question_explanation",expQuestionId,"How helpful was this explanation?","helpful");Feedback._setShowReportContentError("paid_question_explanation",expQuestionId,true);Feedback._setShowReportTypo("paid_question_explanation",expQuestionId,true);var domFeedbackHtml=Feedback.getPrintHtml("paid_question_explanation",expQuestionId);document.getElementById("ajaxq-explanation-contents").innerHTML=html+domFeedbackHtml;}
else
{Feedback.init("ajax_question_explanation",expQuestionId,"How helpful was this explanation?","helpful");Feedback._setShowReportContentError("ajax_question_explanation",expQuestionId,true);Feedback._setShowReportTypo("ajax_question_explanation",expQuestionId,true);var domFeedbackHtml=Feedback.getPrintHtml("ajax_question_explanation",expQuestionId);document.getElementById("ajaxq-explanation-contents").innerHTML=html+domFeedbackHtml;}}
else
{ErrorLogger.logError("Required GUI Object, ajaxq-explanation-contents, did not exist in DOM. Occurred in setExplanationContentsHtml(); HTML = "+html);}}
this.getCurrentlySelectedAnswer=function()
{if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA")==undefined||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA")==null||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB")==undefined||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB")==null||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC")==undefined||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC")==null||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD")==undefined||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD")==null||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE")==undefined||document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE")==null)
{ErrorLogger.logError("Required GUI Object, q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansX, did not exist in DOM. Occurred in getCurrentlySelectedAnswer();");return false;}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA").checked===true)
{return"A";}
else if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB").checked===true)
{return"B";}
else if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC").checked===true)
{return"C";}
else if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD").checked===true)
{return"D";}
else if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE").checked===true)
{return"E";}
else
{return GlobalVariables.ANSWER_LEFT_BLANK;}}
this.instantiateAjaxQuestionInteractionUponNewQuestionLoading=function()
{var currentQuestionContextId=_this.getQuestionContextId();var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionType=QuestionRepositoryManager.getQuestionById(currentQuestionId).getQuestionCategoryType();if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,currentQuestionContextId)!=true&&currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{var myNewAjaxInteraction=new AjaxQuestionInteraction(currentQuestionId);myNewAjaxInteraction.setQuestionContextId(currentQuestionContextId);myNewAjaxInteraction.setContextType(currentQuestionContext.getQuestionContextType());myNewAjaxInteraction.beginQuestionTimer();AjaxQuestionInteractionRepositoryManager.addInteraction(myNewAjaxInteraction);}}
this.updateAjaxQuestionIneractionUponExplanationOpened=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);if(currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true)
{currentAjaxQuestionInteraction.explanationJustOpened(this.getCurrentlySelectedAnswer());}}}
this.updateAjaxQuestionIneractionUponAnswerJustShown=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);if(currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER&&AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,currentQuestionContextId))
{var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true&&currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{currentAjaxQuestionInteraction.answerJustShown(this.getCurrentlySelectedAnswer());}}}
this.finalizeAjaxQuestionInteractionUponClosingQuestion=function(callbackUponSuccess)
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);var selectedAnswer=this.getCurrentlySelectedAnswer();if(currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,currentQuestionContextId))
{var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true)
{currentAjaxQuestionInteraction.explanationClosedPermanently();currentAjaxQuestionInteraction.questionJustCompleted(selectedAnswer);if(currentAjaxQuestionInteraction.getSelectedAnswer()!=GlobalVariables.ANSWER_LEFT_BLANK)
{if(typeof interactionUpdatedSuccessfully=='function'&&interactionUpdatedSuccessfully!=undefined&&interactionUpdatedSuccessfully!=null)
{currentAjaxQuestionInteraction.insertIntoDb(callbackUponSuccess);}
else
{currentAjaxQuestionInteraction.insertIntoDb();}}
else if(currentAjaxQuestionInteraction.getIsFinalized()!=true)
{_this.removeMostRecentAjaxQuestionInteractionFromCache();callbackUponSuccess();}}}
else
{ErrorLogger.logError("No Question Interaction exists when it should. Current Question Id: "+currentQuestionId+" and current Question Context ID: "+currentQuestionContextId);}}}
this.removeMostRecentAjaxQuestionInteractionFromCache=function()
{var currentQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();AjaxQuestionInteractionRepositoryManager.removeInteraction(currentQuestionId,currentQuestionContextId);}
this.updateAjaxQuestionIneractionUponHintOpened=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);if(currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true&&currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{currentAjaxQuestionInteraction.hintJustOpened();}}}
this.setTimeCounterHtml=function(html)
{var displayHtml;if(document.getElementById("time-counter-field")!=null&&document.getElementById("time-counter-field")!=undefined)
{if(html==null||html==undefined||html.length==0)
{displayHtml='';}
else
{displayHtml=html+'&nbsp;&middot;&nbsp;';}
document.getElementById("time-counter-field").innerHTML=displayHtml;}}
this.getTimeCounterHtml=function()
{if(document.getElementById("time-counter-field")!=null&&document.getElementById("time-counter-field")!=undefined)
{return document.getElementById("time-counter-field").innerHTML;}}
this.getSecondsElapsedOnCurrentQuestion=function()
{var currentQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();var currentQuestionContextId=_this.getQuestionContextId();if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,currentQuestionContextId)&&QuestionContextRepositoryManager.doesQuestionContextExist(currentQuestionContextId))
{var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true&&currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER&&GlobalVariables.validateValueAsNumber(currentAjaxQuestionInteraction.getQuestionLoadTime()))
{var secondsElapsed=GlobalVariables.getCurrentUtcUnixTimestamp()-currentAjaxQuestionInteraction.getQuestionLoadTime();return secondsElapsed;}}}
this.getTimeCountAutoUpdateReference=function()
{return _timeCountAutoUpdateReference;}
this.autoUpdateTimeCountField=function()
{if(_this.getQuestionContext().getCurrentQuestionList()==undefined||_this.getQuestionContext().getCurrentQuestionList()==null)
{window.clearInterval(_timeCountAutoUpdateReference);return false;}
var currentQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(currentQuestionId==null||currentQuestionId==undefined)
{window.clearInterval(_timeCountAutoUpdateReference);return false;}
if(document.getElementById("ajaxq-question-view-list-button")==undefined||document.getElementById("ajaxq-question-view-list-button").className!="ajaxq-question-button-enabled")
{window.clearInterval(_timeCountAutoUpdateReference);return false;}
var currentQuestionContextId=_this.getQuestionContextId();if(QuestionContextRepositoryManager.doesQuestionContextExist(currentQuestionContextId)==false)
{return false;}
var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId);if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,currentQuestionContextId))
{var currentAjaxQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,currentQuestionContextId);if(currentAjaxQuestionInteraction.getIsFinalized()!=true&&currentQuestionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER&&currentQuestionContext.getQuestionContextType()==GlobalVariables.TYPE_STATIC_QUIZ&&GlobalVariables.validateValueAsNumber(currentAjaxQuestionInteraction.getQuestionLoadTime())&&currentAjaxQuestionInteraction.getMillisecondsToFinalAnswer()==undefined)
{var timeHtml=_this.getSecondsElapsedOnCurrentQuestion();_this.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(timeHtml));}}
else if(currentQuestionContext.getAuthorization()!=GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{_this.setTimeCounterHtml(null);}}
this.receiveRequestToReturnToQuestionContextProblemListView=function()
{myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcPl(_this.getQuestionContextId());}
this.setShowQuestionListButtonVisibility=function(visibility)
{if(document.getElementById("ajaxq-question-view-list-button")!=null&&document.getElementById("ajaxq-question-view-list-button")!=undefined)
{if(visibility==true)
{document.getElementById("ajaxq-question-view-list-button").className="ajaxq-question-button-enabled";}
else
{document.getElementById("ajaxq-question-view-list-button").className="ajaxq-element-disabled";}}
else
{}}
this.receiveMarkQuestionRequest=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{GlobalVariables.changeStarQuestionState(currentQuestionId,'question-star-active-cat','ajaxq-star-question-text-active-cat');}
else
{GlobalVariables.changeStarQuestionState(currentQuestionId,'question-star','ajaxq-star-question-text');}
this.updateMarkQuestionUponNewQuestion();}
this.handleMarkQuestionMouseOver=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{GlobalVariables.handleStarQuestionMouseOver(currentQuestionId,'question-star-active-cat','ajax-star-question-text-active-cat');}
else
{GlobalVariables.handleStarQuestionMouseOver(currentQuestionId,'question-star','ajax-star-question-text');}}
this.handleMarkQuestionMouseOut=function()
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{GlobalVariables.handleStarQuestionMouseOut(currentQuestionId,'question-star-active-cat','ajax-star-question-text-active-cat');}
else
{GlobalVariables.handleStarQuestionMouseOut(currentQuestionId,'question-star','ajax-star-question-text');}}
this.updateMarkQuestionUponNewQuestion=function()
{if((document.getElementById("question-star")==null||document.getElementById("question-star")==undefined)&&(document.getElementById("question-star-active-cat")==null||document.getElementById("question-star-active-cat")==undefined))
{ErrorLogger.logError("Unable to change Mark Question due to DOM ID of question-star not existing.");return false;}
if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{if(document.getElementById("question-star-active-cat").src.indexOf("/")==-1)
{var urlSplit=document.getElementById("question-star-active-cat").src.split("\\");}
else
{var urlSplit=document.getElementById("question-star-active-cat").src.split("/");}}
else
{if(document.getElementById("question-star").src.indexOf("/")==-1)
{var urlSplit=document.getElementById("question-star").src.split("\\");}
else
{var urlSplit=document.getElementById("question-star").src.split("/");}}
var imgUrl=urlSplit[urlSplit.length-1];var baseImgUrl="";for(var i=0;i<urlSplit.length-1;i++)
{baseImgUrl+=urlSplit[i]+"/";}
var currentQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(currentQuestionId)==true)
{if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{document.getElementById("question-star-active-cat").src=baseImgUrl+"star_on.gif";document.getElementById("ajaxq-star-question-text-active-cat").innerHTML="Remove&nbsp;Star";}
else
{document.getElementById("question-star").src=baseImgUrl+"star_on.gif";document.getElementById("ajaxq-star-question-text").innerHTML="Remove&nbsp;Star";}}
else
{if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{document.getElementById("question-star-active-cat").src=baseImgUrl+"star_off.gif";document.getElementById("ajaxq-star-question-text-active-cat").innerHTML="Star&nbsp;Question";}
else
{document.getElementById("question-star").src=baseImgUrl+"star_off.gif";document.getElementById("ajaxq-star-question-text").innerHTML="Star&nbsp;Question";}}}
this.setAnswerHintButtonContents=function(html)
{if(document.getElementById("ajaxq-show-hint-contents-a")!=undefined&&document.getElementById("ajaxq-show-hint-contents-a")!=null)
{document.getElementById("ajaxq-show-hint-contents-a").innerHTML=html;}
else
{ErrorLogger.logError("Unable to change Answer Hint button contents due to DOM ID of ajaxq-show-hint-contents-a not existing.");}}
this.setAnswerHintButtonVisibility=function(visibility)
{if(document.getElementById("ajaxq-show-hint-button-a")==null||document.getElementById("ajaxq-show-hint-button-a")==undefined)
{ErrorLogger.logError("Unable to change Answer Hint button visibility due to DOM ID of ajaxq-show-hint-button-a not existing.");return false;}
if(visibility==true)
{document.getElementById("ajaxq-show-hint-button-a").className="ajaxq-question-button-enabled";this.currentGuiDisplayProperties["isQuestionHintButtonShowing"]=true;}
else if(visibility==false)
{document.getElementById("ajaxq-show-hint-button-a").className="ajaxq-question-button-disabled";this.currentGuiDisplayProperties["isQuestionHintButtonShowing"]=false;}}
this.setAnswerHintContentsVisibility=function(visibility)
{if(document.getElementById("ajaxq-question-hint-contents-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=null&&document.getElementById("ajaxq-question-hint-contents-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=undefined)
{if(visibility==true)
{document.getElementById("ajaxq-question-hint-contents-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).className="ajaxq-hint-shown";this.currentGuiDisplayProperties["isQuestionHintContentsShowing"]=true;}
else
{document.getElementById("ajaxq-question-hint-contents-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).className="ajaxq-element-disabled";this.currentGuiDisplayProperties["isQuestionHintContentsShowing"]=false;}}
else
{}}
this.receiveShowAnswerHintButtonClicked=function()
{if(this.currentGuiDisplayProperties["isQuestionHintContentsShowing"]==false)
{if(QuestionRepositoryManager.doesQuestionExist(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())==false)
{ErrorLogger.logError("Unable to process Answer Hint Button clicked since Question ID "+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+" did not exist in local repository.");return false;}
var hintHtml=QuestionRepositoryManager.getQuestionById(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).getHintHtml();this.setAnswerHintButtonContents("Hide&nbsp;Hint");this.setAnswerHintContentsVisibility(true);this.updateAjaxQuestionIneractionUponHintOpened();}
else
{this.setAnswerHintButtonContents("Show&nbsp;Hint");this.setAnswerHintContentsVisibility(false);}}
this.receiveShowAnswerButtonClicked=function()
{this.updateAjaxQuestionIneractionUponAnswerJustShown();if(this.currentGuiDisplayProperties["isCorrectAnswerShowing"]==false)
{this.showCorrectAnswer();}
else
{this.hideCorrectAnswer();}}
this.changeShowAnswerButtonText=function(inputText)
{if(document.getElementById("ajaxq-show-answer-contents-a")!=null&&document.getElementById("ajaxq-show-answer-contents-a")!=undefined)
{document.getElementById("ajaxq-show-answer-contents-a").innerHTML=inputText;}
else
{ErrorLogger.logError("Unable to process change Show Answer Button text [function changeShowAnswerButtonText()] since DOM ID ajaxq-show-answer-contents-a did not exist.");}}
this.showCorrectAnswer=function()
{if(document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=null&&document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=undefined)
{document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).className="ajaxq-question-correct-answer";this.changeShowAnswerButtonText("Hide&nbsp;Answer");this.currentGuiDisplayProperties["isCorrectAnswerShowing"]=true;}
else
{ErrorLogger.logError("Unable to process Show Correct Answer since DOM ID ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+" did not exist.");}}
this.hideCorrectAnswer=function()
{if(document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=null&&document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId())!=undefined)
{document.getElementById("ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).className="ajaxq-question-answer";this.changeShowAnswerButtonText("Show&nbsp;Answer");this.currentGuiDisplayProperties["isCorrectAnswerShowing"]=false;}
else
{ErrorLogger.logError("Unable to process Hide Correct Answer since DOM ID ajaxq-question-correct-answer-"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+" did not exist.");}}
this.setShowAnswerButtonVisibility=function(visibility)
{if(document.getElementById("ajaxq-show-answer-button-a")==null||document.getElementById("ajaxq-show-answer-button-a")==undefined)
{ErrorLogger.logError("Unable to change Show Answer button visibility due to DOM ID of ajaxq-show-hint-button-a not existing.");return false;}
if(visibility==true)
{document.getElementById("ajaxq-show-answer-button-a").className="ajaxq-question-button-enabled";}
else if(visibility==false)
{document.getElementById("ajaxq-show-answer-button-a").className="ajaxq-question-button-disabled";}}
this.receiveShowAnswerExplanationButtonClicked=function()
{this.updateAjaxQuestionIneractionUponExplanationOpened();if(this.currentGuiDisplayProperties["isAnswerExplanationShowing"]==true)
{this.hideAnswerExplanation();}
else
{var currentQuestionId=this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();receiveReadyExplanation=function()
{var explanationHtml=QuestionRepositoryManager.getQuestionById(currentQuestionId).getExplanationHtml();_this.setExplanationContentsHtml(explanationHtml);_this.showAnswerExplanation();window.location="#show-explanation";}
receiveCaughtSAEError=function(e)
{if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxQuestionContextSqvGuiDriver.receiveShowAnswerExplanationButtonClicked(); questionContextId = '+this.getQuestionContext().getQuestionContextId()+' and questionId = '+currentQuestionId);StatusManager.displayWarningMessage("An error occurred in connecting to the server and loading the explanation. We apologize for this error. If it continues, please contact us.");}}
var myQuestionGrabber=new QuestionGrabber(currentQuestionId);myQuestionGrabber.setCallbackUponSuccess(receiveReadyExplanation);myQuestionGrabber.setCallbackUponFailure(receiveCaughtSAEError);myQuestionGrabber.loadQuestion();}}
this.changeShowAnswerExplanationButtonText=function(inputText)
{if(document.getElementById("ajaxq-show-answer-explanation-contents-a")!=null&&document.getElementById("ajaxq-show-answer-explanation-contents-a")!=undefined)
{document.getElementById("ajaxq-show-answer-explanation-contents-a").innerHTML=inputText;}
else
{ErrorLogger.logError("Unable to process change Show Answer Explanation Button Text since DOM ID ajaxq-show-answer-explanation-contents-a did not exist.");}}
this.showAnswerExplanation=function()
{if(document.getElementById("ajaxq-show-answer-explanation-contents-a")!=null&&document.getElementById("ajaxq-show-answer-explanation-contents-a")!=undefined)
{this.changeShowAnswerExplanationButtonText("Hide&nbsp;Explanation");document.getElementById("ajaxq-explanation-container").className="ajaxq-explanation-container-enabled";this.currentGuiDisplayProperties["isAnswerExplanationShowing"]=true;}
else
{ErrorLogger.logError("Unable to process change Show Answer Explanation since DOM ID ajaxq-show-answer-explanation-contents-a did not exist.");}}
this.hideAnswerExplanation=function()
{if(document.getElementById("ajaxq-explanation-container")!=null&&document.getElementById("ajaxq-explanation-container")!=undefined)
{this.changeShowAnswerExplanationButtonText("Show&nbsp;Explanation");document.getElementById("ajaxq-explanation-container").className="ajaxq-element-disabled";this.currentGuiDisplayProperties["isAnswerExplanationShowing"]=false;}
else
{ErrorLogger.logError("Unable to process hide Answer Explanation since DOM ID ajaxq-explanation-container did not exist.");}}
this.setShowExplanationButtonVisibility=function(visibility)
{if(document.getElementById("ajaxq-show-answer-explanation-button-a")==null||document.getElementById("ajaxq-show-answer-explanation-button-a")==undefined)
{ErrorLogger.logError("Unable to change Answer Explanation button visibility due to DOM ID of ajaxq-show-hint-button-a not existing.");return false;}
if(visibility==true)
{document.getElementById("ajaxq-show-answer-explanation-button-a").className="ajaxq-question-button-enabled";}
else if(visibility==false)
{document.getElementById("ajaxq-show-answer-explanation-button-a").className="ajaxq-question-button-disabled";}}
this.receiveNextQuestionButtonClick=function()
{if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getCurrentlySelectedAnswer()==GlobalVariables.ANSWER_LEFT_BLANK)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_NO_QUESTION_ANSWER_SELECTED);return false;}
if(_currentlyProcessingChangeQuestionRequest)
{return false;}
_currentlyProcessingChangeQuestionRequest=true;StatusManager.displayLoadingMessage();if(StatusManager.getTextOfCurrentMessage()==ErrorLogger.ERROR_TEXT_NO_QUESTION_ANSWER_SELECTED)
{StatusManager.hideWarning();}
proceedToNextStaticQuestion=function()
{var nextQuestionId=_this.getQuestionContext().getCurrentQuestionList().getAbsoluteNextQuestionId();_this.handleQuestionChangeRequest(nextQuestionId);}
interactionUpdatedSuccessfully=function()
{if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL)
{var maxQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getMaximumQuestionCount();var currentQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionNumber();if((currentQuestionNumber)==maxQuestionNumber&&_this.getQuestionContext().getCurrentPracticeTestState()==GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN)
{myAjaxPracticeTestDriver.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED);}
else if((currentQuestionNumber)==maxQuestionNumber&&_this.getQuestionContext().getCurrentPracticeTestState()==GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN)
{myAjaxPracticeTestDriver.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED);}
myAjaxPracticeTestDriver.getNextCatQuestion();}
else
{proceedToNextStaticQuestion();}}
if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId(),_this.getQuestionContextId())&&AjaxQuestionInteractionRepositoryManager.getInteraction(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId(),this.getQuestionContextId()).getIsFinalized()==true)
{proceedToNextStaticQuestion();}
else if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_STATIC_QUIZ&&_this.getQuestionContext().getAuthorization()!=GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{proceedToNextStaticQuestion();}
else
{_this.finalizeAjaxQuestionInteractionUponClosingQuestion(interactionUpdatedSuccessfully);}}
this.receivePreviousQuestionButtonClick=function()
{if(_currentlyProcessingChangeQuestionRequest)
{return false;}
_currentlyProcessingChangeQuestionRequest=true;successPreviousCallback=function(){}
this.finalizeAjaxQuestionInteractionUponClosingQuestion(successPreviousCallback);var previousQuestionId=this.getQuestionContext().getCurrentQuestionList().getAbsolutePreviousQuestionId();this.handleQuestionChangeRequest(previousQuestionId);}
this.fillInPreviousQuestionInteractiontoGui=function()
{if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId(),this.getQuestionContextId()))
{if(AjaxQuestionInteractionRepositoryManager.getInteraction(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId(),this.getQuestionContextId()).getIsFinalized()==true)
{myAjaxPracticeTestDriver.disableEntireTestClockUpdateReferences();var questionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId(),this.getQuestionContextId());var selectedAnswer=questionInteraction.getSelectedAnswer();var secondsToFinalAnswer=questionInteraction.getSecondsToFinalAnswer();if(QuestionRepositoryManager.doesQuestionExist(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()))
{if(selectedAnswer==QuestionRepositoryManager.getQuestionById(this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()).getCorrectAnswer())
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansSelectedImg"+selectedAnswer).src=GlobalVariables.getAbsoluteRootPath()+"global/images/icons/check.png";}
else
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansSelectedImg"+selectedAnswer).src=GlobalVariables.getAbsoluteRootPath()+"global/images/icons/x.png";}}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ans"+selectedAnswer)!=null&&document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ans"+selectedAnswer)!=undefined)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ans"+selectedAnswer).checked=true;if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA").disabled==false)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA").setAttribute("disabled","disabled");}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB").disabled==false)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB").setAttribute("disabled","disabled");}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC").disabled==false)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC").setAttribute("disabled","disabled");}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD").disabled==false)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD").setAttribute("disabled","disabled");}
if(document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE").disabled==false)
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE").setAttribute("disabled","disabled");}}
this.receiveShowAnswerButtonClicked();this.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(questionInteraction.getSecondsToFinalAnswer()));}}}
this.handleQuestionChangeRequest=function(desiredQuestionId)
{if(desiredQuestionId==GlobalVariables.END_OF_QUESTION_LIST)
{return false;}
receiveQuestionChangeReady=function()
{var desiredQuestion=QuestionRepositoryManager.getQuestionById(desiredQuestionId);var questionDisplayHtml;var explanationDisplayHtml=desiredQuestion.getExplanationHtml();var passageId=desiredQuestion.getPassageId();if(passageId!=null&&passageId!=undefined)
{questionDisplayHtml='<table class="ajaxq-reading-comprehension-grid">';questionDisplayHtml+='<tr>';questionDisplayHtml+='<td class="ajaxq-reading-comprehension-passage">';questionDisplayHtml+=PassageRepositoryManager.getPassageById(passageId).getPassageHtml();questionDisplayHtml+='</td>';questionDisplayHtml+='<td class="ajaxq-reading-comprehension-passage">';questionDisplayHtml+=desiredQuestion.getQuestionHtml();questionDisplayHtml+='</td>';questionDisplayHtml+='</tr>';questionDisplayHtml+='</table>';}
else
{questionDisplayHtml=desiredQuestion.getQuestionHtml();}
_this.getQuestionContext().getCurrentQuestionList().setCurrentQuestionId(desiredQuestionId);_this.setQuestionContentsHtml(questionDisplayHtml);_this.setExplanationContentsHtml(explanationDisplayHtml);_this.updateGuiUponQuestionChange();}
handleCaughtHQCRError=function(e)
{if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxQuestionContextSqvGuiDriver.handleQuestionChangeRequest(); questionContextId = '+_this.getQuestionContext().getQuestionContextId()+' and questionId = '+desiredQuestionId);StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_QCSQV);}}
var myQuestionGrabber=new QuestionGrabber(desiredQuestionId);myQuestionGrabber.setCallbackUponSuccess(receiveQuestionChangeReady);myQuestionGrabber.setCallbackUponFailure(handleCaughtHQCRError);myQuestionGrabber.loadQuestion();}
this.updateGuiUponQuestionChange=function()
{var justInitializedQuestionId=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(justInitializedQuestionId==null||justInitializedQuestionId==undefined)
{var myError=new RequestedObjectDNEError('Unable to process updateGuiUponQuestionChange() since currentQuestionId is set to Undefined; questionContextId = '+_this.getQuestionContext().getQuestionContextId());myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_SQV]["title"]=QuestionRepositoryManager.getQuestionById(justInitializedQuestionId).getQuestionTitle();myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_SQV]["onclickAction"]='myQcSqvDriver.focusToQuestion('+_this.getQuestionContext().getQuestionContextId()+', '+_this.getQuestionContext().getCurrentQuestionListId()+', '+justInitializedQuestionId+'); return false;';myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_SQV]["url"]=GlobalVariables.getPracticeTestDirectory()+'/?state=qc-sqv&question_context_id='+_this.getQuestionContextId()+'&question_list_id='+_this.getQuestionContext().getCurrentQuestionList().getQuestionListId()+'&question_id='+justInitializedQuestionId;myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_PL]["title"]=QuestionContextRepositoryManager.getQuestionContextById(_this.getQuestionContextId()).getQuestionContextTitle();myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_PL]["onclickAction"]='myQcSqvDriver.finalizeAjaxQuestionInteractionUponClosingQuestion(function () {}); myQcSqvDriver.receiveRequestToReturnToQuestionContextProblemListView(); return false;';myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_PL]["url"]=GlobalVariables.getPracticeTestDirectory()+'/?state=qc-pl&question_context_id='+_this.getQuestionContextId();myAjaxSessionGuiDriver._currentState=myAjaxSessionGuiDriver.STATE_QC_SQV;myAjaxSessionGuiDriver.updateBreadCrumbs();var desiredQuestion=QuestionRepositoryManager.getQuestionById(justInitializedQuestionId);if(desiredQuestion.getQuestionTitle().length>0)
{document.title=desiredQuestion.getQuestionTitle();if(document.getElementById("title")!=undefined&&document.getElementById("title")!=null)
{document.getElementById("title").innerHTML=desiredQuestion.getQuestionTitle();}}
updateGuiUponTraversableQuestionList=function()
{_this.setShowQuestionListButtonVisibility(true);_this.setShowAnswerButtonVisibility(true);_this.setShowExplanationButtonVisibility(true);_this.setNextQuestionButtonText("Next&nbsp;Question&nbsp;&raquo;");_this.enableGetLinkHtmlButton();if(_this.getQuestionContext().getCurrentQuestionList().getAbsoluteNextQuestionId()==GlobalVariables.END_OF_QUESTION_LIST)
{_this.setNextQuestionButtonVisibility(false);}
else
{_this.setNextQuestionButtonVisibility(true);_this.setNextQuestionButtonUrl('?state=qc-sqv&question_context_id='+_this.getQuestionContextId()+'&question_list_id='+_this.getQuestionContext().getCurrentQuestionList().getQuestionListId()+'&question_id='+_this.getQuestionContext().getCurrentQuestionList().getAbsoluteNextQuestionId());}
if(_this.userGuiDisplayPreferences["showAnswerHintButtonWhenAvaiable"]==true&&QuestionRepositoryManager.getQuestionById(justInitializedQuestionId).getHintHtml()!=undefined&&QuestionRepositoryManager.getQuestionById(justInitializedQuestionId).getHintHtml()!=null&&QuestionRepositoryManager.getQuestionById(justInitializedQuestionId).getHintHtml().length>0)
{_this.setAnswerHintButtonVisibility(true);}
else
{_this.setAnswerHintButtonVisibility(false);}
if(_this.userGuiDisplayPreferences["showAnswerHintContentsUponLoadingNewQuestion"]==false)
{_this.setAnswerHintContentsVisibility(false);_this.setAnswerHintButtonContents("Show&nbsp;Hint");}
else if(_this.userGuiDisplayPreferences["showAnswerHintContentsUponLoadingNewQuestion"]==true)
{_this.setAnswerHintContentsVisibility(true);_this.setAnswerHintButtonContents("Hide&nbsp;Hint");}
if(_this.getQuestionContext().getCurrentQuestionList().getAbsolutePreviousQuestionId()==GlobalVariables.END_OF_QUESTION_LIST)
{_this.setPreviousQuestionButtonVisibility(false);}
else
{_this.setPreviousQuestionButtonVisibility(true);_this.setPreviousQuestionButtonUrl('?state=qc-sqv&question_context_id='+_this.getQuestionContextId()+'&question_list_id='+_this.getQuestionContext().getCurrentQuestionList().getQuestionListId()+'&question_id='+_this.getQuestionContext().getCurrentQuestionList().getAbsolutePreviousQuestionId());}
if(_this.userGuiDisplayPreferences["showExplanationUponLoadingNewQuestion"]!==true)
{_this.hideAnswerExplanation();}
if(_this.userGuiDisplayPreferences["showCorrectAnswerUponLoadingNewQuestion"]!==true)
{_this.hideCorrectAnswer();}
if(document.getElementById("ajaxq-star-question-non-active-cat")!=null&&document.getElementById("ajaxq-star-question-non-active-cat")!=undefined)
{document.getElementById("ajaxq-star-question-non-active-cat").className="ajaxq-question-button-enabled";}
if(document.getElementById("ajaxq-star-question-active-cat")!=null&&document.getElementById("ajaxq-star-question-active-cat")!=undefined)
{document.getElementById("ajaxq-star-question-active-cat").className="ajaxq-element-disabled";}
document.getElementById("ajaxq-question-action-row").className="ajaxq-element-table";}
updateGuiUponActiveCat=function()
{_this.setPreviousQuestionButtonDisplay(false);_this.enableRadioBoxes();_this.updateMarkQuestionUponNewQuestion();_this.setAnswerHintButtonVisibility(false);_this.setAnswerHintContentsVisibility(false);_this.hideAnswerExplanation();_this.setShowAnswerButtonVisibility(false);_this.setShowExplanationButtonVisibility(false);_this.setShowQuestionListButtonVisibility(false);_this.setNextQuestionButtonText("Next&nbsp;Question&nbsp;&raquo;");_this.disableGetLinkHtmlButton();var maxQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getMaximumQuestionCount();var currentQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionNumber();if(maxQuestionNumber!=null&&maxQuestionNumber!=undefined&&currentQuestionNumber!=null&&currentQuestionNumber!=undefined)
{if((currentQuestionNumber)==maxQuestionNumber&&_this.getQuestionContext().getCurrentPracticeTestState()==GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN)
{_this.setNextQuestionButtonVisibility(true);_this.setNextQuestionButtonText("Finish Section");}
else if((currentQuestionNumber)==maxQuestionNumber&&_this.getQuestionContext().getCurrentPracticeTestState()==GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN)
{_this.setNextQuestionButtonVisibility(true);_this.setNextQuestionButtonText("Finish Test");}
else
{_this.setNextQuestionButtonVisibility(true);_this.setNextQuestionButtonText("Next Question");_this.setNextQuestionButtonUrl('#');}}
if(document.getElementById("ajaxq-star-question-non-active-cat")!=null&&document.getElementById("ajaxq-star-question-non-active-cat")!=undefined)
{document.getElementById("ajaxq-star-question-non-active-cat").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-star-question-active-cat")!=null&&document.getElementById("ajaxq-star-question-active-cat")!=undefined)
{document.getElementById("ajaxq-star-question-active-cat").className="ajaxq-question-button-enabled";}
document.getElementById("ajaxq-question-action-row").className="ajaxq-element-disabled";}
if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&_this.getQuestionContext().getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{updateGuiUponActiveCat();}
else
{updateGuiUponTraversableQuestionList();}
_this.updateMarkQuestionUponNewQuestion();if(_this.getQuestionContext().getAuthorization()!=GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{_this.disableRadioBoxes();}
else
{_this.enableRadioBoxes();}
if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(justInitializedQuestionId,_this.getQuestionContextId()))
{_this.fillInPreviousQuestionInteractiontoGui();}
else
{_this.instantiateAjaxQuestionInteractionUponNewQuestionLoading();}
this.updateGetLinkHtmlUponQuestionChange();var maxQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getMaximumQuestionCount();var currentQuestionNumber=_this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionNumber();if(maxQuestionNumber!=null&&maxQuestionNumber!=undefined&&currentQuestionNumber!=null&&currentQuestionNumber!=undefined)
{if(_this.getQuestionContext().getQuestionContextType()==GlobalVariables.TYPE_STATIC_QUIZ)
{var displayHtml="Question "+currentQuestionNumber+" of "+maxQuestionNumber;_this.setQuestionCountContents(displayHtml);}
else
{_this.setQuestionCountContents("Question "+currentQuestionNumber+" of "+maxQuestionNumber);}}
document.getElementById("ajaxq-mode-container-qc-sqv").className="ajaxq-element-inline";StatusManager.pageChangeCompleted();_currentlyProcessingChangeQuestionRequest=false;}
this.disableRadioBoxes=function()
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA").setAttribute("disabled","disabled");document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB").setAttribute("disabled","disabled");document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC").setAttribute("disabled","disabled");document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD").setAttribute("disabled","disabled");document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE").setAttribute("disabled","disabled");}
this.enableRadioBoxes=function()
{document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansA").disabled=false;document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansB").disabled=false;document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansC").disabled=false;document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansD").disabled=false;document.getElementById("q"+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId()+"_ansE").disabled=false;}
this.updateGetLinkHtmlUponQuestionChange=function()
{var myGetUrlGui=new GetUrlGui();var sharableUrl=GlobalVariables.getAjaxQuestionContextShareDirectory()+'?state=qc-sqv&question_context_id='+this.getQuestionContextId()+'&question_list_id='+this.getQuestionContext().getCurrentQuestionList().getQuestionListId()+'&question_id='+this.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();myGetUrlGui.setSharableUrl(sharableUrl);myGetUrlGui.setTitle("Get Link to Question");myGetUrlGui.setInstructionText("Sharing the above link with your friends will enable them to view your results. Copying and pasting the HTML code below will create a link to a page where anyone can view your results.");myGetUrlGui.setAnchorText("GMAT Practice Question - View Results");myGetUrlGui.setOpenLeft(false);if(document.getElementById("share-qcsqv-link")!=null&&document.getElementById("share-qcsqv-link")!=undefined)
{document.getElementById("share-qcsqv-link").innerHTML='<div>Want to <b>share this question?</b>&nbsp;'+myGetUrlGui.getGuiHtml()+'</div>';}}
this.enableGetLinkHtmlButton=function()
{if(document.getElementById("share-qcsqv-link")!=null&&document.getElementById("share-qcsqv-link")!=undefined)
{document.getElementById("share-qcsqv-link").className='ajaxq-element-table-static';}}
this.disableGetLinkHtmlButton=function()
{if(document.getElementById("share-qcsqv-link")!=null&&document.getElementById("share-qcsqv-link")!=undefined)
{document.getElementById("share-qcsqv-link").className='ajaxq-element-disabled';}}
this.setNextQuestionButtonVisibility=function(desiredStatus)
{if(desiredStatus==false)
{document.getElementById("ajaxq-next-question-button-a").className="ajaxq-question-button-disabled";this.currentGuiDisplayProperties["isNextQuestionButtonShowing"]=false;}
else if(desiredStatus==true)
{document.getElementById("ajaxq-next-question-button-a").className="ajaxq-question-button-enabled";this.currentGuiDisplayProperties["isNextQuestionButtonShowing"]=true;}
else
{ErrorLogger.logWarning("setNextQuestionButtonVisibility() wrongly passed a non boolean value.");}}
this.setNextQuestionButtonText=function(text)
{if(document.getElementById("ajaxq-next-question-anchorelement-a")!=null&&document.getElementById("ajaxq-next-question-anchorelement-a")!=undefined)
{document.getElementById("ajaxq-next-question-anchorelement-a").innerHTML=text;}}
this.setPreviousQuestionButtonVisibility=function(desiredStatus)
{if(desiredStatus==false&&document.getElementById("ajaxq-previous-question-button-a")!=null&&document.getElementById("ajaxq-previous-question-button-a")!=undefined)
{document.getElementById("ajaxq-previous-question-button-a").className="ajaxq-question-button-disabled";this.currentGuiDisplayProperties["isPreviousQuestionButtonShowing"]=false;}
else if(desiredStatus==true&&document.getElementById("ajaxq-previous-question-button-a")!=null&&document.getElementById("ajaxq-previous-question-button-a")!=undefined)
{document.getElementById("ajaxq-previous-question-button-a").className="ajaxq-question-button-enabled";this.currentGuiDisplayProperties["isPreviousQuestionButtonShowing"]=true;}
else
{ErrorLogger.logWarning("an unrecognized state passed to setPreviousQuestionButtonVisibility()");}}
this.setPreviousQuestionButtonDisplay=function(desiredStatus)
{if(desiredStatus==false&&document.getElementById("ajaxq-previous-question-button-a")!=null&&document.getElementById("ajaxq-previous-question-button-a")!=undefined)
{document.getElementById("ajaxq-previous-question-button-a").className="ajaxq-element-disabled";this.currentGuiDisplayProperties["isPreviousQuestionButtonShowing"]=false;}
else if(desiredStatus==true&&document.getElementById("ajaxq-previous-question-button-a")!=null&&document.getElementById("ajaxq-previous-question-button-a")!=undefined)
{document.getElementById("ajaxq-previous-question-button-a").className="ajaxq-question-button-enabled";this.currentGuiDisplayProperties["isPreviousQuestionButtonShowing"]=true;}
else
{ErrorLogger.logWarning("an unrecognized state passed to setPreviousQuestionButtonVisibility()");}}
this.setPreviousQuestionButtonUrl=function(url)
{if(document.getElementById("ajaxq-previous-question-anchorelement-a").href)
{document.getElementById("ajaxq-previous-question-anchorelement-a").href=url;}}
this.setNextQuestionButtonUrl=function(url)
{if(document.getElementById("ajaxq-next-question-anchorelement-a").href)
{document.getElementById("ajaxq-next-question-anchorelement-a").href=url;}}
this.setQuestionCountContents=function(html)
{if(document.getElementById("question-count-field")!=null&&document.getElementById("question-count-field")!=undefined)
{document.getElementById("question-count-field").innerHTML=html;}
else
{ErrorLogger.logWarning("Unable to change Question Count Contents as DOM ID question-count-field does not exist.)");}}}
var AJAXQExpanadableVisibilityManager={toggle:function(questionNum,section)
{if(document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum)!=null&&document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum)!=undefined)
{if(document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum).className.indexOf("-expanded")>0)
{AJAXQExpanadableVisibilityManager.setVisibility(questionNum,section,false);}
else
{AJAXQExpanadableVisibilityManager.setVisibility(questionNum,section,true);}}
else
{ErrorLogger.logWarning("Attempted to change visibility of expandables in AJAXQExpanadableVisibilityManager.toggle() when DOM ID DNE: ajaxq-explanation-expandable-contents"+section+"-"+questionNum);}},setVisibility:function(questionNum,section,visible)
{if(document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum)!=null&&document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum)!=undefined&&document.getElementById("ajaxq-explanation-expandable-"+section+"-button-link-"+questionNum)!=null&&document.getElementById("ajaxq-explanation-expandable-"+section+"-button-link-"+questionNum)!=undefined)
{document.getElementById("ajaxq-explanation-expandable-contents"+section+"-"+questionNum).className=(visible?"ajaxq-explanation-expandable-contents-expanded":"ajaxq-explanation-expandable-contents-contracted");document.getElementById("ajaxq-explanation-expandable-"+section+"-button-link-"+questionNum).className=(visible?"ajaxq-explanation-expandable-button-link-expanded":"ajaxq-explanation-expandable-button-link-contracted");}
else
{ErrorLogger.logWarning("Attempted to run AJAXQExpanadableVisibilityManager.setVisibility() failed with parameters Question Num: "+questionNum+" and Section: "+section+" and Visibility: "+visible);}}}
function AjaxQuestionContextProblemListViewGuiDriver(contextId)
{var _questionContextId=contextId;this.getQuestionContextId=function()
{if(_questionContextId==null||_questionContextId==undefined)
{return undefined;}
else
{return _questionContextId;}}
displayFulllyLoaded=function()
{var html='';if(QuestionContextRepositoryManager.doesQuestionContextExist(_questionContextId)==false)
{ErrorLogger.logError("Invoked AjaxQuestionContextProblemListViewGuiDriver.displayFulllyLoaded(), yet Question Context ID "+_questionContextId+" did not exist in repository.");return false;}
var questionContext=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId);var questionContextTitle=questionContext.getQuestionContextTitle();myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_PL]["title"]=questionContextTitle;myAjaxSessionGuiDriver._potentialStates[myAjaxSessionGuiDriver.STATE_QC_PL]["onclickAction"]='myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcPl('+_questionContextId+'); return false;';myAjaxSessionGuiDriver._currentState=myAjaxSessionGuiDriver.STATE_QC_PL;myAjaxSessionGuiDriver.updateBreadCrumbs();html+='<p>Currently viewing ';var questionContextTypeString;if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_STATIC_QUIZ)
{questionContextTypeString='quiz';html+=questionContextTypeString;}
else if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_QUIZ)
{questionContextTypeString='CAT quiz';html+=questionContextTypeString;}
else if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL)
{questionContextTypeString='practice test';html+=questionContextTypeString;}
else
{questionContextTypeString='quiz';html+=questionContextTypeString;ErrorLogger.logWarning("Unrecognized Question Context Type in ErrorLogger.displayMyHistoryWithCurrentArraySort(); Context Type = "+questionContext.getQuestionContextType());}
if(questionContext.getQuestionContextTitle()!=undefined&&questionContext.getQuestionContextTitle()!=null&&questionContext.getQuestionContextTitle().length>0)
{html+=' entitled <b>'+questionContext.getQuestionContextTitle()+'</b>. To view a specific question, click on the title of the question.';}
if(questionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_READER)
{html+=' Feel free to attempt the questions below. However, since you are viewing publicly shared results, the results of your attempts will not be stored.';}
html+='</p>';if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&questionContext.getAdditionalInformation().length!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_raw_low')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_raw_low').length!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_percent_low')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_percent_low').length!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_percent_score_low')!=null&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_percent_score_low').length!=null)
{quantLowRangeOfScoreAsRawSubScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_raw_low');quantHighRangeOfScoreAsRawSubScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_raw_high');quantLowRangeOfScoreAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_percent_low');quantHighRangeOfScoreAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'quant_percent_high');verbalLowRangeOfScoreAsRawSubScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_raw_low');verbalHighRangeOfScoreAsRawSubScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_raw_high');verbalLowRangeOfScoreAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_percent_low');verbalHighRangeOfScoreAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'verbal_percent_high');totalScoreLowRangeAsRawScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_raw_score_low');totalScoreHighRangeAsRawScore=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_raw_score_high');totalScoreLowEstimateAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_percent_score_low');totalScoreHighEstimateAsPercent=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'total_percent_score_high');html+='<table>';html+='<tr>';html+='<th class="ajaxq-test-results-scores-th">Section</th>';html+='<th class="ajaxq-test-results-scores-th">Raw Score</th>';html+='<th class="ajaxq-test-results-scores-th">Percentile</th>';html+='</tr>';html+='<tr>';html+='<td>Quantitative</td>';html+='<td>'+quantLowRangeOfScoreAsRawSubScore+' - '+quantHighRangeOfScoreAsRawSubScore+'</td>';html+='<td>'+quantLowRangeOfScoreAsPercent+'% - '+quantHighRangeOfScoreAsPercent+'%</td>';html+='</tr>';html+='<tr>';html+='<td>Verbal</td>';html+='<td>'+verbalLowRangeOfScoreAsRawSubScore+' - '+verbalHighRangeOfScoreAsRawSubScore+'</td>';html+='<td>'+verbalLowRangeOfScoreAsPercent+'% - '+verbalHighRangeOfScoreAsPercent+'%</td>';html+='</tr>';html+='<tr>';html+='<td>Total Score</td>';html+='<td>'+totalScoreLowRangeAsRawScore+' - '+totalScoreHighRangeAsRawScore+'</td>';html+='<td>'+totalScoreLowEstimateAsPercent+'% - '+totalScoreHighEstimateAsPercent+'%</td>';html+='</tr>';html+='</table>';}
html+='<p>For a description of what each column below represents, please see the <a href="#qc-pl-key">key</a> at the bottom of the page.</p>';var myGetUrlGui=new GetUrlGui();var sharableUrl=GlobalVariables.getAjaxQuestionContextShareDirectory()+'?state=qc-pl&question_context_id='+_questionContextId;myGetUrlGui.setSharableUrl(sharableUrl);myGetUrlGui.setTitle("Get Link to This Page");myGetUrlGui.setInstructionText("Sharing the above link with friends will enable them to view this page. Copying and pasting the HTML code below will create a link to this page.");myGetUrlGui.setAnchorText("GMAT "+questionContextTypeString+" results");myGetUrlGui.setOpenLeft(false);html+='<div>Want to <b>share the results of this '+questionContextTypeString+'</b> with others? '+myGetUrlGui.getGuiHtml()+'</div>';for(var i=0;i<questionContext.getQuestionListIds().length;i++)
{var questionListIdToRequest=parseInt(questionContext.getQuestionListIds()[i]);if(QuestionListRepositoryManager.doesListExist(questionListIdToRequest)==false)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_QCNTPV);ErrorLogger.logError("Invoked AjaxQuestionContextProblemListViewGuiDriver.displayFulllyLoaded() with Question Context ID "+_questionContextId+". However, Question List ID "+questionListIdToRequest+" did not exist in repository.");return false;}
var currentQuestionList=QuestionListRepositoryManager.getListById(questionListIdToRequest);var currentQuestionListId=currentQuestionList.getQuestionListId();var questionsIdsToGrab=new Array();if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&currentQuestionList.getCatSubSection()==GlobalVariables.CAT_SECTION_QUANT)
{html+='<h2>Qualitative Sub-Section Results</h2>';}
else if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&currentQuestionList.getCatSubSection()==GlobalVariables.CAT_SECTION_VERBAL)
{html+='<h2>Verbal Sub-Section Results</h2>';}
html+='<table class="ajaxq-list-results-container">';html+='<tr>';html+='<th colspan="5">Result Details</th>';html+='<th colspan="3">Question Details</th>';html+='</tr>';html+='<tr class="sub-headers">';html+='<td>#</td>';html+='<td>Date<br />Completed</td>';html+='<td>Selected<br />Answer</td>';html+='<td>Time<br />(Min:Sec)</td>';html+='<td><img src="../global/images/rating/star_on.gif" height="14" width="14" alt="star question" /></td>';html+='<td>Type</td>';html+='<td>Title</td>';html+='<td>Difficulty</td>';html+='</tr>';var oddRow=true;for(var j=0;j<currentQuestionList.getQuestionListContents().length;j++)
{var currentQuestionId=currentQuestionList.getQuestionListContents()[j];if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(currentQuestionId)==false)
{ErrorLogger.logError("Invoked AjaxQuestionContextProblemListViewGuiDriver.displayFulllyLoaded() with Question Context ID "+_questionContextId+" and Question List ID "+currentQuestionListId+". However, Question ID "+currentQuestionId+" did not exist in repository.");return false;}
var questionTitle=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(currentQuestionId).getQuestionTitle();var questionType=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(currentQuestionId).getQuestionCategoryType();var difficulty=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(currentQuestionId).getQuestionDifficulty();if(oddRow)
{html+='<tr class="offset-a">';oddRow=false;}
else
{html+='<tr class="offset-b">';oddRow=true;}
html+='<td>'+(j+1)+'</td>';if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(currentQuestionId,_questionContextId)&&AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,_questionContextId).getIsFinalized()==true)
{var currentQuestionInteraction=AjaxQuestionInteractionRepositoryManager.getInteraction(currentQuestionId,_questionContextId);html+='<td>'+GlobalVariables.formatUtcUnixTimestampDisplayAsText(currentQuestionInteraction.getTimestamp())+'</td>';if(GlobalVariables.validateQuestionAnswer(currentQuestionInteraction.getSelectedAnswer()))
{if(currentQuestionInteraction.getSelectedAnswer()==QuestionMetaDataRepositoryManager.getQuestionMetaDataById(currentQuestionId).getCorrectAnswer())
{html+='<td>'+currentQuestionInteraction.getSelectedAnswer()+'&nbsp;<img src="../global/images/icons/check.png" alt="correct" height="10" width="10" /></td>';}
else
{html+='<td>'+currentQuestionInteraction.getSelectedAnswer()+'&nbsp;<img src="../global/images/icons/x.png" alt="incorrect" height="10" width="10" /></td>';}}
html+='<td>'+GlobalVariables.formatTimeToFinalAnswerDisplay(currentQuestionInteraction.getSecondsToFinalAnswer())+'</td>';html+='<td class="is-starred">'+formatStarQuestion(currentQuestionId)+'</td>';}
else
{html+='<td>&nbsp;</td>';html+='<td>&nbsp;</td>';html+='<td>&nbsp;</td>';html+='<td class="is-starred">'+formatStarQuestion(currentQuestionId)+'</td>';}
html+='<td>'+formatQuestionCategoryDisplay(questionType)+'</td>';if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL)
{html+='<td><a href="?state=qc-sqv&question_context_id='+_questionContextId+'&amp;question_list_id='+currentQuestionListId+'&amp;question_id='+currentQuestionId+'&cat_request=1" onclick="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqvCat('+_questionContextId+', '+currentQuestionListId+', '+currentQuestionId+'); return false;">'+questionTitle+'</a></td>';}
else
{html+='<td><a href="?state=qc-sqv&question_context_id='+_questionContextId+'&amp;question_list_id='+currentQuestionListId+'&amp;question_id='+currentQuestionId+'" onclick="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqv('+_questionContextId+', '+currentQuestionListId+', '+currentQuestionId+'); return false;">'+questionTitle+'</a></td>';}
html+='<td>'+difficulty+'</td>';html+='</tr>';}
html+='</table>';}
html+='<a name="qc-pl-key"></a>';html+='<h2>Key</h2>';html+='<ul>';html+='<li><b>Date Completed</b> - The date, in either relative or absolute terms, that a final answer was selected.</li>';html+='<li><b>Selected Answer</b> - The answer that was selected when the question was closed.</li>';html+='<li><b>Time</b> - The time that elapsed between when the question loaded and when the question was completed. The question is considered completed when any of the following three events occur: (1) the next (or previous) question is selected (2) the correct answer is shown (3) the explanation is shown.</li>';html+='<li><img src="../global/images/rating/star_on.gif" height="14" width="14" alt="star question" /> - Whether you starred a question for review, etc. To star a question, click on the star. To undo, simply click the star again.</li>';html+='<li><b>Type</b> - The content type of the question. PS denotes Problem Solving, DS denotes Data Sufficiency, RC denotes Reading Comprehension, SC denotes Sentence Correction, and CR denotes critical reasoning.</li>';html+='<li><b>Title</b> - The title of the question.</li>';html+='<li><b>Difficulty</b> - An estimation of the difficulty of the question, as measured by the GMAT\'s 200-800 total composite score index.</li>';html+='</ul>';if(document.getElementById("ajaxq-mode-container-qc-pl")!=null&&document.getElementById("ajaxq-mode-container-qc-pl")!=undefined)
{document.getElementById("ajaxq-mode-container-qc-pl").innerHTML=html;document.getElementById("ajaxq-mode-container-qc-pl").className="ajaxq-element-inline";}
else
{ErrorLogger.logError("Attempt to write contents to DOM ID: ajaxq-mode-container-qc-pl failed as DOM ID did not exist. Occurred in AjaxQuestionContextProblemListViewGuiDriver.displayFullyLoaded()");}
StatusManager.pageChangeCompleted();}
formatStarQuestion=function(iQId)
{if(GlobalVariables.validateValueAsNumber(iQId)==false)
{ErrorLogger.logWarning("An invalid input passed to AjaxQuestionContextProblemListViewGuiDriver.formatStarQuestion(); Input = "+iQId);return'';}
var inputQuestionId=new Number(iQId);var sqHtml='';sqHtml+='<img onclick="GlobalVariables.changeStarQuestionState(\''+inputQuestionId+'\', \'question-star-'+inputQuestionId+'\'); return false;" onmouseover="GlobalVariables.handleStarQuestionMouseOver(\''+inputQuestionId+'\', \'question-star-'+inputQuestionId+'\');" onmouseout="GlobalVariables.handleStarQuestionMouseOut(\''+inputQuestionId+'\', \'question-star-'+inputQuestionId+'\');" src="../global/images/rating/';if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(inputQuestionId))
{sqHtml+='star_on.gif';}
else
{sqHtml+='star_off.gif';}
sqHtml+='" height="14" width="14" alt="star question" id="question-star-'+inputQuestionId+'"/>';return sqHtml;}
formatQuestionCategoryDisplay=function(catAbbr)
{var switchOn=catAbbr.toUpperCase();switch(switchOn)
{case'PS':return'<acronym title="Problem Solving">PS</acronym>';break;case'DS':return'<acronym title="Data Sufficiency">DS</acronym>';break;case'SC':return'<acronym title="Sentence Correction">SC</acronym>';break;case'RC':return'<acronym title="Reading Comprehension">RC</acronym>';break;case'CR':return'<acronym title="Critical Reasoning">CR</acronym>';break;default:ErrorLogger.logWarning("An unrecognized Question Content Type Category passed to AjaxQuestionContextProblemListViewGuiDriver.formatQuestionCategoryDisplay(); Case = "+switchOn);}}
handleIncompletePracticeTest=function(currentTestState)
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId);var html='<p>The practice test you attempted to open is not yet completed.</p>';if(questionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_READER)
{html+='<p>When the creator of the test completes the test, you will be able to view the results.</p>';}
else if(questionContext.getAuthorization()==GlobalVariables.AUTHORIZATION_ACCESS_PERMISSIONS_OWNER)
{html+='<p><b><a href="#" onclick="myAjaxPracticeTestDriver.loadTest('+parseInt(_questionContextId)+'); return false;">Resume &amp; Continue Practice Test</a></b></p>';}
if(document.getElementById("ajaxq-mode-container-qc-pl")!=null&&document.getElementById("ajaxq-mode-container-qc-pl")!=undefined)
{document.getElementById("ajaxq-mode-container-qc-pl").innerHTML=html;document.getElementById("ajaxq-mode-container-qc-pl").className="ajaxq-element-inline";}
else
{ErrorLogger.logError("Attempt to write contents to DOM ID: ajaxq-mode-container-qc-pl failed as DOM ID did not exist. Occurred in AjaxQuestionContextProblemListViewGuiDriver.displayFullyLoaded()");}
StatusManager.pageChangeCompleted();}
handleCaughtPLError=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}
else if(e instanceof NoContentFound)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxQuestionContextProblemListViewGuiDriver.handleCaughtPLError(); questionContextId = '+_questionContextId);StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}}
questionMetaDataLoaded=function()
{try
{if(QuestionContextRepositoryManager.doesQuestionContextExist(_questionContextId)==false)
{throw new RequestedObjectDNEError("question context ID of "+_questionContextId+" does not exist in AjaxQuestionContextProblemListViewGuiDriver.questionContextLoaded();");}
var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId);currentStateOfTestKnown=function(currentTestState)
{currentQuestionContext.setCurrentPracticeTestState(currentTestState);GlobalVariables.setAdditionalInformationVariableForQuestionContext(currentQuestionContext.getQuestionContextId(),'current_state',currentTestState);if(currentQuestionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&currentTestState!=GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{handleIncompletePracticeTest(currentTestState);}
else if(currentTestState==GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{displayFulllyLoaded();}
else
{ErrorLogger.logError("Unexpected return value for currentStateOfTestKnown() in questionMetaDataLoaded(). Value = "+currentTestState);}}
if(currentQuestionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL)
{GlobalVariables.determineStateOfPracticeTest(currentQuestionContext.getQuestionContextId(),currentStateOfTestKnown,handleCaughtPLError);}
else
{displayFulllyLoaded();}}
catch(e)
{handleCaughtPLError(e);}}
questionInteractionsLoaded=function()
{var myQMDGrabber=new QuestionContextQuestionsMetaDataGrabber(_questionContextId);myQMDGrabber.setCallbackUponSuccess(questionMetaDataLoaded);myQMDGrabber.setCallbackUponFailure(handleCaughtPLError);myQMDGrabber.loadMetaDataOfQuestionsInQuestionContext();}
questionContextLoaded=function()
{if(QuestionContextRepositoryManager.doesQuestionContextExist(_questionContextId)==false)
{var myError=new RequestedObjectDNEError("question context ID of "+_questionContextId+" does not exist in AjaxQuestionContextProblemListViewGuiDriver.questionContextLoaded();");handleCaughtPLError(myError);}
var myInteractoinGrabber=new QuestionInteractionsByContextGrabber();myInteractoinGrabber.setCallbackUponSuccess(questionInteractionsLoaded);myInteractoinGrabber.setCallbackUponFailure(handleCaughtPLError);myInteractoinGrabber.loadInteractionsByQuestionContextId(_questionContextId);}
this.display=function(forceRefreshFromServer)
{myQcGrabber=new QuestionContextGrabber();myQcGrabber.setCallbackUponSuccess(questionContextLoaded);myQcGrabber.setCallbackUponFailure(handleCaughtPLError);myQcGrabber.setSearchMode(myQcGrabber.searchModeById);myQcGrabber.setSearchIds(_questionContextId);if(forceRefreshFromServer==true)
{myQcGrabber.setForceDownloadFromServer(true);}
myQcGrabber.query();}}
function AjaxQuestionHistoryGuiDriver()
{var _this=this;displayBlankMyHistory=function()
{var html='<h2>View My History</h2>';html+='<p><b>Your history of practice tests and quizzes is blank.</b></p>';html+='<p><a href="" onclick="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNt(); return false;"><b>New Test</b></a>&nbsp;&middot;&nbsp;<a href="?state=qc-cn" onclick="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcCn(); return false;"><b>New Quiz</b></a></p>';html+='<p>If you believe you are receiving this page in error, please visit the help section.</p>';document.getElementById("ajaxq-mode-container-mh-qcl-contents").innerHTML=html;StatusManager.pageChangeCompleted();}
displayMyHistoryWithCurrentArraySort=function()
{if(QuestionContextRepositoryManager._questionContextRepository.length==0)
{displayBlankMyHistory();return false;}
var html='';html+='<table class="ajaxq-list-results-container">';html+='<tr>';html+='<th>Created</th>';html+='<th>Title</th>';html+='<th>Type</th>';html+='<th>Sharable Link</th>';html+='</tr>';var oddRow=true;for(var foundQuestionContextId in QuestionContextRepositoryManager._questionContextRepository)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(foundQuestionContextId))
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(foundQuestionContextId);var questionContextId=questionContext.getQuestionContextId();if(oddRow)
{html+='<tr class="offset-a">';oddRow=false;}
else
{html+='<tr class="offset-b">';oddRow=true;}
html+='<td>'+GlobalVariables.formatUtcUnixTimestampDisplayAsText(questionContext.getCreatedTimestamp())+'</td>';html+='<td><a href="?state=qc-pl&question_context_id='+questionContextId+'" onclick="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcPl('+questionContextId+'); return false;">'+questionContext.getQuestionContextTitle()+'</a></td>';html+='<td>'
if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_STATIC_QUIZ)
{html+='Quiz';questionContextTypeString='quiz';}
else if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_QUIZ)
{html+='CAT&nbsp;Quiz';questionContextTypeString='quiz';}
else if(questionContext.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL)
{html+='Practice&nbsp;Test';questionContextTypeString='practice test';}
else
{html+='Quiz';questionContextTypeString='quiz';ErrorLogger.logWarning("Unrecognized Question Context Type in ErrorLogger.displayMyHistoryWithCurrentArraySort(); Context Type = "+questionContext.getQuestionContextType());}
html+='</td>';var myGetUrlGui=new GetUrlGui();var sharableUrl=GlobalVariables.getAjaxQuestionContextShareDirectory()+'?state=qc-pl&question_context_id='+questionContextId;myGetUrlGui.setSharableUrl(sharableUrl);myGetUrlGui.setTitle("Get Link to Question List");myGetUrlGui.setInstructionText("Sharing the above link with your friends will enable them to view your results. Copying and pasting the HTML code below will create a link to a page where anyone can view your results.");myGetUrlGui.setAnchorText("GMAT "+questionContextTypeString+" results");myGetUrlGui.setOpenLeft(true);html+='<td>'+myGetUrlGui.getGuiHtml()+'</td>';html+='</tr>';}}
html+='</table>';document.getElementById("ajaxq-mode-container-mh-qcl-contents").innerHTML=html;StatusManager.pageChangeCompleted();}
this.displayMyHistory=function()
{myQuestionContextGrabber=new QuestionContextGrabber();myQuestionContextGrabber.setSearchMode(myQuestionContextGrabber.searchModeByAuthentication);myQuestionContextGrabber.setCallbackUponSuccess(displayMyHistoryWithCurrentArraySort);myQuestionContextGrabber.setCallbackUponFailure(handleCaughtMyHistoryError);myQuestionContextGrabber.query();}
handleCaughtMyHistoryError=function(e)
{if(e instanceof NoContentFound)
{displayBlankMyHistory();}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_MHQCL);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxQuestionContextProblemListViewGuiDriver.handleCaughtPLError()');StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_MHQCL);}}}
function AjaxQuestionFeedbackGuiDriver()
{var _this=this;var submittedAlready=false;handleFeedbackSubmissionError=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}
else
{document.getElementById("feedback-message-notification-contents").innerHTML="It appears that an error occurred in the process of communicating with the server and saving your feedback. Please refresh the page and try again. If this problem persists, please contact us.";document.getElementById("feedback-message-notification-contents").className="qc-cn-message-notification-contents-error";ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxQuestionFeedbackGuiDriver.AjaxQuestionFeedbackGuiDriver()");}}
receiveServerResponseFeedback=function(responseText)
{if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{submittedAlready=false;document.getElementById("feedback-message-notification-contents").innerHTML="Feedback Received! Thanks.";document.getElementById("feedback-message-notification-contents").className="qc-cn-message-notification-contents-success";}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_USER_ID||responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_COOKIES)
{document.getElementById("feedback-message-notification-contents").innerHTML="It appears that an error occurred in the process of communicating with the server and saving your feedback. Please refresh the page and try again. If this problem persists, please contact us.";document.getElementById("feedback-message-notification-contents").className="qc-cn-message-notification-contents-error";}
else
{var myError=new AjaxServerError("Attempt to save feedback failed. ResponseText = "+responseText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);handleFeedbackSubmissionError(myError);}}
this.receiveFeedbackSubmitButtonClick=function()
{if(submittedAlready)
{return true;}
var additionalFeedback=document.getElementById("txt_additional_feedback").value;var usability=document.getElementsByName("usability");var usabilityValue;for(var i=0;i<usability.length;i++)
{if(usability.item(i).checked==true)
{usabilityValue=usability.item(i).value;}}
var resemblance=document.getElementsByName("resemblance");var resemblanceValue;for(var i=0;i<resemblance.length;i++)
{if(resemblance.item(i).checked==true)
{resemblanceValue=resemblance.item(i).value;}}
try
{var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(receiveServerResponseFeedback);myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(handleFeedbackSubmissionError);myAjaxCoreQuestionContextRequest.createXHR().open("GET","insertFeedback.php?additional_feedback="+escape(additionalFeedback)+"&resemblance="+resemblanceValue+"&usability="+usabilityValue);myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);}
catch(e)
{var myError=new AjaxServerError("Attempt to save feedback failed. ResponseText = "+responseText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);handleFeedbackSubmissionError(myError);}}}
function AjaxQuestionContextCreatorGuiDriver()
{var _this=this;var newQuestionContextQuestionListId;var newQuestionContextTitle;var newQuestionContextId;var submittedAlready=false;this.guiLoaded=function()
{clearGuiDisplay();}
clearGuiDisplay=function()
{if(document.getElementById("qc_cn_input_problem_set_name")!=null&&document.getElementById("qc_cn_input_problem_set_name")!=undefined&&document.getElementById("qc-cn-message-notification-contents")!=null&&document.getElementById("qc-cn-message-notification-contents")!=undefined)
{document.getElementById("qc_cn_input_problem_set_name").value="My New Quiz";document.getElementById("qc-cn-message-notification-contents").innerHTML="";var i=0;while(i<document.getElementsByName("listId").length)
{document.getElementsByName("listId")[i].checked=false;i++;}}
submittedAlready=false;StatusManager.pageChangeCompleted();}
this.receiveQuestionListSelected=function(listId)
{if(listId!=undefined&&listId!=null)
{newQuestionContextQuestionListId=listId;}}
this.receiveCreateNewQuestionContextButtonClick=function()
{if(submittedAlready)
{return true;}
newQuestionContextTitle=document.getElementById("qc_cn_input_problem_set_name").value;newQuestionContextId=document.getElementById("qc_cn_new_question_context_id").value;if(newQuestionContextQuestionListId==undefined||newQuestionContextQuestionListId==null)
{document.getElementById("qc-cn-message-notification-contents").innerHTML="You must select a list of questions to work.";document.getElementById("qc-cn-message-notification-contents").className="qc-cn-message-notification-contents-error";return false;}
var selectedQuestionListId=newQuestionContextQuestionListId;if(this.validateProblemSetTitle()!=true)
{return false;}
submittedAlready=true;document.getElementById("qc-cn-message-notification-contents").innerHTML="Processing...Please wait.";document.getElementById("qc-cn-message-notification-contents").className="qc-cn-message-notification-contents-success";createNewQuestionContext(newQuestionContextId,selectedQuestionListId,newQuestionContextTitle);}
this.validateProblemSetTitle=function()
{newQuestionContextTitle=document.getElementById("qc_cn_input_problem_set_name").value;if(newQuestionContextTitle==undefined||newQuestionContextTitle==null||newQuestionContextTitle.length<1)
{document.getElementById("qc-cn-message-notification-contents").innerHTML="You must specify a title for the quiz.<br />Please enter a title in the \"Title Your New Quiz\" field.";document.getElementById("qc-cn-message-notification-contents").className="qc-cn-message-notification-contents-error";return false;}
var regExpTitle=new RegExp("[^A-z ]","i");if(newQuestionContextTitle.search(regExpTitle)!=-1)
{document.getElementById("qc-cn-message-notification-contents").innerHTML="Title should consist of letters and spaces only.";document.getElementById("qc-cn-message-notification-contents").className="qc-cn-message-notification-contents-error";return false;}
document.getElementById("qc-cn-message-notification-contents").innerHTML="";return true;}
handleCreateNewQuestionContextError=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}
else
{document.getElementById("qc-cn-message-notification-contents").innerHTML="It appears that an error occurred in the process of communicating with the server and saving your new quiz. Please refresh the page and try again. If this problem persists, please contact us.";document.getElementById("qc-cn-message-notification-contents").className="qc-cn-message-notification-contents-error";ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxQuestionContextCreatorGuiDriver.createNewQuestionContext()","New QL ID: "+newQuestionContextQuestionListId+" New QC Title: "+newQuestionContextTitle+" New Context ID: "+newQuestionContextId);}}
receiveServerResponse=function(responseText)
{if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{submittedAlready=false;document.getElementById("qc-cn-message-notification-contents").innerHTML="";myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcPl(newQuestionContextId);}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_USER_ID||responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_COOKIES)
{document.getElementById("qc-cn-message-notification-contents").innerHTML="It appears that you do not have cookies enabled in your internet browser. Without cookies, it is not possible to create a new quiz.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_DUPLICATE_ALREADY_EXISTS)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="It appears that you have already created this quiz. If you would like to create an entirely new quiz, <a href=\""+GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+"/?state=qc-cn\" onclick=\"myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcCn(); return false;\">click here</a>. If you would like to view or work your previous quizzes, view <a href=\""+GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+"/?state=mh-qcl\" onclick=\"myAjaxSessionGuiDriver.receiveRequestForStateChangeToMhQcl(); return false;\">My History</a>.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";}
else
{var myError=new AjaxServerError("Attempt to create new question context (quiz) failed. ResponseText = "+responseText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);handleCreateNewQuestionContextError(myError);}}
createNewQuestionContext=function(questionContextId,listId,contextTitle)
{try
{var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(receiveServerResponse);myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(handleCreateNewQuestionContextError);myAjaxCoreQuestionContextRequest.createXHR().open("GET","insertNewQuestionContext.php?question_context_id="+questionContextId+"&question_list_id="+listId+"&question_context_title="+contextTitle+"&question_context_type="+GlobalVariables.TYPE_STATIC_QUIZ+"&permissions="+GlobalVariables.SHARE_PERMISSIONS_PUBLIC_URL);myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);}
catch(e)
{handleCreateNewQuestionContextError(e);}}}
function AjaxNtCreatorHandler()
{var newQuestionContextId;var newQuestionContextTitle;var awaEnabled;var permissions;var questionContextType;var questionListIds;var maxQuantQuestionsNum;var maxVerbalQuestionsNum;var maxQuantSeconds;var maxVerbalSeconds;this.receiveLaunchNewTestButtonClick=function()
{var ststus=this.validateTestTitle();if(ststus==false)
{return false;}
newQuestionContextTitle=document.getElementById("qc_nt_ancillary_setup_title").value;if(document.getElementById("qc-nt-ancillary-setup-awa-1")!=undefined&&document.getElementById("qc-nt-ancillary-setup-awa-1")!=null)
{awaEnabled=document.getElementById("qc-nt-ancillary-setup-awa-1").checked;}
else
{awaEnabled=false;}
if(document.getElementById("qc_nt_permissions")!=null&&document.getElementById("qc_nt_permissions")!=undefined)
{permissions=document.getElementById("qc_nt_permissions").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for permissions");return false;}
if(document.getElementById("qc_nt_max_quant_questions")!=null&&document.getElementById("qc_nt_max_quant_questions")!=undefined)
{maxQuantQuestionsNum=document.getElementById("qc_nt_max_quant_questions").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for qc_nt_max_quant_questions");return false;}
if(document.getElementById("qc_nt_max_verbal_questions")!=null&&document.getElementById("qc_nt_max_verbal_questions")!=undefined)
{maxVerbalQuestionsNum=document.getElementById("qc_nt_max_verbal_questions").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for qc_nt_max_quant_questions");return false;}
if(document.getElementById("qc_nt_question_context_type")!=null&&document.getElementById("qc_nt_question_context_type")!=undefined)
{questionContextType=document.getElementById("qc_nt_question_context_type").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for question context type");return false;}
if(document.getElementById("qc_nt_new_question_context_id")!=null&&document.getElementById("qc_nt_new_question_context_id")!=undefined)
{newQuestionContextId=document.getElementById("qc_nt_new_question_context_id").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for question context id");return false;}
if(document.getElementById("qc_nt_question_list_id")!=null&&document.getElementById("qc_nt_question_list_id")!=undefined)
{questionListIds=document.getElementById("qc_nt_question_list_id").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for question list ids");return false;}
if(document.getElementById("qc_nt_max_quant_seconds")!=null&&document.getElementById("qc_nt_max_quant_seconds")!=undefined)
{maxQuantSeconds=(document.getElementById("qc_nt_max_quant_seconds").value*60);}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for qc_nt_max_quant_questions");return false;}
if(document.getElementById("qc_nt_max_awa_seconds")!=null&&document.getElementById("qc_nt_max_awa_seconds")!=undefined)
{maxAwaSeconds=document.getElementById("qc_nt_max_awa_seconds").value;}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for qc_nt_max_quant_questions");return false;}
if(document.getElementById("qc_nt_max_verbal_seconds")!=null&&document.getElementById("qc_nt_max_verbal_seconds")!=undefined)
{maxVerbalSeconds=(document.getElementById("qc_nt_max_verbal_seconds").value*60);}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);ErrorLogger.logError("Error occurred in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); no value for qc_nt_max_quant_questions");return false;}
var additionalInformationString='';additionalInformationString+='max_verbal_question_num: '+maxVerbalQuestionsNum+';';additionalInformationString+=' max_quant_question_num: '+maxQuantQuestionsNum+';';additionalInformationString+=' max_quant_seconds: '+maxQuantSeconds+';';additionalInformationString+=' max_verbal_seconds: '+maxVerbalSeconds+';';additionalInformationString+=' max_awa_seconds: '+maxAwaSeconds+';';if(awaEnabled==true)
{additionalInformationString+=' awa_enabled: 1;';}
else
{additionalInformationString+=' awa_enabled: 0;';}
handleCreateNewQuestionContextTestError=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_LIST_QCPL);}
else
{document.getElementById("qc-nt-message-notification-contents").innerHTML="It appears that an error occurred in the process of communicating with the server and saving your new practice test. Please refresh the page and try again. If this problem persists, please contact us.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxNtCreatorHandler.receiveLaunchNewTestButtonClick(); Error thrown in handleCreateNewQuestionContextTestError()","New QC ID: "+newQuestionContextId+" New QC Title: "+newQuestionContextTitle+" Additional Information: "+additionalInformationString);StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);if(document.getElementById("qc-nt-launch-buttom")!=null&&document.getElementById("qc-nt-launch-buttom")!=undefined&&document.getElementById("qc-nt-launch-buttom").disabled==true)
{document.getElementById("qc-nt-launch-buttom").removeAttribute("disabled");}}}
receiveQcNtCnServerResponse=function(responseText)
{if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="";myAjaxPracticeTestDriver.loadTest(newQuestionContextId);}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_USER_ID||responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_NO_COOKIES)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="It appears that you do not have cookies enabled in your internet browser. Without cookies, it is not possible to create a new test.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";if(document.getElementById("qc-nt-launch-buttom")!=null&&document.getElementById("qc-nt-launch-buttom")!=undefined&&document.getElementById("qc-nt-launch-buttom").disabled==true)
{document.getElementById("qc-nt-launch-buttom").removeAttribute("disabled");}}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_PARAM_INVALID)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="It appears that one of the parameters you supplied is not valid. Please ensure your test title does not have an apostrophe. Please ensure your other parameters are valid.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";if(document.getElementById("qc-nt-launch-buttom")!=null&&document.getElementById("qc-nt-launch-buttom")!=undefined&&document.getElementById("qc-nt-launch-buttom").disabled==true)
{document.getElementById("qc-nt-launch-buttom").removeAttribute("disabled");}}
else if(responseText==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_ERR_DUPLICATE_ALREADY_EXISTS)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="It appears that you have already created this practice test. If you would like to create an entirely new practice test, <a href=\""+GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+"/\" onclick=\"myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNt(); return false;\">click here</a>. If you would like to view or work your previous practice tests, view <a href=\""+GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+"/?state=mh-qcl\" onclick=\"myAjaxSessionGuiDriver.receiveRequestForStateChangeToMhQcl(); return false;\">My History</a>.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";if(document.getElementById("qc-nt-launch-buttom")!=null&&document.getElementById("qc-nt-launch-buttom")!=undefined&&document.getElementById("qc-nt-launch-buttom").disabled==true)
{document.getElementById("qc-nt-launch-buttom").removeAttribute("disabled");}}
else
{var myError=new AjaxServerError("Attempt to create new question context (practice test) failed. ResponseText = "+responseText);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);handleCreateNewQuestionContextTestError(myError);}}
qcNtCreateNewQuestionContext=function()
{try
{var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(receiveQcNtCnServerResponse);myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(handleCreateNewQuestionContextTestError);myAjaxCoreQuestionContextRequest.createXHR().open("GET","insertNewQuestionContext?question_context_id="+newQuestionContextId+"&question_context_title="+newQuestionContextTitle+"&question_context_type="+questionContextType+"&permissions="+permissions+"&question_list_id="+questionListIds+"&additional_information="+escape(additionalInformationString));myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);if(document.getElementById("qc-nt-launch-buttom")!=null&&document.getElementById("qc-nt-launch-buttom")!=undefined)
{document.getElementById("qc-nt-launch-buttom").setAttribute("disabled","disabled");}}
catch(e)
{handleCreateNewQuestionContextTestError(e);}}
qcNtCreateNewQuestionContext();}
this.validateTestTitle=function()
{var newQuestionContextTitle=document.getElementById("qc_nt_ancillary_setup_title").value;if(newQuestionContextTitle==undefined||newQuestionContextTitle==null||newQuestionContextTitle.length<1)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="You must specify a title for the practice test.<br />Please enter a title in the \"Title Your New Practice Test\" field.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";return false;}
var regExpTitle=new RegExp("[^A-z ]","i");if(newQuestionContextTitle.search(regExpTitle)!=-1)
{document.getElementById("qc-nt-message-notification-contents").innerHTML="Title should consist of letters and spaces only.";document.getElementById("qc-nt-message-notification-contents").className="qc-nt-message-notification-contents-error";return false;}
document.getElementById("qc-nt-message-notification-contents").innerHTML="";return true;}
this.receiveAwaChecked=function(inputVal)
{awaEnabled=inputVal;}}
function AjaxPracticeTestDriver()
{var _questionContextId;var _this=this;var _awaIssueTimeRemaining;var _awaArgumentTimeRemaining;var _awaIssueClockReference;var _awaArgumentClockReference;var _verbalTimeRemaining;var _quantTimeRemaining;var _verbalClockReference;var _quantClockReference;this.loadTest=function(inputQuestionContextId)
{StatusManager.noLockPageChangeInitiated();this.disableEntireTestClockUpdateReferences();handleCaughtLTError=function(e)
{if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else
{ErrorLogger.logCaughtError(e,'error occurredin AjaxPracticeTestDriver.loadTest(); questionContextId = '+inputQuestionContextId);StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_QCNTPV);}}
stateOfPracticeTestDetermined=function(stateOfTest)
{_questionContextId=inputQuestionContextId;_this.setPracticeTestCurrentState(stateOfTest);_this.updateGui();}
GlobalVariables.determineStateOfPracticeTest(inputQuestionContextId,stateOfPracticeTestDetermined,handleCaughtLTError);}
this.disableEntireTestClockUpdateReferences=function()
{window.clearInterval(_quantClockReference);window.clearInterval(_verbalClockReference);window.clearInterval(_awaIssueClockReference);window.clearInterval(_awaArgumentClockReference);}
this.getNextCatQuestion=function()
{var practiceTestState=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getCurrentPracticeTestState();if(practiceTestState==GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN)
{errorRetrievingNextQuantQuestionId=function(e)
{}
nextQuantQuestionIdReceived=function(qId)
{if(qId==GlobalVariables.END_OF_QUESTION_LIST)
{_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED);_this.updateGui();}
else
{_this.calculateTimeRemainingOnQuantUponQuestionChange();myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqvCat(_questionContextId,questionListId,qId);}}
var questionListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT)+new String(_questionContextId));QuestionListRepositoryManager.getListById(questionListId).getAbsoluteNextCatQuestionId(_questionContextId,nextQuantQuestionIdReceived,errorRetrievingNextQuantQuestionId);}
else if(practiceTestState==GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED)
{this.updateGui();}
else if(practiceTestState==GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN)
{errorRetrievingNextVerbalQuestionId=function(e)
{}
nextVerbalQuestionIdReceived=function(qId)
{if(qId==GlobalVariables.END_OF_QUESTION_LIST)
{_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED);_this.updateGui();}
else
{myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqvCat(_questionContextId,questionListId,qId);_this.calculateTimeRemainingOnVerbalUponQuestionChange();}}
var questionListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT)+new String(_questionContextId));QuestionListRepositoryManager.getListById(questionListId).getAbsoluteNextCatQuestionId(_questionContextId,nextVerbalQuestionIdReceived,errorRetrievingNextVerbalQuestionId);}
else if(practiceTestState==GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED)
{myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtCompleted(_questionContextId);}
else
{}}
this.setPracticeTestCurrentState=function(inputState)
{QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).setCurrentPracticeTestState(inputState);GlobalVariables.setAdditionalInformationVariableForQuestionContext(_questionContextId,'current_state',inputState);this.saveCurrentQuestionState();}
this.saveCurrentQuestionState=function()
{handleSateStateSuccess=function(html)
{if(html==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{}
else
{}}
handleSaveStateError=function(e)
{}
var currentState=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getCurrentPracticeTestState();var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(handleSateStateSuccess);myAjaxCoreRequest.setOnFailureCallbackfunction(handleSaveStateError);myAjaxCoreRequest.createXHR().open("GET","savePracticeTestCurrentState?question_context_id="+_questionContextId+"&current_state="+currentState);myAjaxCoreRequest.getOpenXHR().send(null);}
this.instantiateQuantClock=function()
{this.disableEntireTestClockUpdateReferences();_quantClockReference=window.setInterval(_this.updateQuantClock,1000);_this.calculateTimeRemainingOnQuantUponQuestionChange();myQcSqvDriver.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(_quantTimeRemaining));}
this.calculateTimeRemainingOnQuantUponQuestionChange=function()
{if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_quant_seconds')!=null)
{_quantTimeRemaining=parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_quant_seconds'))-_this.calculateTimeTakenOnSubSection(GlobalVariables.CAT_SECTION_QUANT);}
else
{_quantTimeRemaining=GlobalVariables.SECONDS_AVAILABLE_ON_QUANT-_this.calculateTimeTakenOnSubSection(GlobalVariables.CAT_SECTION_QUANT);}}
this.updateQuantClock=function()
{if(QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN)
{return false;}
if(document.getElementById("ajaxq-star-question-active-cat")==undefined||document.getElementById("ajaxq-star-question-active-cat").className!="ajaxq-question-button-enabled"||document.getElementById("ajaxq-mode-container-qc-sqv")==undefined||document.getElementById("ajaxq-mode-container-qc-sqv").className!="ajaxq-element-inline")
{return false;}
_quantTimeRemaining=_quantTimeRemaining-1;myQcSqvDriver.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(_quantTimeRemaining));if(_quantTimeRemaining<=0)
{window.clearInterval(_quantClockReference);_this.updateGuiUponTimeExpired();_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED);StatusManager.displayWarningMessage('Time on the quantitative section expired.');var questionListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT)+new String(_questionContextId));var currentQuestionNum=QuestionListRepositoryManager.getListById(questionListId).getCurrentQuestionNumber();QuestionListRepositoryManager.getListById(questionListId).setMaximumQuestionCount(currentQuestionNum);_this.updateAdditionalInformationUponTimeExpired('max_quant_question_num',(currentQuestionNum-1));myQcSqvDriver.removeMostRecentAjaxQuestionInteractionFromCache();_this.updateGui();}}
this.updateAdditionalInformationUponTimeExpired=function(variableToSet,valueToSet)
{errorUpdatingAdditionalInformation=function(e)
{}
additionalInformationUpdated=function(response)
{if(response!=GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS)
{errorUpdatingAdditionalInformation();}}
GlobalVariables.setAdditionalInformationVariableForQuestionContext(_questionContextId,variableToSet,valueToSet);var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(additionalInformationUpdated);myAjaxCoreRequest.setOnFailureCallbackfunction(errorUpdatingAdditionalInformation);myAjaxCoreRequest.createXHR().open("GET","updateQcAdditionalInformation?question_context_id="+_questionContextId+"&variable="+escape(variableToSet)+"&value="+escape(valueToSet));myAjaxCoreRequest.getOpenXHR().send(null);}
this.updateGuiUponTimeExpired=function()
{myQcSqvDriver.disableRadioBoxes();}
this.instantiateVerbalClock=function()
{this.disableEntireTestClockUpdateReferences();_verbalClockReference=window.setInterval(_this.updateVerbalClock,1000);this.calculateTimeRemainingOnVerbalUponQuestionChange();myQcSqvDriver.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(_verbalTimeRemaining));}
this.calculateTimeRemainingOnVerbalUponQuestionChange=function()
{if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_verbal_seconds')!=null)
{_verbalTimeRemaining=parseInt(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_verbal_seconds'))-_this.calculateTimeTakenOnSubSection(GlobalVariables.CAT_SECTION_VERBAL);}
else
{_verbalTimeRemaining=GlobalVariables.SECONDS_AVAILABLE_ON_VERBAL-_this.calculateTimeTakenOnSubSection(GlobalVariables.CAT_SECTION_VERBAL);}}
this.updateVerbalClock=function()
{if(QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getCurrentPracticeTestState()!=GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN)
{return false;}
if(document.getElementById("ajaxq-star-question-active-cat")==undefined||document.getElementById("ajaxq-star-question-active-cat").className!="ajaxq-question-button-enabled"||document.getElementById("ajaxq-mode-container-qc-sqv")==undefined||document.getElementById("ajaxq-mode-container-qc-sqv").className!="ajaxq-element-inline")
{return false;}
_verbalTimeRemaining=_verbalTimeRemaining-1;myQcSqvDriver.setTimeCounterHtml(GlobalVariables.formatTimeToFinalAnswerDisplay(_verbalTimeRemaining));if(_verbalTimeRemaining<=0)
{window.clearInterval(_verbalTimeRemaining);_this.updateGuiUponTimeExpired();_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED);StatusManager.displayWarningMessage('Time on the verbal section expired.');var questionListId=parseInt(new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT)+new String(_questionContextId));var currentQuestionNum=QuestionListRepositoryManager.getListById(questionListId).getCurrentQuestionNumber();QuestionListRepositoryManager.getListById(questionListId).setMaximumQuestionCount(currentQuestionNum);_this.updateAdditionalInformationUponTimeExpired('max_verbal_question_num',(currentQuestionNum-1));myQcSqvDriver.removeMostRecentAjaxQuestionInteractionFromCache();_this.updateGui();}}
this.calculateTimeTakenOnSubSection=function(subSection)
{if(AjaxQuestionInteractionRepositoryManager._interactionRepository.length==undefined||AjaxQuestionInteractionRepositoryManager._interactionRepository.length==0)
{return 0;}
if(subSection!=GlobalVariables.CAT_SECTION_QUANT&&subSection!=GlobalVariables.CAT_SECTION_VERBAL)
{subSection==GlobalVariables.CAT_SECTION_QUANT;ErrorLogger.logError("");}
var searchIn=new Array();if(subSection==GlobalVariables.CAT_SECTION_QUANT)
{searchIn.push("PS");searchIn.push("DS");}
else
{searchIn.push("RC");searchIn.push("CR");searchIn.push("SC");}
var secondsElapsed=new Number(0);for(interaction in AjaxQuestionInteractionRepositoryManager._interactionRepository)
{var ajaxqInteraction=AjaxQuestionInteractionRepositoryManager._interactionRepository[interaction];if(typeof ajaxqInteraction.getQuestionContextId=='function'&&parseInt(ajaxqInteraction.getQuestionContextId())==parseInt(_questionContextId)&&ajaxqInteraction.getIsFinalized())
{if(QuestionRepositoryManager.doesQuestionExist(parseInt(ajaxqInteraction.getQuestionId())))
{var category=QuestionRepositoryManager.getQuestionById(ajaxqInteraction.getQuestionId()).getQuestionCategoryType().toLowerCase();if(searchIn.toString().toLowerCase().indexOf(category)!=-1)
{secondsElapsed+=parseInt(ajaxqInteraction.getSecondsToFinalAnswer());}}
else if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(parseInt(ajaxqInteraction.getQuestionId())))
{var category=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(ajaxqInteraction.getQuestionId()).getQuestionCategoryType().toLowerCase();if(searchIn.toString().toLowerCase().indexOf(category)!=-1)
{secondsElapsed+=parseInt(ajaxqInteraction.getSecondsToFinalAnswer());}}}}
return parseInt(secondsElapsed);}
this.updateAwaIssueClock=function()
{if(document.getElementById("time-remaining-awa-issue")!=null&&document.getElementById("time-remaining-awa-issue")!=undefined)
{if(_awaIssueTimeRemaining==null)
{if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_awa_seconds')!=null)
{_awaIssueTimeRemaining=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_awa_seconds');}
else
{_awaIssueTimeRemaining=GlobalVariables.SECONDS_AVAILABLE_ON_AWA;}}
_awaIssueTimeRemaining=_awaIssueTimeRemaining-1;document.getElementById("time-remaining-awa-issue").innerHTML=GlobalVariables.formatTimeToFinalAnswerDisplay(_awaIssueTimeRemaining);if(_awaIssueTimeRemaining<=0)
{window.clearInterval(_awaIssueClockReference);var displayText="The time alloted for writing this essay expired.";if(document.getElementById("awa-issue-notification-contents")!=null&&document.getElementById("awa-issue-notification-contents")!=undefined)
{document.getElementById("awa-issue-notification-contents").innerHTML=displayText;document.getElementById("awa-issue-notification-contents").className="ajaxq-inline-error-message";}
if(document.getElementById("awa-issue-response")!=null&&document.getElementById("awa-issue-response")!=undefined)
{document.getElementById("awa-issue-response").readOnly=true;}}}}
this.instantiateAwaIssueClock=function()
{_this.disableEntireTestClockUpdateReferences();_awaIssueClockReference=window.setInterval(_this.updateAwaIssueClock,1000);}
this.instantiateAwaArgumentClock=function()
{_this.disableEntireTestClockUpdateReferences();_awaArgumentClockReference=window.setInterval(_this.updateAwaArgumentClock,1000);}
this.updateAwaArgumentClock=function()
{if(document.getElementById("time-remaining-awa-argument")!=null&&document.getElementById("time-remaining-awa-argument")!=undefined)
{if(_awaArgumentTimeRemaining==null)
{if(GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_awa_seconds')!=null)
{_awaArgumentTimeRemaining=GlobalVariables.getAdditionalInformationVariableForQuestionContext(_questionContextId,'max_awa_seconds');}
else
{_awaArgumentTimeRemaining=GlobalVariables.SECONDS_AVAILABLE_ON_AWA;}}
_awaArgumentTimeRemaining=_awaArgumentTimeRemaining-1;document.getElementById("time-remaining-awa-argument").innerHTML=GlobalVariables.formatTimeToFinalAnswerDisplay(_awaArgumentTimeRemaining);if(_awaArgumentTimeRemaining<=0)
{window.clearInterval(_awaArgumentClockReference);var displayText="The time alloted for writing this essay expired.";if(document.getElementById("awa-argument-notification-contents")!=null&&document.getElementById("awa-argument-notification-contents")!=undefined)
{document.getElementById("awa-argument-notification-contents").innerHTML=displayText;document.getElementById("awa-argument-notification-contents").className="ajaxq-inline-error-message";}
if(document.getElementById("awa-argument-response")!=null&&document.getElementById("awa-argument-response")!=undefined)
{document.getElementById("awa-argument-response").readOnly=true;}}}}
this.completedAwaIssue=function()
{successfullyInsertedAwaArgument=function(html)
{if(html==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS||html==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS_ALREADY_EXISTS)
{_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_AWA_ISSUE_COMPLETED);_this.updateGui();}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_ESSAY);}}
errorInsertingAwaArgument=function(e)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_ESSAY);ErrorLogger.logCaughtError(e,"Occurred in AjaxPracticeTestDriver.completedAwaIssue()");}
if(document.getElementById("awa-issue-response")!=null&&document.getElementById("awa-issue-response")!=undefined)
{var requestUrl="insertAwaComponent?qcId="+_questionContextId+"&type="+GlobalVariables.AWA_TYPE_ISSUE_ESSAY;requestUrl+="&response="+document.getElementById("awa-issue-response").value;var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(successfullyInsertedAwaArgument);myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(errorInsertingAwaArgument);myAjaxCoreQuestionContextRequest.createXHR().open("GET",requestUrl);myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);}
else
{var e=new Error("DOM ID of 'awa-issue-response' did not exist");errorInsertingAwaArgument(e);}}
this.completedAwaArgument=function()
{successfullyInsertedAwaArgument=function(html)
{if(html==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS||html==GlobalVariables.AJAX_SERVER_OPERATION_STATUS_SUCCESS_ALREADY_EXISTS)
{_this.setPracticeTestCurrentState(GlobalVariables.PRACTICE_TEST_STATE_AWA_ARGUMENT_COMPLETED);_this.updateGui();}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_ESSAY);}}
errorInsertingAwaArgument=function(e)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_ESSAY);ErrorLogger.logCaughtError(e,"Occurred in AjaxPracticeTestDriver.completedAwaArgument()");}
if(document.getElementById("awa-argument-response")!=null&&document.getElementById("awa-argument-response")!=undefined)
{var requestUrl="insertAwaComponent?qcId="+_questionContextId+"&type="+GlobalVariables.AWA_TYPE_ARGUMENT_ESSAY;requestUrl+="&response="+document.getElementById("awa-argument-response").value;var myAjaxCoreQuestionContextRequest=new AjaxCore();myAjaxCoreQuestionContextRequest.setOnReadySuccessCallbackfunction(successfullyInsertedAwaArgument);myAjaxCoreQuestionContextRequest.setOnFailureCallbackfunction(errorInsertingAwaArgument);myAjaxCoreQuestionContextRequest.createXHR().open("GET",requestUrl);myAjaxCoreQuestionContextRequest.getOpenXHR().send(null);}
else
{var e=new Error("DOM ID of 'awa-argument-response' did not exist");errorInsertingAwaArgument(e);}}
this.updateGui=function()
{var practiceTestState=parseInt(QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getCurrentPracticeTestState());switch(practiceTestState)
{case GlobalVariables.PRACTICE_TEST_STATE_AWA_ARGUMENT_BEGUN:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_AWA_ARGUMENT,_this.instantiateAwaArgumentClock);break;case GlobalVariables.PRACTICE_TEST_STATE_AWA_ARGUMENT_COMPLETED:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_AWA_ISSUE_INSTRUCTIONS);break;case GlobalVariables.PRACTICE_TEST_STATE_AWA_ISSUE_BEGUN:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_AWA_ISSUE,_this.instantiateAwaIssueClock);break;case GlobalVariables.PRACTICE_TEST_STATE_AWA_ISSUE_COMPLETED:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_QUANT_INSTRUCTIONS);break;case GlobalVariables.PRACTICE_TEST_STATE_QUANT_BEGUN:_this.getNextCatQuestion();_this.instantiateQuantClock();break;case GlobalVariables.PRACTICE_TEST_STATE_QUANT_COMPLETED:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_VERBAL_INSTRUCTIONS);break;case GlobalVariables.PRACTICE_TEST_STATE_VERBAL_BEGUN:_this.getNextCatQuestion();_this.instantiateVerbalClock();break;case GlobalVariables.PRACTICE_TEST_STATE_TEST_COMPLETED:myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtCompleted(_questionContextId);break;case GlobalVariables.PRACTICE_TEST_STATE_NOT_BEGUN:default:if(GlobalVariables.isAwaEnabledInPracticeContext(_questionContextId))
{myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_AWA_ARGUMENT_INSTRUCTIONS);}
else
{myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary(GlobalVariables.QC_NT_ANCILLARY_STATE_QUANT_INSTRUCTIONS);}
break;}
StatusManager.pageChangeCompleted();}}
function AjaxSessionGuiDriver()
{var _this=this;this.NO_PARENT_NODE=0;this.STATE_PP_HOME=1;this.STATE_MH_QCL=2;this.STATE_QC_CN=3;this.STATE_QC_PL=4;this.STATE_QC_SQV=5;this.STATE_FAQ=6;this.STATE_QC_NT=7;this.STATE_FEEDBACK=8;this.STATE_QC_PT_RESULTS=9;this._potentialStates=new Array();this._potentialStates[this.STATE_PP_HOME]=new Array();this._potentialStates[this.STATE_PP_HOME]["title"]="GMAT Prep";this._potentialStates[this.STATE_PP_HOME]["onclickAction"]="";this._potentialStates[this.STATE_PP_HOME]["url"]="";this._potentialStates[this.STATE_PP_HOME]["parent"]=this.NO_PARENT_NODE;this._potentialStates[this.STATE_QC_NT]=new Array();this._potentialStates[this.STATE_QC_NT]["title"]="GMAT Practice Test (Beta)";this._potentialStates[this.STATE_QC_NT]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtAncillary("+GlobalVariables.QC_NT_ANCILLARY_STATE_NEW_TEST+"); return false;";this._potentialStates[this.STATE_QC_NT]["url"]=GlobalVariables.getPracticeTestDirectory()+"/";this._potentialStates[this.STATE_QC_NT]["parent"]=this.STATE_PP_HOME;this._potentialStates[this.STATE_MH_QCL]=new Array();this._potentialStates[this.STATE_MH_QCL]["title"]="My History";this._potentialStates[this.STATE_MH_QCL]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToMhQcl(); return false;";this._potentialStates[this.STATE_MH_QCL]["url"]=GlobalVariables.getPracticeTestDirectory()+"/?state=mh-qcl";this._potentialStates[this.STATE_MH_QCL]["parent"]=this.STATE_QC_NT;this._potentialStates[this.STATE_QC_CN]=new Array();this._potentialStates[this.STATE_QC_CN]["title"]="New Quiz";this._potentialStates[this.STATE_QC_CN]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToQcCn(); return false;";this._potentialStates[this.STATE_QC_CN]["url"]=GlobalVariables.getPracticeTestDirectory()+"/?state=qc-cn";this._potentialStates[this.STATE_QC_CN]["parent"]=this.STATE_QC_NT;this._potentialStates[this.STATE_QC_PL]=new Array();this._potentialStates[this.STATE_QC_PL]["title"]="Problem List";this._potentialStates[this.STATE_QC_PL]["onclickAction"]="";this._potentialStates[this.STATE_QC_PL]["url"]="";this._potentialStates[this.STATE_QC_PL]["parent"]=this.STATE_QC_NT;this._potentialStates[this.STATE_QC_SQV]=new Array();this._potentialStates[this.STATE_QC_SQV]["title"]="Question";this._potentialStates[this.STATE_QC_SQV]["onclickAction"]="";this._potentialStates[this.STATE_QC_SQV]["url"]="";this._potentialStates[this.STATE_QC_SQV]["parent"]=this.STATE_QC_PL;this._potentialStates[this.STATE_FAQ]=new Array();this._potentialStates[this.STATE_FAQ]["title"]="Help";this._potentialStates[this.STATE_FAQ]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToFaq(); return false;";this._potentialStates[this.STATE_FAQ]["url"]=GlobalVariables.getPracticeTestDirectory()+"/?state=faq";this._potentialStates[this.STATE_FAQ]["parent"]=this.STATE_QC_NT;this._potentialStates[this.STATE_FEEDBACK]=new Array();this._potentialStates[this.STATE_FEEDBACK]["title"]="Feedback";this._potentialStates[this.STATE_FEEDBACK]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToFeedback(); return false;";this._potentialStates[this.STATE_FEEDBACK]["url"]=GlobalVariables.getPracticeTestDirectory()+"/?state=feedback";this._potentialStates[this.STATE_FEEDBACK]["parent"]=this.STATE_QC_NT;this._potentialStates[this.STATE_QC_PT_RESULTS]=new Array();this._potentialStates[this.STATE_QC_PT_RESULTS]["title"]="Test Results";this._potentialStates[this.STATE_QC_PT_RESULTS]["onclickAction"]="myAjaxSessionGuiDriver.receiveRequestForStateChangeToMhQcl(); return false;";this._potentialStates[this.STATE_QC_PT_RESULTS]["url"]=GlobalVariables.getPracticeTestDirectory()+"/?state=mh-qcl";this._potentialStates[this.STATE_QC_PT_RESULTS]["parent"]=this.STATE_QC_PL;var _reverseStateHierarchy=new Array();this._currentState=null;cleanReverseStateHierarchy=function()
{_reverseStateHierarchy=new Array();}
createReverseStateHierarchyFromCurrentState=function(childState)
{_reverseStateHierarchy.push(childState);var parentState=_this._potentialStates[childState]["parent"];if(parentState==_this.NO_PARENT_NODE)
{return false;}
else
{createReverseStateHierarchyFromCurrentState(parentState);}}
getBreadCrumbsHtml=function()
{var html='';for(var i=_reverseStateHierarchy.length-1;i>=0;i=i-1)
{if(i==0)
{html+=_this._potentialStates[_reverseStateHierarchy[i]]["title"];}
else
{var url=GlobalVariables.getAbsoluteRootPath()+_this._potentialStates[_reverseStateHierarchy[i]]["url"];html+='<a href="'+url+'"';if(_this._potentialStates[_reverseStateHierarchy[i]]["onclickAction"].length>0)
{html+='onclick="'+_this._potentialStates[_reverseStateHierarchy[i]]["onclickAction"]+'"';}
html+='>'+_this._potentialStates[_reverseStateHierarchy[i]]["title"]+'</a>&nbsp;&raquo;&nbsp;';}}
return html;}
this.updateBreadCrumbs=function()
{if(this._currentState!=null)
{cleanReverseStateHierarchy();createReverseStateHierarchyFromCurrentState(this._currentState);document.getElementById("ajaxq-bread-crumbs").innerHTML=getBreadCrumbsHtml();}}
this.receiveRequestForStateChangeToMhQcl=function()
{StatusManager.noLockPageChangeInitiated(GlobalVariables.getAbsoluteRootPath()+_this._potentialStates[_this.STATE_MH_QCL]["url"]);disableAllViewStates();if(document.getElementById("ajaxq-mode-container-mh-qcl")==undefined||document.getElementById("ajaxq-mode-container-mh-qcl")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-mh-qcl");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
if(document.getElementById("ajaxq-mode-container-mh-qcl-contents")==undefined&&document.getElementById("ajaxq-mode-container-mh-qcl-contents")==null)
{document.getElementById("ajaxq-mode-container-mh-qcl").innerHTML="";var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-mh-qcl-contents");document.getElementById("ajaxq-mode-container-mh-qcl").appendChild(newNode);}
document.getElementById("ajaxq-mode-container-mh-qcl-contents").innerHTML="";document.getElementById("ajaxq-mode-container-mh-qcl-contents").className="ajaxq-element-inline";document.getElementById("ajaxq-mode-container-mh-qcl").className="ajaxq-element-inline";myHistoryViewGuiDriver.displayMyHistory();_this._currentState=_this.STATE_MH_QCL;_this.updateBreadCrumbs();_this.updateActiveSessionNavigationButton();changeTitleAndH1("My History");}
this.receiveRequestForStateChangeToQcNt=function()
{StatusManager.noLockPageChangeInitiated();disableAllViewStates();handleErrorCreatingQcNtGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToQcNt()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_TEST_LAUNCH_QCNT);}}
if(document.getElementById("ajaxq-mode-container-qc-nt")==undefined&&document.getElementById("ajaxq-mode-container-qc-nt")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-nt");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
qcNtCreatorGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-qc-nt").innerHTML=html;myQuestionContextCreatorGuiDriver.guiLoaded();document.getElementById("ajaxq-mode-container-qc-nt").className="ajaxq-element-inline";changeTitleAndH1("GMAT Practice Test");_this._currentState=_this.STATE_QC_NT;_this.updateBreadCrumbs();_this.updateActiveSessionNavigationButton();}
myQcNtGuiGrabber=new QcNewTestGuiGrabber();myQcNtGuiGrabber.setCallbackUponSuccess(qcNtCreatorGuiLoaded);myQcNtGuiGrabber.setCallbackUponFailure(handleErrorCreatingQcNtGui);myQcNtGuiGrabber.load();}
this.receiveRequestForStateChangeToQcNtAncillary=function(mode,callbackOnSuccess)
{disableAllViewStates();if(document.getElementById("ajaxq-mode-container-qc-nt-ancillary")==undefined&&document.getElementById("ajaxq-mode-container-qc-nt-ancillary")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-nt-ancillary");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
handleErrorCreatingQcCnGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqv()");}}
qcNtAncillaryGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-qc-nt-ancillary").innerHTML=html;document.getElementById("ajaxq-mode-container-qc-nt-ancillary").className="ajaxq-element-inline";changeTitleAndH1("GMAT Practice Test");_this._currentState=_this.STATE_QC_NT;_this.updateBreadCrumbs();_this.updateActiveSessionNavigationButton();if(callbackOnSuccess!=null&&callbackOnSuccess!=undefined)
{callbackOnSuccess();}}
myQcNtAncillaryGuiGrabber=new QcNtAncillaryGuiGrabber();myQcNtAncillaryGuiGrabber.setCallbackUponSuccess(qcNtAncillaryGuiLoaded);myQcNtAncillaryGuiGrabber.setCallbackUponFailure(handleErrorCreatingQcCnGui);if(mode!=null&&mode!=undefined)
{myQcNtAncillaryGuiGrabber.setMode(mode);}
myQcNtAncillaryGuiGrabber.load();}
this.receiveRequestForStateChangeToQcNtCompleted=function(questionContextId)
{StatusManager.noLockPageChangeInitiated();disableAllViewStates();handleErrorCreatingQcNtCompleted=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToQcNtCompleted()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QCCN_COMPLETED);}}
if(document.getElementById("ajaxq-mode-container-qc-nt-completed")==undefined&&document.getElementById("ajaxq-mode-container-qc-nt-completed")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-nt-completed");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
qcNtCompletedGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-qc-nt-completed").innerHTML=html;document.getElementById("ajaxq-mode-container-qc-nt-completed").className="ajaxq-element-inline";changeTitleAndH1("GMAT Practice Test Results");_this._currentState=_this.STATE_QC_PT_RESULTS;_this.updateBreadCrumbs();StatusManager.pageChangeCompleted();}
myQcCompletedGuiGrabber=new QcNtCompletedGuiGrabber();myQcCompletedGuiGrabber.setCallbackUponSuccess(qcNtCompletedGuiLoaded);myQcCompletedGuiGrabber.setCallbackUponFailure(handleErrorCreatingQcNtCompleted);myQcCompletedGuiGrabber.loadQuestionContextById(questionContextId);}
this.receiveRequestForStateChangeToQcCn=function()
{StatusManager.noLockPageChangeInitiated(GlobalVariables.getAbsoluteRootPath()+_this._potentialStates[_this.STATE_QC_CN]["url"]);disableAllViewStates();handleErrorCreatingQcCnGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToQcCn()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_NEW_QUIZ_QCCN);}}
if(document.getElementById("ajaxq-mode-container-qc-cn")==undefined&&document.getElementById("ajaxq-mode-container-qc-cn")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-cn");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
qcCreatorGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-qc-cn").innerHTML=html;myQuestionContextCreatorGuiDriver.guiLoaded();document.getElementById("ajaxq-mode-container-qc-cn").className="ajaxq-element-inline";changeTitleAndH1("Create New Quiz");_this._currentState=_this.STATE_QC_CN;_this.updateBreadCrumbs();_this.updateActiveSessionNavigationButton();}
myQcCreatorGuiGrabber=new QcCreatorGuiGrabber();myQcCreatorGuiGrabber.setCallbackUponSuccess(qcCreatorGuiLoaded);myQcCreatorGuiGrabber.setCallbackUponFailure(handleErrorCreatingQcCnGui);myQcCreatorGuiGrabber.load();}
this.receiveRequestForStateChangeToCurrentQcPl=function()
{StatusManager.noLockPageChangeInitiated();disableAllViewStates();if(document.getElementById("ajaxq-mode-container-qc-pl")==undefined&&document.getElementById("ajaxq-mode-container-qc-pl")==null)
{}
else
{myQuestionContextProblemListViewGuiDriver.display();changeTitleAndH1("Question List");}}
this.receiveRequestForStateChangeToQcPl=function(questionContextId,forceRefreshFromServer)
{StatusManager.noLockPageChangeInitiated(GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+'/?state=qc-pl&question_context_id='+questionContextId);disableAllViewStates();if(document.getElementById("ajaxq-mode-container-qc-pl")==undefined&&document.getElementById("ajaxq-mode-container-qc-pl")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-pl");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
document.getElementById("ajaxq-mode-container-qc-pl").innerHtml='';myQuestionContextProblemListViewGuiDriver=new AjaxQuestionContextProblemListViewGuiDriver(questionContextId);if(forceRefreshFromServer==true)
{myQuestionContextProblemListViewGuiDriver.display(true);}
else
{myQuestionContextProblemListViewGuiDriver.display(false);}
changeTitleAndH1("Question List");}
this.receiveRequestForStateChangeToQcSqvCat=function(desiredQuestionContextId,desiredQuestionListId,desiredQuestionId)
{this.receiveRequestForStateChangeToQcSqv(desiredQuestionContextId,desiredQuestionListId,desiredQuestionId,true);}
this.receiveRequestForStateChangeToQcSqv=function(desiredQuestionContextId,desiredQuestionListId,desiredQuestionId,isCat)
{var permalinkUrl=GlobalVariables.getAbsoluteRootPath()+GlobalVariables.getPracticeTestDirectory()+'/?state=qc-sqv&question_context_id='+desiredQuestionContextId+'&question_list_id='+desiredQuestionListId+'&question_id='+desiredQuestionId;if(isCat===true)
{StatusManager.noLockPageChangeInitiated();}
else
{StatusManager.noLockPageChangeInitiated(permalinkUrl);}
disableAllViewStates();var questionContextId=desiredQuestionContextId;var questionListId=desiredQuestionListId;var questionId=desiredQuestionId;handleErrorCreatingQcSqvGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToQcSqv()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_QUESTION_QCSQV);}}
if(document.getElementById("ajaxq-mode-container-qc-sqv")==undefined&&document.getElementById("ajaxq-mode-container-qc-sqv")==null)
{var newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-qc-sqv");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);qcSqvGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-qc-sqv").innerHTML=html;myQcSqvDriver.focusToQuestion(questionContextId,questionListId,questionId);}
myQcSqvGuiGrabber=new QcSqvGuiGrabber(desiredQuestionContextId,desiredQuestionListId,desiredQuestionId);myQcSqvGuiGrabber.setCallbackUponSuccess(qcSqvGuiLoaded);myQcSqvGuiGrabber.setCallbackUponFailure(handleErrorCreatingQcSqvGui);if(isCat===true)
{myQcSqvGuiGrabber.setIsCat(true);}
myQcSqvGuiGrabber.load();}
else
{myQcSqvDriver.focusToQuestion(questionContextId,questionListId,questionId);}}
this.receiveRequestForStateChangeToCurrentQuestionView=function()
{disableAllViewStates();_this._currentState=_this.STATE_QC_SQV;var currentQuestionId=myQcSqvDriver.getQuestionContext().getCurrentQuestionList().getCurrentQuestionId();if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(currentQuestionId))
{var currentQuestionTitle=QuestionMetaDataRepositoryManager.getQuestionMetaDataById(currentQuestionId).getQuestionTitle();}
else if(QuestionRepositoryManager.doesQuestionExist(currentQuestionId))
{var currentQuestionTitle=QuestionRepositoryManager.getQuestionById(currentQuestionId).getQuestionTitle();}
else
{var currentQuestionTitle='Question';}
changeTitleAndH1(currentQuestionTitle,currentQuestionTitle);_this.updateBreadCrumbs();document.getElementById("ajaxq-mode-container-qc-sqv").className="ajaxq-element-inline";}
this.receiveRequestForStateChangeToFeedback=function()
{StatusManager.noLockPageChangeInitiated(GlobalVariables.getAbsoluteRootPath()+_this._potentialStates[_this.STATE_FEEDBACK]["url"]);disableAllViewStates();handleErrorCreatingFeedbackGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToFeedback()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_FAQ);}}
if(document.getElementById("ajaxq-mode-container-feedback")==undefined&&document.getElementById("ajaxq-mode-container-feedback")==null)
{newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-feedback");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
feedbackGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-feedback").innerHTML=html;document.getElementById("ajaxq-mode-container-feedback").className="ajaxq-element-inline";changeTitleAndH1("Feedback");_this._currentState=_this.STATE_FEEDBACK;_this.updateBreadCrumbs();StatusManager.pageChangeCompleted();_this.updateActiveSessionNavigationButton();}
myFeedbackGuiGrabber=new FeedbackGuiGrabber();myFeedbackGuiGrabber.setCallbackUponSuccess(feedbackGuiLoaded);myFeedbackGuiGrabber.setCallbackUponFailure(handleErrorCreatingFeedbackGui);myFeedbackGuiGrabber.load(_this._currentState);}
this.receiveRequestForStateChangeToFaq=function()
{StatusManager.noLockPageChangeInitiated(GlobalVariables.getAbsoluteRootPath()+_this._potentialStates[_this.STATE_FAQ]["url"]);disableAllViewStates();handleErrorCreatingFaqGui=function(e)
{if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);}
else
{ErrorLogger.logCaughtError(e,"Occurred as a result of AJAX call in AjaxSessionGuiDriver.receiveRequestForStateChangeToFaq()");StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_LOAD_FAQ);}}
if(document.getElementById("ajaxq-mode-container-faq")==undefined&&document.getElementById("ajaxq-mode-container-faq")==null)
{newNode=document.createElement("div");newNode.setAttribute("id","ajaxq-mode-container-faq");document.getElementById("ajaxq-mode-container-parent").appendChild(newNode);}
faqGuiLoaded=function(html)
{document.getElementById("ajaxq-mode-container-faq").innerHTML=html;document.getElementById("ajaxq-mode-container-faq").className="ajaxq-element-inline";changeTitleAndH1("FAQ & Help");_this._currentState=_this.STATE_FAQ;_this.updateBreadCrumbs();StatusManager.pageChangeCompleted();_this.updateActiveSessionNavigationButton();}
myFaqGuiGrabber=new FaqGuiGrabber();myFaqGuiGrabber.setCallbackUponSuccess(faqGuiLoaded);myFaqGuiGrabber.setCallbackUponFailure(handleErrorCreatingFaqGui);myFaqGuiGrabber.load(_this._currentState);}
changeTitleAndH1=function(inTitleText,inH1Text)
{var titleText=inTitleText;var h1Text;if(inH1Text==undefined||inH1Text==null||inH1Text.length<1)
{h1Text=titleText;}
else
{h1Text=inH1Text;}
document.title=titleText;if(document.getElementById("title")!=undefined&&document.getElementById("title")!=null)
{document.getElementById("title").innerHTML=h1Text;}}
this.updateActiveSessionNavigationButton=function()
{document.getElementById("ajaxq-nav-bar-button-mh-qcl").className='ajaxq-session-button-enabled-td';document.getElementById("ajaxq-nav-bar-button-qc-cn").className='ajaxq-session-button-enabled-td';document.getElementById("ajaxq-nav-bar-button-faq").className='ajaxq-session-button-enabled-td';document.getElementById("ajaxq-nav-bar-button-qc-nt").className='ajaxq-session-button-enabled-td';document.getElementById("ajaxq-nav-bar-button-feedback").className='ajaxq-session-button-enabled-td';_this.handleMouseOver(_this._currentState);}
this.handleMouseOut=function(currentState)
{if(currentState==myAjaxSessionGuiDriver._currentState)
{return false;}
switch(currentState)
{case _this.STATE_MH_QCL:document.getElementById("ajaxq-nav-bar-button-mh-qcl").className='ajaxq-session-button-enabled-td';break;case _this.STATE_QC_CN:document.getElementById("ajaxq-nav-bar-button-qc-cn").className='ajaxq-session-button-enabled-td';break;case _this.STATE_FAQ:document.getElementById("ajaxq-nav-bar-button-faq").className='ajaxq-session-button-enabled-td';break;case _this.STATE_QC_NT:document.getElementById("ajaxq-nav-bar-button-qc-nt").className='ajaxq-session-button-enabled-td';break;case _this.STATE_FEEDBACK:document.getElementById("ajaxq-nav-bar-button-feedback").className='ajaxq-session-button-enabled-td';break;}}
this.handleMouseOver=function(currentState)
{switch(currentState)
{case _this.STATE_MH_QCL:document.getElementById("ajaxq-nav-bar-button-mh-qcl").className='ajaxq-session-button-hover-td';break;case _this.STATE_QC_CN:document.getElementById("ajaxq-nav-bar-button-qc-cn").className='ajaxq-session-button-hover-td';break;case _this.STATE_FAQ:document.getElementById("ajaxq-nav-bar-button-faq").className='ajaxq-session-button-hover-td';break;case _this.STATE_QC_NT:document.getElementById("ajaxq-nav-bar-button-qc-nt").className='ajaxq-session-button-hover-td';break;case _this.STATE_FEEDBACK:document.getElementById("ajaxq-nav-bar-button-feedback").className='ajaxq-session-button-hover-td';break;}}
disableAllViewStates=function()
{if(document.getElementById("ajaxq-mode-container-qc-sqv")!=undefined&&document.getElementById("ajaxq-mode-container-qc-sqv")!=null)
{document.getElementById("ajaxq-mode-container-qc-sqv").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-qc-pl")!=undefined&&document.getElementById("ajaxq-mode-container-qc-pl")!=null)
{document.getElementById("ajaxq-mode-container-qc-pl").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-mh-qcl")!=undefined&&document.getElementById("ajaxq-mode-container-mh-qcl")!=null)
{document.getElementById("ajaxq-mode-container-mh-qcl").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-qc-cn")!=undefined&&document.getElementById("ajaxq-mode-container-qc-cn")!=null)
{document.getElementById("ajaxq-mode-container-qc-cn").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-faq")!=undefined&&document.getElementById("ajaxq-mode-container-faq")!=null)
{document.getElementById("ajaxq-mode-container-faq").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-qc-nt")!=undefined&&document.getElementById("ajaxq-mode-container-qc-nt")!=null)
{document.getElementById("ajaxq-mode-container-qc-nt").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-qc-nt-ancillary")!=undefined&&document.getElementById("ajaxq-mode-container-qc-nt-ancillary")!=null)
{document.getElementById("ajaxq-mode-container-qc-nt-ancillary").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-qc-nt-completed")!=undefined&&document.getElementById("ajaxq-mode-container-qc-nt-completed")!=null)
{document.getElementById("ajaxq-mode-container-qc-nt-completed").className="ajaxq-element-disabled";}
if(document.getElementById("ajaxq-mode-container-feedback")!=undefined&&document.getElementById("ajaxq-mode-container-feedback")!=null)
{document.getElementById("ajaxq-mode-container-feedback").className="ajaxq-element-disabled";}}}
function BackgroundContentLoader()
{var _STATUS_DOWNLOAD_NOT_BEGUN=GlobalDownloadStatus._STATUS_DOWNLOAD_NOT_BEGUN;var _STATUS_DOWNLOAD_IN_PROCESS=GlobalDownloadStatus._STATUS_DOWNLOAD_IN_PROCESS;var _STATUS_PARTLY_DOWNLOADED=GlobalDownloadStatus._STATUS_PARTLY_DOWNLOADED;var _STATUS_DOWNLOAD_COMPLETE=GlobalDownloadStatus._STATUS_DOWNLOAD_COMPLETE;var _downloadGroupStatus=GlobalDownloadStatus.GLOBAL_DOWNLOAD_GROUP_STATUS;var _downloadManagerInterval;init=function()
{downloadManager();_downloadManagerInterval=window.setInterval(downloadManager,10000);}
init();function downloadManager()
{if(_downloadGroupStatus["MARKED_QUESTION"]["DOWNLOAD_STATUS"]!=_STATUS_DOWNLOAD_COMPLETE&&_downloadGroupStatus["MARKED_QUESTION"]["DOWNLOAD_STATUS"]!=_STATUS_DOWNLOAD_IN_PROCESS)
{downloadAllQuestionIdsMarkedForReview();}
else if(_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]!=_STATUS_DOWNLOAD_COMPLETE&&_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]!=_STATUS_DOWNLOAD_IN_PROCESS)
{downloadCookieTest();}
for(var foundQuestionContextId in QuestionContextRepositoryManager._questionContextRepository)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(foundQuestionContextId))
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(foundQuestionContextId);var questionContextId=foundQuestionContextId;if((_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]==undefined||_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]==null||_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]["DOWNLOAD_STATUS"]!=_STATUS_DOWNLOAD_COMPLETE)&&QuestionContextRepositoryManager.getQuestionContextById(questionContextId).getWhetherQuestionInteractionsFullyDownloaded()!=true)
{downloadAllQuestionInteractionsForQuestionContext(questionContextId);break;}}}
for(var foundQuestionListId in QuestionListRepositoryManager._listRepository)
{if(QuestionListRepositoryManager.doesListExist(foundQuestionListId))
{if((_downloadGroupStatus["QUESTION_LIST"]["QUESTIONS"][foundQuestionListId]==undefined||_downloadGroupStatus["QUESTION_LIST"]["QUESTIONS"][foundQuestionListId]==null||_downloadGroupStatus["QUESTION_LIST"]["QUESTIONS"][foundQuestionListId]!=_STATUS_DOWNLOAD_COMPLETE)&&QuestionListRepositoryManager.getListById(foundQuestionListId).getWhetherQuestionsFullyDownloaded()!=true)
{try
{var arrOfIds=getQuestionIdsForDownload(foundQuestionListId,15);if(arrOfIds.length>0)
{downloadQuestions(arrOfIds);}}
catch(e)
{if(e instanceof TraverseQuestionListError)
{}
else
{ErrorLogger.logCaughtError(e,"error occurred in BackgroundContentDownloader.getQuestionIdsForDownload();");}}}}}
for(var foundQuestionContextId in QuestionContextRepositoryManager._questionContextRepository)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(foundQuestionContextId))
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(foundQuestionContextId);var questionContextId=foundQuestionContextId;var currentQuestionContext=QuestionContextRepositoryManager.getQuestionContextById(questionContextId);var associatedQuestionListIds=currentQuestionContext.getQuestionListIds();for(var j=0;j<associatedQuestionListIds.length;j++)
{var currentQuestionListId=associatedQuestionListIds[j];if(_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]==undefined||_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]==null||_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]!=_STATUS_DOWNLOAD_COMPLETE)
{if(QuestionListRepositoryManager.doesListExist(currentQuestionListId))
{_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]=_STATUS_DOWNLOAD_COMPLETE;}
else if(currentQuestionListId==GlobalVariables.QUESTION_LIST_TYPE_QUANT_CAT||currentQuestionListId==GlobalVariables.QUESTION_LIST_TYPE_VERBAL_CAT)
{_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]=_STATUS_DOWNLOAD_COMPLETE;}
else if(new String(currentQuestionListId).substring(0,new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT).length)==new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT)||new String(currentQuestionListId).substring(0,new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_QUANT_CAT).length)==new String(GlobalVariables.PREFIX_QUESTION_LIST_TYPE_VERBAL_CAT))
{_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][currentQuestionListId]=_STATUS_DOWNLOAD_COMPLETE;}
else
{downloadQuestionListMetaData(currentQuestionListId);}}}}}}
function getQuestionIdsForDownload(questionListId,numOfIds)
{var numOfIdsToGrab=numOfIds;if(numOfIds==undefined||numOfIds==null)
{numOfIdsToGrab=5;}
var questionListToSearch=QuestionListRepositoryManager.getListById(questionListId);var numberOfQuestionsInList=questionListToSearch.getQuestionListContents().length;var startingQuestionIdToSearchFor=questionListToSearch.getCurrentQuestionId();if(startingQuestionIdToSearchFor==undefined||startingQuestionIdToSearchFor==null)
{startingQuestionIdToSearchFor=questionListToSearch.getFirstQuestionId();}
var returnArrOfIds=new Array();var searchedThroughEndOfList=false;var nextSearchId=startingQuestionIdToSearchFor;var totalIterations=0;for(var getIdsCount=0;(getIdsCount<numOfIdsToGrab&&totalIterations<15);getIdsCount++)
{if(QuestionRepositoryManager.doesQuestionExist(nextSearchId)==false)
{returnArrOfIds.push(nextSearchId);}
else
{getIdsCount--;}
if(searchedThroughEndOfList==true)
{nextSearchId=questionListToSearch.getRelativePreviousQuestionId(nextSearchId);if(nextSearchId==GlobalVariables.END_OF_QUESTION_LIST)
{_downloadGroupStatus["QUESTION_LIST"]["QUESTIONS"][questionListId]=_STATUS_DOWNLOAD_COMPLETE;questionListToSearch.setWhetherQuestionsFullyDownloaded(true);return returnArrOfIds;}}
else if(searchedThroughEndOfList==false)
{nextSearchId=questionListToSearch.getRelativeNextQuestionId(nextSearchId);if(nextSearchId==GlobalVariables.END_OF_QUESTION_LIST)
{searchedThroughEndOfList=true;nextSearchId=questionListToSearch.getRelativePreviousQuestionId(startingQuestionIdToSearchFor);if(nextSearchId==GlobalVariables.END_OF_QUESTION_LIST)
{_downloadGroupStatus["QUESTION_LIST"]["QUESTIONS"][questionListId]=_STATUS_DOWNLOAD_COMPLETE;questionListToSearch.setWhetherQuestionsFullyDownloaded(true);return returnArrOfIds;}}}
totalIterations++;}
return returnArrOfIds;}
function downloadAllQuestionInteractionsForQuestionContext(questionContextId)
{if(_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]==undefined||_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]==null)
{_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]=new Array();_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_IN_PROCESS;}
else
{_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_IN_PROCESS;}
var currentQuestionContextId=questionContextId;finishedDownloadingQuestionInteractions=function()
{_downloadGroupStatus["QUESTION_INTERACTION"][questionContextId]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_COMPLETE;QuestionContextRepositoryManager.getQuestionContextById(currentQuestionContextId).setWhetherQuestionInteractionsFullyDownloaded(true);}
var myAjaxQuestionInteractionLoader=new HttpAjaxQuestionInteractionLoader();myAjaxQuestionInteractionLoader.setCallbackUponSuccess(finishedDownloadingQuestionInteractions);myAjaxQuestionInteractionLoader.setQuestionContextId(currentQuestionContextId);myAjaxQuestionInteractionLoader.loadInteractions();}
this.publicDownloadAllQuestionIdsMarkedForReview=function()
{downloadAllQuestionIdsMarkedForReview();}
function downloadAllQuestionIdsMarkedForReview()
{_downloadGroupStatus["MARKED_QUESTION"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_IN_PROCESS;_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_IN_PROCESS;finishedDownloadingMarkedQuestionIds=function()
{_downloadGroupStatus["MARKED_QUESTION"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_COMPLETE;_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_COMPLETE;}
handleCaughtErrorDownloadingMarkedQuestions=function(e)
{if(e instanceof NoContentFound)
{}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}
else if(e instanceof AjaxServerError||e instanceof RequiredFieldMissing)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_DOWNLOAD_MARKED_QUESTIONS);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_DOWNLOAD_MARKED_QUESTIONS);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}}
var myMarkedQuestionIdLoader=new HttpMarkedQuestionIdLoader();myMarkedQuestionIdLoader.setCallbackUponSuccess(finishedDownloadingMarkedQuestionIds);myMarkedQuestionIdLoader.setCallbackUponFailure(handleCaughtErrorDownloadingMarkedQuestions);myMarkedQuestionIdLoader.loadMarkedQuestionIds();}
function downloadCookieTest()
{_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_IN_PROCESS;finishedDownloadingCookieTest=function(text)
{_downloadGroupStatus["COOKIE_TEST"]["DOWNLOAD_STATUS"]=_STATUS_DOWNLOAD_COMPLETE;if(typeof text=='string'&&text=="1111")
{var myError=new CookiesNotEnabled();myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);handleCaughtErrorDownloadingCookieTest(myError);}}
handleCaughtErrorDownloadingCookieTest=function(e)
{if(e instanceof NoContentFound)
{}
else if(e instanceof CookiesNotEnabled)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_COOKIES_NOT_SUPPORTED);}
else if(e instanceof AjaxUnsupportedError)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_AJAX_UNSUPPORTED);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}
else if(e instanceof AjaxServerError||e instanceof RequiredFieldMissing)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_DOWNLOAD_MARKED_QUESTIONS);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}
else
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_DOWNLOAD_MARKED_QUESTIONS);ErrorLogger.logCaughtError(e,"Attempt to download Marked Questions failed. Occured in BackgroundContentLoader.downloadAllQuestionIdsMarkedForReview() handleCaughtErrorDownloadingMarkedQuestions()");}}
try
{var myAjaxCoreCookieTestRequest=new AjaxCore();myAjaxCoreCookieTestRequest.setOnReadySuccessCallbackfunction(finishedDownloadingCookieTest);myAjaxCoreCookieTestRequest.setOnFailureCallbackfunction(handleCaughtErrorDownloadingCookieTest);myAjaxCoreCookieTestRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"performCookieTest");myAjaxCoreCookieTestRequest.getOpenXHR().send(null);}
catch(e)
{handleCaughtErrorDownloadingCookieTest(e);}}
function downloadQuestions(arrIds)
{for(var i=0;i<arrIds.length;i++)
{if(QuestionRepositoryManager.doesQuestionExist(arrIds[i]))
{arrIds.splice(i,1);}}
finishedDownloading=function()
{}
handleCaughtQuestionDownloadError=function(e)
{ErrorLogger.logCaughtError(e,"Attempt to download Questions failed. Occured in BackgroundContentLoader.downloadQuestions() handleCaughtQuestionDownloadError()");}
try
{var myQuestionLoader=new HttpQuestionsLoader();myQuestionLoader.setCallbackUponSuccess(finishedDownloading);myQuestionLoader.setCallbackUponFailure(handleCaughtQuestionDownloadError);myQuestionLoader.loadQuestions(arrIds);}
catch(e)
{handleCaughtQuestionDownloadError(e);}}
function downloadQuestionListMetaData(inputQuestionListId)
{_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][inputQuestionListId]=_STATUS_DOWNLOAD_IN_PROCESS;finishedDownloading=function()
{_downloadGroupStatus["QUESTION_LIST"]["META_DATA"][inputQuestionListId]=_STATUS_DOWNLOAD_COMPLETE;}
handleCaughtQuestionListDownloadError=function(e)
{ErrorLogger.logCaughtError(e,"Attempt to download Question Lists failed. Occured in BackgroundContentLoader.downloadQuestionListMetaData() handleCaughtQuestionListDownloadError()");}
var myQuestionListGrabber=new QuestionListGrabber();myQuestionListGrabber.setSearchMode(myQuestionListGrabber.searchModeById);myQuestionListGrabber.setSearchIds(inputQuestionListId);myQuestionListGrabber.setCallbackUponSuccess(finishedDownloading);myQuestionListGrabber.setCallbackUponFailure(handleCaughtQuestionListDownloadError);myQuestionListGrabber.loadQuestionList();}};function QuestionContextQuestionsMetaDataGrabber(inputQuestionContextId)
{var _this=this;if(QuestionContextRepositoryManager.doesQuestionContextExist(inputQuestionContextId))
{var _questionContextIdToGrab=inputQuestionContextId;}
else
{var myError=new InvalidValueError("Unrecognized Question Context ID passed to constructor of QuestionContextQuestionsMetaDataGrabber; value = "+inputQuestionContextId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}
var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(inputCallback)
{_callbackUponSuccess=inputCallback;}
this.setCallbackUponFailure=function(inputCallback)
{_callbackUponFailure=inputCallback;}
receiveQuestionListReady=function()
{_this.loadMetaDataOfQuestionsInQuestionContext();}
this.loadMetaDataOfQuestionsInQuestionContext=function()
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(_questionContextIdToGrab);for(var i=0;i<questionContext.getQuestionListIds().length;i++)
{if(QuestionListRepositoryManager.doesListExist(questionContext.getQuestionListIds()[i])==false)
{var currentQuestionListId=questionContext.getQuestionListIds()[i];var myListGrabber=new QuestionListGrabber();myListGrabber.setSearchMode(myListGrabber.searchModeById);myListGrabber.setSearchIds(currentQuestionListId);myListGrabber.setCallbackUponSuccess(receiveQuestionListReady);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myListGrabber.setCallbackUponFailure(_callbackUponFailure);}
myListGrabber.loadQuestionList();}
else
{var currentQuestionList=QuestionListRepositoryManager.getListById(questionContext.getQuestionListIds()[i]);var questionsIdsToGrab=new Array();for(var j=0;j<currentQuestionList.getQuestionListContents().length;j++)
{var currentQuestionId=currentQuestionList.getQuestionListContents()[j];if(!QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(currentQuestionId))
{questionsIdsToGrab.push(currentQuestionId);}}
if(questionsIdsToGrab.length<1)
{_callbackUponSuccess();}
else
{var myQuestionMetaDataLoader=new HttpQuestionsMetaDataLoader();if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myQuestionMetaDataLoader.setCallbackUponSuccess(_callbackUponSuccess);}
if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myQuestionMetaDataLoader.setCallbackUponFailure(_callbackUponFailure);}
myQuestionMetaDataLoader.loadQuestions(questionsIdsToGrab);}}}}}
function QuestionListGrabber()
{var _this=this;var _callbackUponSuccess;var _callbackUponFailure;var _searchMode;var _searchIds;var _forceDownloadFromServer=false;this.searchModeById=0;this.searchModeByAuthentication=1;this.searchModeByAllPublic=2;this.searchModeByAllAdmin=3;this.setCallbackUponSuccess=function(inputCallback)
{_callbackUponSuccess=inputCallback;}
this.setCallbackUponFailure=function(inputCallback)
{_callbackUponFailure=inputCallback;}
this.setSearchMode=function(input)
{if(input==this.searchModeById||input==this.searchModeByAuthentication||input==this.searchModeByAllPublic||input==this.searchModeByAllAdmin)
{_searchMode=input;}
else
{var myError=new InvalidValueError("Unrecognized Search Mode passed to QuestionListGrabber.setSearchMode(); value = "+input);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}}
this.setSearchIds=function(inputIds)
{_searchIds=inputIds;}
this.setForceDownloadFromServer=function(varInput)
{_forceDownloadFromServer=varInput;}
this.loadQuestionList=function()
{if(_forceDownloadFromServer!=true)
{if(_searchIds instanceof Array)
{var allListsStoredLocally=true;for(var searchForQuestionId in _searchIds)
{if(QuestionListRepositoryManager.doesListExist(parseInt(_searchIds[searchForQuestionId]))==false)
{allListsStoredLocally=false;}}
if(allContextsStoredLocally)
{_callbackUponSuccess();return true;}}
else if(_searchIds!=undefined&&_searchIds!=null)
{if(QuestionListRepositoryManager.doesListExist(parseInt(_searchIds)))
{_callbackUponSuccess();return true;}}}
receiveAjaxCallback=function(xmlDoc)
{try
{var myQuestionListParser=new XMLQuestionListParser(xmlDoc);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myQuestionListParser.setCallbackFunction(_callbackUponSuccess);}
myQuestionListParser.parseXmlQuestionListReturn();}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
try
{var myAjaxCoreListRequest=new AjaxCore();myAjaxCoreListRequest.setOnReadySuccessCallbackfunction(receiveAjaxCallback);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreListRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
if(_searchMode==this.searchModeById)
{var searchQueryStringAppendix=GlobalVariables.prepareInputIdsForQuerystring(_searchIds);myAjaxCoreListRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionLists?mode=searchById&questionListIds="+searchQueryStringAppendix);}
else if(_searchMode==this.searchModeByAuthentication)
{myAjaxCoreListRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionLists?mode=searchByAuth");}
else if(_searchMode==this.searchModeByAllAdmin)
{myAjaxCoreListRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionLists?mode=getAllAdmin");}
else if(_searchMode==this.searchModeByAllPublic)
{myAjaxCoreListRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionLists?mode=getAllPublic");}
else
{var myError=new InvalidValueError("Unrecognized Search Mode set in QuestionListGrabber.loadQuestionList()");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
myAjaxCoreListRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QuestionGrabber(inputQuestionId)
{var _this=this;var _questionIdToGrab=inputQuestionId;var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(inputCallback)
{_callbackUponSuccess=inputCallback;}
this.setCallbackUponFailure=function(inputCallback)
{_callbackUponFailure=inputCallback;}
this.loadQuestion=function()
{if(QuestionRepositoryManager.doesQuestionExist(_questionIdToGrab))
{var question=QuestionRepositoryManager.getQuestionById(_questionIdToGrab);var questionType=question.getQuestionCategoryType();if(questionType=="RC")
{var passageId=question.getPassageId();if(PassageRepositoryManager.doesPassageExist(passageId))
{_callbackUponSuccess();}
else
{try
{var myPassageLoader=new HttpPassagesLoader();myPassageLoader.setCallbackUponSuccess(_this.loadQuestion);if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{myPassageLoader.setCallbackUponFailure(_callbackUponFailure);}
myPassageLoader.loadPassages(passageId);}
catch(e)
{if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{_callbackUponFailure(e);}}}}
else
{if(_callbackUponSuccess!=null&&_callbackUponSuccess!=undefined)
{_callbackUponSuccess();}}}
else
{try
{var myQuestionLoader=new HttpQuestionsLoader();myQuestionLoader.setCallbackUponSuccess(this.loadQuestion);if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{myQuestionLoader.setCallbackUponFailure(_callbackUponFailure);}
myQuestionLoader.loadQuestions(_questionIdToGrab);}
catch(e)
{if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{_callbackUponFailure(e);}}}}}
function QuestionInteractionsByContextGrabber()
{var _this=this;var _callbackUponSuccess;var _callbackUponFailure;var _forceDownloadFromServer=false;this.setCallbackUponSuccess=function(inputCallback)
{_callbackUponSuccess=inputCallback;}
this.setCallbackUponFailure=function(inputCallback)
{_callbackUponFailure=inputCallback;}
this.setForceDownloadFromServer=function(varInput)
{_forceDownloadFromServer=varInput;}
this.loadInteractionsByQuestionContextId=function(inputQcId)
{var _questionContextId=inputQcId;if(QuestionContextRepositoryManager.doesQuestionContextExist(_questionContextId))
{var questionContext=QuestionContextRepositoryManager.getQuestionContextById(_questionContextId);}
else
{var myError=new RequiredFieldMissing("Question Context with ID "+_questionContextId+" does not exist.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}
if(!questionContext.getWhetherQuestionInteractionsFullyDownloaded()&&_forceDownloadFromServer!=true)
{myQuestionInteractionLoader=new HttpAjaxQuestionInteractionLoader();myQuestionInteractionLoader.setQuestionContextId(_questionContextId);if(_callbackUponSuccess!=null&&_callbackUponSuccess!=undefined)
{myQuestionInteractionLoader.setCallbackUponSuccess(_callbackUponSuccess);}
if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{myQuestionInteractionLoader.setCallbackUponFailure(_callbackUponFailure);}
myQuestionInteractionLoader.loadInteractions();}
else
{if(_callbackUponSuccess!=null&&_callbackUponSuccess!=undefined)
{_callbackUponSuccess();}}}}
function QuestionContextGrabber()
{var _this=this;var _callbackUponSuccess;var _callbackUponFailure;var _searchMode;var _searchIds;var _forceDownloadFromServer=false;this.searchModeById=0;this.searchModeByAuthentication=1;this.searchModeByAllPublic=2;this.setCallbackUponSuccess=function(inputCallback)
{_callbackUponSuccess=inputCallback;}
this.setCallbackUponFailure=function(inputCallback)
{_callbackUponFailure=inputCallback;}
this.setSearchMode=function(input)
{if(input==this.searchModeById||input==this.searchModeByAuthentication||input==this.searchModeByAllPublic)
{_searchMode=input;}
else
{var myError=new InvalidValueError("Unrecognized Search Mode set in QuestionContextGrabber.setSearchMode(); value: "+input);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}}
this.setSearchIds=function(inputIds)
{_searchIds=inputIds;}
this.setForceDownloadFromServer=function(varInput)
{_forceDownloadFromServer=varInput;}
this.query=function()
{if(_searchMode==this.searchModeById||_searchMode==this.searchModeByAuthentication||_searchMode==this.searchModeByAllPublic)
{if(_searchMode==this.searchModeByAuthentication&&GlobalDownloadStatus.MY_QC_HISTORY_DOWNLOADED==true&&_forceDownloadFromServer==false)
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();}
return true;}
if(_searchIds instanceof Array&&_forceDownloadFromServer==false)
{var allContextsStoredLocally=true;for(var searchForQuestionContextId in _searchIds)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(parseInt(_searchIds[searchForQuestionContextId]))==false)
{allContextsStoredLocally=false;}}
if(allContextsStoredLocally==true)
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();}
return true;}}
else if(_searchIds!=undefined&&_searchIds!=null&&_forceDownloadFromServer==false)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(_searchIds))
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();}
return true;}}
receiveAjaxCallback=function(xmlDoc)
{if(typeof xmlDoc=='object')
{try
{var myQuestionContextParser=new XMLQuestionContextParser(xmlDoc);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myQuestionContextParser.setCallbackFunction(_callbackUponSuccess);}
myQuestionContextParser.parseXmlContextReturn();}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
if(typeof xmlDoc=='string')
{var myError=new NoContentFound("No Question Context(s) Returned. Occurred in QuestionContextGrabber. IE6 specific error.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}}
try
{var myAjaxCoreContextRequest=new AjaxCore();myAjaxCoreContextRequest.setOnReadySuccessCallbackfunction(receiveAjaxCallback);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreContextRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
if(_searchMode==this.searchModeById)
{var searchQueryStringAppendix=GlobalVariables.prepareInputIdsForQuerystring(_searchIds);myAjaxCoreContextRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionContexts?mode=searchById&questionContextIds="+searchQueryStringAppendix);}
else if(_searchMode==this.searchModeByAuthentication)
{myAjaxCoreContextRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionContexts?mode=searchByAuth");}
else if(_searchMode==this.searchModeByAllPublic)
{myAjaxCoreContextRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionContexts?mode=getAllPublic");}
else
{var myError=new InvalidValueError("Unrecognized Search Mode set in QuestionContextGrabber; value: "+_searchMode);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
myAjaxCoreContextRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
else
{var myError=new InvalidValueError("Unrecognized Search Mode set in QuestionContextGrabber.query()");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(myError);}}}}
function HttpPassagesLoader()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(inputFnc)
{_callbackUponSuccess=inputFnc;}
this.setCallbackUponFailure=function(inputFnc)
{_callbackUponFailure=inputFnc;}
this.loadPassages=function(inputIds)
{receiveAjaxPassageRequestResponse=function(xmlDoc)
{try
{var myPassageParser=new XMLPassageParser(xmlDoc);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myPassageParser.setCallbackFunction(_callbackUponSuccess);}
myPassageParser.parseXmlPassageReturn();}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
try
{var passageQueryStringAppendix=GlobalVariables.prepareInputIdsForQuerystring(inputIds);var myAjaxCorePassageRequest=new AjaxCore();myAjaxCorePassageRequest.setOnReadySuccessCallbackfunction(receiveAjaxPassageRequestResponse);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCorePassageRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCorePassageRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedHtmlOfPassages?passageIds="+passageQueryStringAppendix);myAjaxCorePassageRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function HttpQuestionsLoader()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.loadQuestions=function(inputIds)
{receiveAjaxQuestionResponse=function(xmlQuestionDoc)
{try
{var myQuestionParser=new XMLQuestionParser(xmlQuestionDoc);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myQuestionParser.setCallbackFunction(_callbackUponSuccess);}
myQuestionParser.parseXmlReturn();}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
try
{var questionQueryStringAppendix=GlobalVariables.prepareInputIdsForQuerystring(inputIds);var myAjaxCoreQuestionRequest=new AjaxCore();myAjaxCoreQuestionRequest.setOnReadySuccessCallbackfunction(receiveAjaxQuestionResponse);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreQuestionRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCoreQuestionRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedHtmlOfQuestions?questionIds="+questionQueryStringAppendix);myAjaxCoreQuestionRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function HttpQuestionsMetaDataLoader()
{var _callbackUponSuccess;var _callbackUponFailure;var _forceDownloadFromServer=false;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.loadQuestions=function(inputIds)
{receiveAjaxQuestionResponse=function(xmlQuestionDoc)
{try
{var myQuestionParser=new XMLQuestionMetaDataParser(xmlQuestionDoc);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myQuestionParser.setCallbackFunction(_callbackUponSuccess);}
myQuestionParser.parseXmlReturn();}
catch(e)
{if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{_callbackUponFailure(e);}}}
if(inputIds instanceof Array&&_forceDownloadFromServer==false)
{var allMetaDataStoredLocally=true;for(var searchForQuestionMetaDataId in inputIds)
{if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(inputIds[searchForQuestionMetaDataId])==false)
{allMetaDataStoredLocally=false;}}
if(allMetaDataStoredLocally==true)
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();}
return true;}}
else if(inputIds!=undefined&&inputIds!=null&&_forceDownloadFromServer==false)
{if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(inputIds))
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();}
return true;}}
try
{var questionQueryStringAppendix=GlobalVariables.prepareInputIdsForQuerystring(inputIds);var myAjaxCoreQuestionRequest=new AjaxCore();myAjaxCoreQuestionRequest.setOnReadySuccessCallbackfunction(receiveAjaxQuestionResponse);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreQuestionRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCoreQuestionRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionMetaData?questionIds="+questionQueryStringAppendix);myAjaxCoreQuestionRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=null&&_callbackUponFailure!=undefined)
{_callbackUponFailure(e);}}}}
function HttpMarkedQuestionIdLoader()
{var _callbackFunctionUponSuccess;var _callbackFunctionUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackFunctionUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackFunctionUponFailure=fnc;}
this.loadMarkedQuestionIds=function()
{receiveMarkedQuestionIdsResponse=function(xmlQuestionDoc)
{if(typeof xmlQuestionDoc!='object'||(typeof xmlQuestionDoc=='string'&&xmlQuestionDoc=="1111"))
{var myError=new CookiesNotEnabled();myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);if(_callbackFunctionUponFailure!=undefined&&_callbackFunctionUponFailure!=null)
{_callbackFunctionUponFailure(myError);}}
if(typeof xmlQuestionDoc=='object')
{try
{var myMarkedQuestionIdParser=new XMLMarkedQuestionIdParser(xmlQuestionDoc);if(_callbackFunctionUponSuccess!=undefined&&_callbackFunctionUponSuccess!=null)
{myMarkedQuestionIdParser.setCallbackUponSuccess(_callbackFunctionUponSuccess);}
myMarkedQuestionIdParser.parseXmlReturn();}
catch(e)
{if(_callbackFunctionUponFailure!=undefined&&_callbackFunctionUponFailure!=null)
{_callbackFunctionUponFailure(e);}}}
if(typeof xmlQuestionDoc=='string')
{var myError=new NoContentFound("No Marked Question IDs Returned. Occurred in HttpMarkedQuestionIdLoader. IE 6 Specific Error");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);if(_callbackFunctionUponFailure!=undefined&&_callbackFunctionUponFailure!=null)
{_callbackFunctionUponFailure(myError);}}}
try
{var myAjaxCoreMarkedQuestionIdsRequest=new AjaxCore();myAjaxCoreMarkedQuestionIdsRequest.setOnReadySuccessCallbackfunction(receiveMarkedQuestionIdsResponse);if(_callbackFunctionUponFailure!=undefined&&_callbackFunctionUponFailure!=null)
{myAjaxCoreMarkedQuestionIdsRequest.setOnFailureCallbackfunction(_callbackFunctionUponFailure);}
myAjaxCoreMarkedQuestionIdsRequest.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedMarkedQuestions");myAjaxCoreMarkedQuestionIdsRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackFunctionUponFailure!=undefined&&_callbackFunctionUponFailure!=null)
{_callbackFunctionUponFailure(e);}}}}
function HttpAjaxQuestionInteractionLoader()
{var _questionContextId;var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.setQuestionContextId=function(qcId)
{_questionContextId=qcId;}
this.loadInteractions=function()
{receiveAjaxQuestionInteractionLoaderResponse=function(xmlQuestionDoc)
{try
{var myAjaxQuestionInteractionParser=new XMLAjaxQuestionInteractionParser(xmlQuestionDoc,_questionContextId);if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{myAjaxQuestionInteractionParser.setCallbackFunction(_callbackUponSuccess);}
myAjaxQuestionInteractionParser.parseXmlReturn();}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}
try
{if(QuestionContextRepositoryManager.doesQuestionContextExist(_questionContextId)&&QuestionContextRepositoryManager.getQuestionContextById(_questionContextId).getWhetherQuestionInteractionsFullyDownloaded())
{if(_callbackUponSuccess!=undefined&&_callbackUponSuccess!=null)
{_callbackUponSuccess();return false;}
else
{return false;}}
var myAjaxCoreQuestionRequest=new AjaxCore();myAjaxCoreQuestionRequest.setOnReadySuccessCallbackfunction(receiveAjaxQuestionInteractionLoaderResponse);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreQuestionRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
var url=GlobalVariables.getAjaxRootDirectory()+"getXmlFormattedQuestionInteractions";if(_questionContextId!=null&&_questionContextId!=undefined)
{url+="?questionContextId="+_questionContextId;}
myAjaxCoreQuestionRequest.createXHR().open("GET",url);myAjaxCoreQuestionRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QcSqvGuiGrabber(desiredQuestionContextId,desiredQuestionListId,desiredQuestionId)
{var _questionContextId=desiredQuestionContextId;var _questionListId=desiredQuestionListId;var _questionId=desiredQuestionId;var _callbackUponSuccess;var _callbackUponFailure;var _isCatRequest;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.setIsCat=function(inputVal)
{_isCatRequest=inputVal;}
this.load=function()
{try
{var myAjaxCoreQuestionRequest=new AjaxCore();myAjaxCoreQuestionRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreQuestionRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
var additionalParameters;if(_isCatRequest==true)
{additionalParameters='&cat_request=1';}
else
{additionalParameters='';}
myAjaxCoreQuestionRequest.createXHR().open("GET","getHtmlOfQcSqvGui?question_context_id="+desiredQuestionContextId+"&question_list_id="+desiredQuestionListId+"&question_id="+desiredQuestionId+additionalParameters);myAjaxCoreQuestionRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QcCreatorGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.load=function()
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCoreRequest.createXHR().open("GET","getHtmlOfQcCreatorGui");myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function FaqGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.load=function(currentState)
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
if(currentState==null||currentState==undefined)
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfFaqGui");}
else
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfFaqGui?currentState="+currentState);}
myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function FeedbackGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.load=function(currentState)
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
if(currentState==null||currentState==undefined)
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfFeedbackGui");}
else
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfFeedbackGui?currentState="+currentState);}
myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QcNewTestGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.load=function()
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCoreRequest.createXHR().open("GET","getHtmlOfQcNewTestGui");myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QcNtAncillaryGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;var _mode;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.setMode=function(md)
{_mode=md;}
this.load=function()
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
if(_mode!=null&&_mode!=undefined)
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfQcNtAncillaryGui?mode="+_mode);}
else
{myAjaxCoreRequest.createXHR().open("GET","getHtmlOfQcNtAncillaryGui");}
myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
function QcNtCompletedGuiGrabber()
{var _callbackUponSuccess;var _callbackUponFailure;this.setCallbackUponSuccess=function(fnc)
{_callbackUponSuccess=fnc;}
this.setCallbackUponFailure=function(fnc)
{_callbackUponFailure=fnc;}
this.loadQuestionContextById=function(questionContextId)
{try
{var myAjaxCoreRequest=new AjaxCore();myAjaxCoreRequest.setOnReadySuccessCallbackfunction(_callbackUponSuccess);if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{myAjaxCoreRequest.setOnFailureCallbackfunction(_callbackUponFailure);}
myAjaxCoreRequest.createXHR().open("GET","getHtmlOfQcNtCompletedGui?question_context_id="+questionContextId);myAjaxCoreRequest.getOpenXHR().send(null);}
catch(e)
{if(_callbackUponFailure!=undefined&&_callbackUponFailure!=null)
{_callbackUponFailure(e);}}}}
var PassageRepositoryManager={_passageRepository:[],addPassage:function(passedPassage)
{if(passedPassage instanceof Passage&&GlobalVariables.validateValueAsNumber(passedPassage.getPassageId()))
{if(PassageRepositoryManager.doesPassageExist(passedPassage.getPassageId())==false)
{PassageRepositoryManager._passageRepository[passedPassage.getPassageId()]=passedPassage;}
else
{ErrorLogger.logWarning("Attempted to add Passage with ID = "+passedPassage.getPassageId()+" when such a passage already existed.");}}
else
{var myError=new InvalidValueError("Attempt to add a Passage to the repository manager failed as either: (1) passed object was not a passage (2) passage ID was not valid");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},getPassageById:function(passageId)
{if(PassageRepositoryManager.doesPassageExist(passageId))
{return PassageRepositoryManager._passageRepository[passageId];}
else
{var myError=new RequestedObjectDNEError("Passage with ID of "+passageId+" does not exist in the repository.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}},doesPassageExist:function(passageId)
{if(PassageRepositoryManager._passageRepository[passageId]!=undefined&&PassageRepositoryManager._passageRepository[passageId]!=null&&PassageRepositoryManager._passageRepository[passageId]instanceof Passage)
{return true;}
else
{return false;}}};var QuestionRepositoryManager={_questionRepository:[],addQuestion:function(passedQuestion)
{if(passedQuestion instanceof Question&&GlobalVariables.validateValueAsNumber(passedQuestion.getQuestionId()))
{var questionId=passedQuestion.getQuestionId();if(QuestionRepositoryManager.doesQuestionExist(questionId)==false)
{QuestionRepositoryManager._questionRepository[passedQuestion.getQuestionId()]=passedQuestion;}}
else
{var myError=new InvalidValueError("Attempt to add a Question to the repository manager failed as either: (1) passed object was not a Question (2) question ID was not valid");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},getQuestionById:function(questionId)
{if(QuestionRepositoryManager.doesQuestionExist(questionId))
{return QuestionRepositoryManager._questionRepository[questionId];}
else
{var myError=new RequestedObjectDNEError("Question with ID of "+questionId+" does not exist in the repository. Occurred in QuestionRepositoryManager.getQuestionById()");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},doesQuestionExist:function(questionId)
{if(QuestionRepositoryManager._questionRepository[questionId]!=undefined&&QuestionRepositoryManager._questionRepository[questionId]!=null&&QuestionRepositoryManager._questionRepository[questionId]instanceof Question)
{return true;}
else
{return false;}}};var AjaxQuestionInteractionRepositoryManager={_interactionRepository:[],addInteraction:function(passedInteraction)
{if(passedInteraction instanceof AjaxQuestionInteraction&&GlobalVariables.validateValueAsNumber(passedInteraction.getQuestionId())&&GlobalVariables.validateValueAsNumber(passedInteraction.getQuestionContextId()))
{var questionId=passedInteraction.getQuestionId();var questionContextId=passedInteraction.getQuestionContextId();if(AjaxQuestionInteractionRepositoryManager.doesInteractionExist(questionId,questionContextId)==false)
{AjaxQuestionInteractionRepositoryManager._interactionRepository.push(passedInteraction);}
else
{if(AjaxQuestionInteractionRepositoryManager.getInteraction(questionId,questionContextId).getIsFinalized()!=true&&passedInteraction.getIsFinalized()==true)
{delete AjaxQuestionInteractionRepositoryManager.getInteraction(questionId,questionContextId);AjaxQuestionInteractionRepositoryManager._interactionRepository.push(passedInteraction);}
else
{}}}
else
{var myError=new InvalidValueError("Attempt to add an AjaxQuestionInteraction to the repository manager failed as the passed object was not an AjaxQuestionInteraction, Question Id was invalid, or Question Context Id was invalid.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}},doesInteractionExist:function(questionId,questionContextId)
{for(var individualQuestionContextId in AjaxQuestionInteractionRepositoryManager._interactionRepository)
{if(AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId]instanceof AjaxQuestionInteraction&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionContextId()!=undefined&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionContextId()!=null&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionContextId()==questionContextId&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionId()!=null&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionId()!=undefined&&AjaxQuestionInteractionRepositoryManager._interactionRepository[individualQuestionContextId].getQuestionId()==questionId)
{return true;}}
return false;},removeInteraction:function(questionId,questionContextId)
{var interactions=AjaxQuestionInteractionRepositoryManager._interactionRepository;for(var i=0;i<interactions.length;i++)
{if(interactions[i].getQuestionContextId()!=undefined&&interactions[i].getQuestionContextId()!=null&&interactions[i].getQuestionContextId()==questionContextId&&interactions[i].getQuestionId()!=null&&interactions[i].getQuestionId()!=undefined&&interactions[i].getQuestionId()==questionId&&interactions[i]instanceof AjaxQuestionInteraction)
{interactions.splice(i,1);}}},getInteraction:function(questionId,questionContextId)
{var interactions=AjaxQuestionInteractionRepositoryManager._interactionRepository;for(var i=0;i<interactions.length;i++)
{if(interactions[i].getQuestionContextId()!=undefined&&interactions[i].getQuestionContextId()!=null&&interactions[i].getQuestionContextId()==questionContextId&&interactions[i].getQuestionId()!=null&&interactions[i].getQuestionId()!=undefined&&interactions[i].getQuestionId()==questionId&&interactions[i]instanceof AjaxQuestionInteraction)
{return interactions[i];}}
var myError=new RequestedObjectDNEError("Attempt to retreive AjaxQuestionInteraction failed; Question Id = "+questionId+" and Question Context Id = "+questionContextId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}};var QuestionContextRepositoryManager={_questionContextRepository:new Array(),addQuestionContext:function(passedQuestionContext)
{if(passedQuestionContext instanceof QuestionContext)
{QuestionContextRepositoryManager._questionContextRepository[passedQuestionContext.getQuestionContextId()]=passedQuestionContext;}
else
{var myError=new InvalidValueError("Attempt to add an Question Context to the repository manager failed as the passed object was not an Question Context.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},doesQuestionContextExist:function(questionContextId)
{if(QuestionContextRepositoryManager._questionContextRepository[questionContextId]!=undefined&&QuestionContextRepositoryManager._questionContextRepository[questionContextId]!=null&&QuestionContextRepositoryManager._questionContextRepository[questionContextId]instanceof QuestionContext)
{return true;}
else
{return false;}},getQuestionContextById:function(questionContextId)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(questionContextId))
{return QuestionContextRepositoryManager._questionContextRepository[questionContextId];}
else
{var myError=new RequestedObjectDNEError("Question Context with ID of "+questionContextId+" does not exist in the repository.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},clearQuestionContexts:function()
{delete QuestionContextRepositoryManager._questionContextRepository;QuestionContextRepositoryManager._questionContextRepository=new Array();}};var MarkedQuestionRepositoryManager={_questionIds:new Array(),_ACTION_REMOVE_QUESTION:1,_ACTION_ADD_QUESTION:2,updateMarkQuestionInDb:function(inputQuestionId,action)
{receiveAjaxUpdateMarkQuestion=function(responseText)
{if(responseText!="0")
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_MARKED_QUESTION_CHANGE);ErrorLogger.logError("Unable to make Mark Question change with question id = "+inputQuestionId+" and action = "+action+"; Response text = "+responseText);}}
receiveCaughtAMQError=function(e)
{StatusManager.displayWarningMessage(ErrorLogger.ERROR_TEXT_CANNOT_SAVE_MARKED_QUESTION_CHANGE);ErrorLogger.logCaughtError(e,"Unable to make Mark Question change with question id = "+inputQuestionId+" and action = "+action);}
try
{var qStringActionAppendix;var myAjaxCoreMarkedQuestion=new AjaxCore();myAjaxCoreMarkedQuestion.setOnReadySuccessCallbackfunction(receiveAjaxUpdateMarkQuestion);myAjaxCoreMarkedQuestion.setOnFailureCallbackfunction(receiveCaughtAMQError);if(action==MarkedQuestionRepositoryManager._ACTION_REMOVE_QUESTION)
{qStringActionAppendix="&action=remove";}
else if(action==MarkedQuestionRepositoryManager._ACTION_ADD_QUESTION)
{qStringActionAppendix="&action=add";}
myAjaxCoreMarkedQuestion.createXHR().open("GET",GlobalVariables.getAjaxRootDirectory()+"updateMarkQuestionInDb.php?questionId="+inputQuestionId+qStringActionAppendix);myAjaxCoreMarkedQuestion.getOpenXHR().send(null);}
catch(e)
{receiveCaughtAMQError(e);}},addQuestionIdToRepository:function(inputQuestionId)
{if(!MarkedQuestionRepositoryManager.isQuestionMarkedForReview(inputQuestionId))
{MarkedQuestionRepositoryManager._questionIds.push(inputQuestionId);MarkedQuestionRepositoryManager.updateMarkQuestionInDb(inputQuestionId,MarkedQuestionRepositoryManager._ACTION_ADD_QUESTION);}
else
{ErrorLogger.logWarning("Attempted to add question id "+inputQuestionId+" to repository of Marked Questions when this question already existed in repository. MarkQuestionRepositoryManager.addQuestionIdToRepository()");}},addQuestionIdToLocalRepositoryOnly:function(inputQuestionId)
{if(!MarkedQuestionRepositoryManager.isQuestionMarkedForReview(inputQuestionId))
{MarkedQuestionRepositoryManager._questionIds.push(inputQuestionId);}
else
{ErrorLogger.logWarning("Attempted to add question id "+inputQuestionId+" to repository of Marked Questions when this question already existed in repository. MarkQuestionRepositoryManager.addQuestionIdToLocalRepositoryOnly()");}},removeQuestionIdFromRepository:function(inputQuestionId)
{if(MarkedQuestionRepositoryManager.isQuestionMarkedForReview(inputQuestionId))
{for(var i=0;i<MarkedQuestionRepositoryManager._questionIds.length;i++)
{if(MarkedQuestionRepositoryManager._questionIds[i]==inputQuestionId)
{MarkedQuestionRepositoryManager._questionIds.splice(i,1);MarkedQuestionRepositoryManager.updateMarkQuestionInDb(inputQuestionId,MarkedQuestionRepositoryManager._ACTION_REMOVE_QUESTION);}}}
else
{ErrorLogger.logWarning("Attempted to remove question id "+inputQuestionId+" from repository of Marked Questions when this question never existed in repository. MarkQuestionRepositoryManager.removeQuestionIdFromRepository()");}},isQuestionMarkedForReview:function(questionId)
{if(MarkedQuestionRepositoryManager._questionIds==undefined||MarkedQuestionRepositoryManager._questionIds==null)
{return false;}
for(var element in MarkedQuestionRepositoryManager._questionIds)
{if(MarkedQuestionRepositoryManager._questionIds[element]==questionId)
{return true;}}
return false;},clearMarkedQuestions:function()
{delete MarkedQuestionRepositoryManager._questionIds;MarkedQuestionRepositoryManager._questionIds=new Array();}};var QuestionMetaDataRepositoryManager={_questionRepository:[],addQuestionMetaData:function(passedQuestion)
{if(passedQuestion instanceof QuestionMetaData&&GlobalVariables.validateValueAsNumber(passedQuestion.getQuestionId()))
{var questionId=passedQuestion.getQuestionId();if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(questionId)==false)
{QuestionMetaDataRepositoryManager._questionRepository[passedQuestion.getQuestionId()]=passedQuestion;}
else
{delete QuestionMetaDataRepositoryManager._questionRepository[passedQuestion.getQuestionId()];QuestionMetaDataRepositoryManager._questionRepository[passedQuestion.getQuestionId()]=passedQuestion;}}
else
{var myError=new InvalidValueError("Attempt to add a QuestionMetaData to the repository manager failed as either: (1) passed object was not a QuestionMetaData (2) question ID was not valid");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},getQuestionMetaDataById:function(questionId)
{if(QuestionMetaDataRepositoryManager.doesQuestionMetaDataExist(questionId))
{return QuestionMetaDataRepositoryManager._questionRepository[questionId];}
else
{var myError=new RequestedObjectDNEError("Attempt to get Question Meta Data with Question Id = "+questionId+" failed as no entry in repository manager existed.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},doesQuestionMetaDataExist:function(questionId)
{if(QuestionMetaDataRepositoryManager._questionRepository[questionId]!=undefined&&QuestionMetaDataRepositoryManager._questionRepository[questionId]!=null&&QuestionMetaDataRepositoryManager._questionRepository[questionId]instanceof QuestionMetaData)
{return true;}
else
{return false;}}};var QuestionListRepositoryManager={_listRepository:[],addList:function(passedList)
{if(passedList instanceof QuestionList&&GlobalVariables.validateValueAsNumber(passedList.getQuestionListId()))
{QuestionListRepositoryManager._listRepository[passedList.getQuestionListId()]=passedList;}
else
{var myError=new InvalidValueError("Attempt to add a Question List to the repository manager failed as either: (1) passed object was not a Question List (2) question list ID was not valid");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},getListById:function(listId)
{if(QuestionListRepositoryManager.doesListExist(listId))
{return QuestionListRepositoryManager._listRepository[listId];}
else
{var myError=new RequestedObjectDNEError("Attempt to get Question List with list Id = "+listId+" failed as no entry in repository manager existed.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}},doesListExist:function(listId)
{if(QuestionListRepositoryManager._listRepository[listId]!=undefined&&QuestionListRepositoryManager._listRepository[listId]!=null&&QuestionListRepositoryManager._listRepository[listId]instanceof QuestionList)
{return true;}
else
{return false;}}};function XMLPassageParser(inputXmlPassageDocument)
{if(inputXmlPassageDocument==null||inputXmlPassageDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLPassageParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlPassageDoc=inputXmlPassageDocument;if(xmlPassageDoc.getElementsByTagName("passage")==undefined||xmlPassageDoc.getElementsByTagName("passage")==null||xmlPassageDoc.getElementsByTagName("passage").length==undefined||xmlPassageDoc.getElementsByTagName("passage").length==null)
{var myError=new NoContentFound("Required field Passage missing from XML response or Passage.length is not avaiable. Occurred in XMLPassageParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
else
{var numPassagesReturned=xmlPassageDoc.getElementsByTagName("passage").length;}
var xmlPassageCallcackFunction;this.setCallbackFunction=function(inputFunction)
{xmlPassageCallcackFunction=inputFunction;}
this.parseXmlPassageReturn=function()
{if(numPassagesReturned==0)
{var myError=new NoContentFound("No Passages Returned. Occurred in XMLPassageParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
if(xmlPassageDoc.getElementsByTagName("passageId").length==0||xmlPassageDoc.getElementsByTagName("passageHtml").length==0)
{var myError=RequiredFieldMissing("Required field(s) passage id and passage html missing from XML response.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
else
{for(var i=0;i<numPassagesReturned;i++)
{var passageId=xmlPassageDoc.getElementsByTagName("passageId")[i].childNodes[0].nodeValue;if(!GlobalVariables.validateValueAsNumber(passageId))
{var myError=new InvalidValueError("Field passage id in XML response handeled by XMLPassageParser is not valid; received value = "+passageId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(!PassageRepositoryManager.doesPassageExist(passageId))
{if(xmlPassageDoc.getElementsByTagName("passageHtml").length!=0&&xmlPassageDoc.getElementsByTagName("passageHtml")[i]!=undefined)
{var passageHtml=xmlPassageDoc.getElementsByTagName("passageHtml")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Passage Html is missing from XML response as handeled by XMLPassageParser with Passage Id: "+passageId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var passageABC=new Passage();passageABC.setPassageHtml(passageHtml);passageABC.setPassageId(passageId);PassageRepositoryManager.addPassage(passageABC);}
delete passageId;}}
if(xmlPassageCallcackFunction!=null&&xmlPassageCallcackFunction!=undefined)
{xmlPassageCallcackFunction();}}}
function XMLQuestionParser(inputXmlDocument)
{if(inputXmlDocument==null||inputXmlDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLQuestionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlDoc=inputXmlDocument;var xmlQuestionCallbackFunction;if(xmlDoc.getElementsByTagName("question")==undefined||xmlDoc.getElementsByTagName("question")==null||xmlDoc.getElementsByTagName("question").length==undefined||xmlDoc.getElementsByTagName("question").length==null)
{var myError=new NoContentFound("Required field Question missing from XML response or Question.length is not avaiable. Occurred in XMLQuestionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numQuestionsReturned=xmlDoc.getElementsByTagName("question").length;this.setCallbackFunction=function(inputFunction)
{xmlQuestionCallbackFunction=inputFunction;}
this.parseXmlReturn=function()
{if(numQuestionsReturned==0)
{var myError=new NoContentFound("No Questions Returned. Occurred in XMLQuestionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
for(var i=0;i<numQuestionsReturned;i++)
{if(xmlDoc.getElementsByTagName("questionId").length!=0&&xmlDoc.getElementsByTagName("questionId")[i]!=undefined)
{var questionId=xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue;if(QuestionRepositoryManager.doesQuestionExist(questionId))
{continue;}
else
{var questionId=xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue;}}
else
{var myError=RequiredFieldMissing("Required field Question ID is missing from XML response as handeled by XMLQuestionParser");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("questionHtml").length!=0&&xmlDoc.getElementsByTagName("questionHtml")[i]!=undefined)
{var questionHtml=xmlDoc.getElementsByTagName("questionHtml")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Question Html is missing from XML response as handeled by XMLQuestionParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("questionType").length!=0&&xmlDoc.getElementsByTagName("questionType")[i]!=undefined)
{var questionType=xmlDoc.getElementsByTagName("questionType")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Question Type is missing from XML response as handeled by XMLQuestionParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("correctAnswer").length!=0&&xmlDoc.getElementsByTagName("correctAnswer")[i]!=undefined)
{var correctAnswer=xmlDoc.getElementsByTagName("correctAnswer")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Correct Answer is missing from XML response as handeled by XMLQuestionParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("explanationHtml").length!=0&&xmlDoc.getElementsByTagName("explanationHtml")[i]!=undefined)
{var explanationHtml=xmlDoc.getElementsByTagName("explanationHtml")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Explanation Html is missing from XML response as handeled by XMLQuestionParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var questionABC=new Question();questionABC.setQuestionId(questionId);questionABC.setQuestionHtml(questionHtml);questionABC.setQuestionCategoryType(questionType);questionABC.setCorrectAnswer(correctAnswer);questionABC.setExplanationHtml(explanationHtml);if(xmlDoc.getElementsByTagName("questionTitle").length!=0&&xmlDoc.getElementsByTagName("questionTitle")[i]!=undefined&&xmlDoc.getElementsByTagName("questionTitle")[i].childNodes[0]!=undefined)
{questionABC.setQuestionTitle(xmlDoc.getElementsByTagName("questionTitle")[i].childNodes[0].nodeValue);}
if(xmlDoc.getElementsByTagName("hintHtml").length!=0&&xmlDoc.getElementsByTagName("hintHtml")[i]!=undefined&&xmlDoc.getElementsByTagName("hintHtml")[i].childNodes[0]!=undefined)
{questionABC.setHintHtml(xmlDoc.getElementsByTagName("hintHtml")[i].childNodes[0].nodeValue);}
if(xmlDoc.getElementsByTagName("passageId").length!=0&&xmlDoc.getElementsByTagName("passageId")[i]!=undefined&&xmlDoc.getElementsByTagName("passageId")[i].childNodes[0]!=undefined)
{questionABC.setPassageId(xmlDoc.getElementsByTagName("passageId")[i].childNodes[0].nodeValue);}
QuestionRepositoryManager.addQuestion(questionABC);}
if(xmlQuestionCallbackFunction!=undefined&&xmlQuestionCallbackFunction!=null)
{xmlQuestionCallbackFunction();}}}
function XMLQuestionMetaDataParser(inputXmlDocument)
{if(inputXmlDocument==null||inputXmlDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLQuestionMetaDataParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlDoc=inputXmlDocument;var xmlQuestionCallbackFunction;if(xmlDoc.getElementsByTagName("question")==undefined||xmlDoc.getElementsByTagName("question")==null||xmlDoc.getElementsByTagName("question").length==undefined||xmlDoc.getElementsByTagName("question").length==null)
{var myError=new NoContentFound("Required field Question missing from XML response or Question.length is not avaiable. Occurred in XMLQuestionMetaDataParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numQuestionsReturned=xmlDoc.getElementsByTagName("question").length;this.setCallbackFunction=function(inputFunction)
{xmlQuestionCallbackFunction=inputFunction;}
this.parseXmlReturn=function()
{if(numQuestionsReturned==0)
{var myError=new NoContentFound("No Questions Returned. Occurred in XMLQuestionMetaDataParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
for(var i=0;i<numQuestionsReturned;i++)
{if(xmlDoc.getElementsByTagName("questionId").length!=0&&xmlDoc.getElementsByTagName("questionId")[i]!=undefined)
{var questionId=xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Question ID is missing from XML response as handeled by XMLQuestionMetaDataParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("questionType").length!=0&&xmlDoc.getElementsByTagName("questionType")[i]!=undefined)
{var questionCategoryType=xmlDoc.getElementsByTagName("questionType")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Question Type is missing from XML response as handeled by XMLQuestionMetaDataParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("questionTitle").length!=0&&xmlDoc.getElementsByTagName("questionType")[i]!=undefined)
{var questionTitle=xmlDoc.getElementsByTagName("questionTitle")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Question Title is missing from XML response as handeled by XMLQuestionMetaDataParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("correctAnswer").length!=0&&xmlDoc.getElementsByTagName("correctAnswer")[i]!=undefined)
{var correctAnswer=xmlDoc.getElementsByTagName("correctAnswer")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Correct Answer is missing from XML response as handeled by XMLQuestionMetaDataParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlDoc.getElementsByTagName("difficulty").length!=0&&xmlDoc.getElementsByTagName("difficulty")[i]!=undefined)
{var questionDifficulty=xmlDoc.getElementsByTagName("difficulty")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field Difficulty is missing from XML response as handeled by XMLQuestionMetaDataParser with Question Id: "+xmlDoc.getElementsByTagName("questionId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var questionABC=new QuestionMetaData();questionABC.setQuestionId(questionId);questionABC.setQuestionCategoryType(questionCategoryType);questionABC.setQuestionTitle(questionTitle);questionABC.setCorrectAnswer(correctAnswer);questionABC.setQuestionDifficulty(questionDifficulty);QuestionMetaDataRepositoryManager.addQuestionMetaData(questionABC);}
if(xmlQuestionCallbackFunction!=undefined&&xmlQuestionCallbackFunction!=null)
{xmlQuestionCallbackFunction();}}}
function XMLAjaxQuestionInteractionParser(inputXmlDocument,inputQuestionContextId)
{if(inputXmlDocument==null||inputXmlDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLAjaxQuestionInteractionParser. QCID = "+inputQuestionContextId);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var _this=this;this.questionContextId=null;if(inputQuestionContextId!=undefined&&inputQuestionContextId!=null)
{this.questionContextId=inputQuestionContextId;}
var xmlAQIDoc=inputXmlDocument;if(xmlAQIDoc.getElementsByTagName("aqi")==undefined||xmlAQIDoc.getElementsByTagName("aqi")==null||xmlAQIDoc.getElementsByTagName("aqi").length==undefined||xmlAQIDoc.getElementsByTagName("aqi").length==null)
{var myError=new NoContentFound("Required field aqi missing from XML response or aqi.length is not avaiable. Occurred in XMLAjaxQuestionInteractionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numAQIReturned=xmlAQIDoc.getElementsByTagName("aqi").length;var xmlAQICallcackFunction;this.setCallbackFunction=function(inputFunction)
{xmlAQICallcackFunction=inputFunction;}
this.parseXmlReturn=function()
{if(numAQIReturned==0)
{if(QuestionContextRepositoryManager.doesQuestionContextExist(this.questionContextId))
{QuestionContextRepositoryManager.getQuestionContextById(this.questionContextId).setWhetherQuestionInteractionsFullyDownloaded(true);}}
else
{for(var i=0;i<numAQIReturned;i++)
{if(xmlAQIDoc.getElementsByTagName("qCId").length!=0&&xmlAQIDoc.getElementsByTagName("qCId")[i]!=undefined)
{var questionContextId=xmlAQIDoc.getElementsByTagName("qCId")[i].childNodes[0].nodeValue;if(questionContextId!=this.questionContextId)
{var myError=new RequestedObjectDNEError("Requested Question Interactions associated with Question Context Id = "+this.questionContextId+". Returned Question Interactions associated with Question Context Id: "+questionContextId+". Occurred in XMLAjaxQuestionInteractionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}}
else
{var myError=RequiredFieldMissing("Required field qCId is missing from XML response as handeled by XMLAjaxQuestionInteractionParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlAQIDoc.getElementsByTagName("qId").length!=0&&xmlAQIDoc.getElementsByTagName("qId")[i]!=undefined)
{var questionId=xmlAQIDoc.getElementsByTagName("qId")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field qId is missing from XML response as handeled by XMLAjaxQuestionInteractionParser with Question Context Id: "+xmlAQIDoc.getElementsByTagName("qCId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlAQIDoc.getElementsByTagName("tstamp").length!=0&&xmlAQIDoc.getElementsByTagName("tstamp")[i]!=undefined)
{var timestamp=xmlAQIDoc.getElementsByTagName("tstamp")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field qId is missing from XML response as handeled by XMLAjaxQuestionInteractionParser with Question Context Id: "+xmlAQIDoc.getElementsByTagName("qCId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var ajaxQuestionInteraction=new AjaxQuestionInteraction(questionId);ajaxQuestionInteraction.setTimestamp(timestamp);ajaxQuestionInteraction.setQuestionId(questionId);ajaxQuestionInteraction.setQuestionContextId(questionContextId);if(xmlAQIDoc.getElementsByTagName("xsa").length!=0&&xmlAQIDoc.getElementsByTagName("xsa")[i]!=undefined&&xmlAQIDoc.getElementsByTagName("xsa")[i].childNodes[0]!=undefined&&xmlAQIDoc.getElementsByTagName("xsa")[i].childNodes[0].nodeValue.length>0)
{var selected_answer=xmlAQIDoc.getElementsByTagName("xsa")[i].childNodes[0].nodeValue;}
else
{var selected_answer=GlobalVariables.ANSWER_LEFT_BLANK;}
ajaxQuestionInteraction.setSelectedAnswer(selected_answer);if(xmlAQIDoc.getElementsByTagName("msa")[i]!=undefined&&xmlAQIDoc.getElementsByTagName("msa")[i].length!=0&&xmlAQIDoc.getElementsByTagName("msa")[i].childNodes[0]!=undefined&&xmlAQIDoc.getElementsByTagName("msa")[i].childNodes[0].nodeValue.length>0)
{var millisecondsFinalAnswer=xmlAQIDoc.getElementsByTagName("msa")[i].childNodes[0].nodeValue;ajaxQuestionInteraction.setMillisecondsToFinalAnswer(millisecondsFinalAnswer);}
ajaxQuestionInteraction.setIsFinalized(true);AjaxQuestionInteractionRepositoryManager.addInteraction(ajaxQuestionInteraction);}
if(QuestionContextRepositoryManager.doesQuestionContextExist(questionContextId))
{QuestionContextRepositoryManager.getQuestionContextById(questionContextId).setWhetherQuestionInteractionsFullyDownloaded(true);}}
if(xmlAQICallcackFunction!=null&&xmlAQICallcackFunction!=undefined)
{xmlAQICallcackFunction();}}}
function XMLQuestionListParser(inputXmlQuestionListDocument)
{if(inputXmlQuestionListDocument==null||inputXmlQuestionListDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLQuestionListParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlQLDoc=inputXmlQuestionListDocument;if(xmlQLDoc.getElementsByTagName("questionList")==undefined||xmlQLDoc.getElementsByTagName("questionList")==null||xmlQLDoc.getElementsByTagName("questionList").length==undefined||xmlQLDoc.getElementsByTagName("questionList").length==null)
{var myError=RequiredFieldMissing("Required field Question List missing from XML response or questionList.length is not avaiable. Occurred in XMLQuestionListParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numQLReturned=xmlQLDoc.getElementsByTagName("questionList").length;var xmlQLCallcackFunction;this.setCallbackFunction=function(inputFunction)
{xmlQLCallcackFunction=inputFunction;}
this.parseXmlQuestionListReturn=function()
{if(numQLReturned==0)
{var myError=new NoContentFound("No Question Lists Returned. Occurred in XMLQuestionListParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
else
{for(var i=0;i<numQLReturned;i++)
{if(xmlQLDoc.getElementsByTagName("lId")[i]!=undefined&&xmlQLDoc.getElementsByTagName("lId")[i].length!=0)
{var questionListId=parseInt(xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field lId is missing from XML response as handeled by XMLQuestionListParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var abcQuestionList=new QuestionList(questionListId);if(xmlQLDoc.getElementsByTagName("type")[i]!=undefined&&xmlQLDoc.getElementsByTagName("type")[i].length!=0)
{abcQuestionList.setListType(xmlQLDoc.getElementsByTagName("type")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Type is missing from XML response as handeled by XMLQuestionListParser with Question List Id: "+xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlQLDoc.getElementsByTagName("title")[i]!=undefined&&xmlQLDoc.getElementsByTagName("title")[i].length!=0)
{abcQuestionList.setQuestionListTitle(xmlQLDoc.getElementsByTagName("title")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Title is missing from XML response as handeled by XMLQuestionListParser with Question List Id: "+xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlQLDoc.getElementsByTagName("memberId")[i]!=undefined&&xmlQLDoc.getElementsByTagName("memberId")[i].length!=0&&xmlQLDoc.getElementsByTagName("memberId")[i].childNodes[0]!=undefined&&xmlQLDoc.getElementsByTagName("memberId")[i].childNodes[0].nodeValue.length>0)
{abcQuestionList.setQuestionListCreator(xmlQLDoc.getElementsByTagName("memberId")[i].childNodes[0].nodeValue);}
else
{abcQuestionList.setQuestionListCreator('');}
if(xmlQLDoc.getElementsByTagName("listContents")[i]!=undefined&&xmlQLDoc.getElementsByTagName("listContents")[i].length!=0)
{var numOfIds=xmlQLDoc.getElementsByTagName("listContents")[i].childNodes.length;var arrOfIds=new Array();for(var j=0;j<numOfIds;j++)
{arrOfIds.push(xmlQLDoc.getElementsByTagName("listContents")[i].childNodes[j].firstChild.nodeValue);}
abcQuestionList.loadQuestionListContentsFromArray(arrOfIds);}
else
{var myError=RequiredFieldMissing("Required field List Contents is missing from XML response as handeled by XMLQuestionListParser with Question List Id: "+xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlQLDoc.getElementsByTagName("adminCreated")[i]!=undefined&&xmlQLDoc.getElementsByTagName("adminCreated")[i].length!=0)
{abcQuestionList.setAdminCreated(xmlQLDoc.getElementsByTagName("adminCreated")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Admin Created is missing from XML response as handeled by XMLQuestionListParser with Question List Id: "+xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlQLDoc.getElementsByTagName("createdTimestamp")[i]!=undefined&&xmlQLDoc.getElementsByTagName("createdTimestamp")[i].length!=0)
{abcQuestionList.setQuestionListCreatedTimestamp(xmlQLDoc.getElementsByTagName("createdTimestamp")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Created Timestamp is missing from XML response as handeled by XMLQuestionListParser with Question List Id: "+xmlQLDoc.getElementsByTagName("lId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
try
{QuestionListRepositoryManager.addList(abcQuestionList);}
catch(e)
{ErrorLogger.logCaughtError(e,"Error caught in adding question to list in XMLQuestionListParser.parseXmlQuestionListReturn();");throw e;}}}
if(xmlQLCallcackFunction!=null&&xmlQLCallcackFunction!=undefined)
{xmlQLCallcackFunction();}}}
function XMLMarkedQuestionIdParser(inputXmlMQDocument)
{if(inputXmlMQDocument==null||inputXmlMQDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLMarkedQuestionIdParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlMQIdDoc=inputXmlMQDocument;if(xmlMQIdDoc.getElementsByTagName("qId")==undefined||xmlMQIdDoc.getElementsByTagName("qId")==null||xmlMQIdDoc.getElementsByTagName("qId").length==undefined||xmlMQIdDoc.getElementsByTagName("qId").length==null)
{var myError=RequiredFieldMissing("Required field qId  missing from XML response or qId.length is not avaiable. Occurred in XMLMarkedQuestionIdParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numMQIdReturned=xmlMQIdDoc.getElementsByTagName("qId").length;var xmlMQIdCallcackFunction;this.setCallbackUponSuccess=function(inputFunction)
{xmlMQIdCallcackFunction=inputFunction;}
this.parseXmlReturn=function()
{if(numMQIdReturned!=0)
{for(var i=0;i<numMQIdReturned;i++)
{if(xmlMQIdDoc.getElementsByTagName("qId")[i]!=undefined&&xmlMQIdDoc.getElementsByTagName("qId")[i].length!=0)
{var questionId=xmlMQIdDoc.getElementsByTagName("qId")[i].childNodes[0].nodeValue;MarkedQuestionRepositoryManager.addQuestionIdToLocalRepositoryOnly(questionId);}
else
{var myError=RequiredFieldMissing("Required field qId is missing from XML response as handeled by XMLMarkedQuestionIdParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}}}
if(xmlMQIdCallcackFunction!=null&&xmlMQIdCallcackFunction!=undefined)
{xmlMQIdCallcackFunction();}}}
function XMLQuestionContextParser(inputXmlQCDocument)
{if(inputXmlQCDocument==null||inputXmlQCDocument==undefined)
{var myError=new XmlParserDocumentError("No XML document passed to parser in XMLQuestionContextParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var xmlContextDoc=inputXmlQCDocument;if(xmlContextDoc.getElementsByTagName("questionContext")==undefined||xmlContextDoc.getElementsByTagName("questionContext")==null||xmlContextDoc.getElementsByTagName("questionContext").length==undefined||xmlContextDoc.getElementsByTagName("questionContext").length==null)
{var myError=RequiredFieldMissing("Required field Question Context  missing from XML response or qId.length is not avaiable. Occurred in XMLQuestionContextParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var numContextReturned=xmlContextDoc.getElementsByTagName("questionContext").length;var searchMode=null;if(xmlContextDoc.getElementsByTagName("searchMode").length>0)
{searchMode=xmlContextDoc.getElementsByTagName("searchMode")[0].childNodes[0].nodeValue;}
var xmlContextCallcackFunction;this.setCallbackFunction=function(inputFunction)
{xmlContextCallcackFunction=inputFunction;}
this.parseXmlContextReturn=function()
{if(searchMode=="searchByAuth")
{GlobalDownloadStatus.MY_QC_HISTORY_DOWNLOADED=true;}
if(xmlContextDoc.getElementsByTagName("questionContext").length==0||xmlContextDoc.getElementsByTagName("questionContext").length==0||numContextReturned==0)
{var myError=new NoContentFound("No Question Context(s) Returned. Occurred in XMLQuestionContextParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_LOW);throw myError;}
else
{for(var i=0;i<numContextReturned;i++)
{if(xmlContextDoc.getElementsByTagName("qcId")[i]!=undefined&&xmlContextDoc.getElementsByTagName("qcId")[i].length!=0)
{var questionContextId=xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue;}
else
{var myError=RequiredFieldMissing("Required field qcId is missing from XML response as handeled by XMLQuestionContextParser.");myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
var questioonContextAbc=new QuestionContext(questionContextId);if(xmlContextDoc.getElementsByTagName("type")[i]!=undefined&&xmlContextDoc.getElementsByTagName("type")[i].length!=0)
{questioonContextAbc.setQuestionContextType(xmlContextDoc.getElementsByTagName("type")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Type is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("title")[i]!=undefined&&xmlContextDoc.getElementsByTagName("title")[i].length!=0)
{questioonContextAbc.setQuestionContextTitle(xmlContextDoc.getElementsByTagName("title")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Title is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("createdTimestamp")[i]!=undefined&&xmlContextDoc.getElementsByTagName("createdTimestamp")[i].length!=0)
{questioonContextAbc.setCreatedTimestamp(xmlContextDoc.getElementsByTagName("createdTimestamp")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Created Timestamp is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("permissions")[i]!=undefined&&xmlContextDoc.getElementsByTagName("permissions")[i].length!=0)
{questioonContextAbc.setPermissions(xmlContextDoc.getElementsByTagName("permissions")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Permissions is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("auth")[i]!=undefined&&xmlContextDoc.getElementsByTagName("auth")[i].length!=0)
{questioonContextAbc.setAuthorization(xmlContextDoc.getElementsByTagName("auth")[i].childNodes[0].nodeValue);}
else
{var myError=RequiredFieldMissing("Required field Auth is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("listIds")[i]!=undefined&&xmlContextDoc.getElementsByTagName("listIds")[i].length!=0)
{var questionListIds=xmlContextDoc.getElementsByTagName("listIds")[i].childNodes[0].nodeValue;questionListIds=questionListIds.split(", ");for(var j=0;j<questionListIds.length;j++)
{var listId=Number(questionListIds[j]);questioonContextAbc.addQuestionListId(listId);}}
else
{var myError=RequiredFieldMissing("Required field List Ids is missing from XML response as handeled by XMLQuestionContextParser with Question Context Id: "+xmlContextDoc.getElementsByTagName("qcId")[i].childNodes[0].nodeValue);myError.setLevel(ErrorLogger.ERROR_TYPE_SEVERE);throw myError;}
if(xmlContextDoc.getElementsByTagName("additionalInformation")[i]!=undefined&&xmlContextDoc.getElementsByTagName("additionalInformation")[i].length!=0&&xmlContextDoc.getElementsByTagName("additionalInformation")[i].childNodes[0]!=undefined)
{questioonContextAbc.setAdditionalInformation(xmlContextDoc.getElementsByTagName("additionalInformation")[i].childNodes[0].nodeValue);}
else
{questioonContextAbc.setAdditionalInformation('');}
QuestionContextRepositoryManager.addQuestionContext(questioonContextAbc);if(questioonContextAbc.getQuestionContextType()==GlobalVariables.TYPE_CAT_TEST_FULL&&GlobalVariables.getAdditionalInformationVariableForQuestionContext(questionContextId,'current_state')!=null)
{questioonContextAbc.setCurrentPracticeTestState(GlobalVariables.getAdditionalInformationVariableForQuestionContext(questionContextId,'current_state'));}}}
if(xmlContextCallcackFunction!=null&&xmlContextCallcackFunction!=undefined)
{xmlContextCallcackFunction();}}}