function GetXmlHttp(){var xmlhttp=false;if(BrowserTools.IsInternetExplorer()&&BrowserTools.GetMajorVersion()<7){xmlhttp=GetXmlHttpIE6ActiveXScript();}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}return xmlhttp;}function GetXmlHttpIE6ActiveXScript(){return null;}function MetafuseAjaxPostBackObject(){this.EnableDebug=false;this.CallBackQueue=new Array();};MetafuseAjaxPostBackObject.prototype.DoAjaxPostSimple=MetafuseAjaxPostBackObject_DoAjaxPostSimple;function MetafuseAjaxPostBackObject_DoAjaxPostSimple(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingNearHTML,includeVeil,blockOtherCallBacks,metafuseAjaxPostBackObjectServerResponse){this.DoAjaxPostComplex(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingNearHTML,includeVeil,blockOtherCallBacks,metafuseAjaxPostBackObjectServerResponse,null,true,true,null);};MetafuseAjaxPostBackObject.prototype.DoAjaxPostBack=MetafuseAjaxPostBackObject_DoAjaxPostBack;function MetafuseAjaxPostBackObject_DoAjaxPostBack(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingNearHTML,includeVeil,blockOtherCallBacks,metafuseAjaxPostBackObjectServerResponse){this.DoAjaxPostComplex(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingNearHTML,includeVeil,blockOtherCallBacks,metafuseAjaxPostBackObjectServerResponse,null,false,false,null);};MetafuseAjaxPostBackObject.prototype.DoAjaxPostComplex=MetafuseAjaxPostBackObject_DoAjaxPostComplex;function MetafuseAjaxPostBackObject_DoAjaxPostComplex(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingNearHTML,includeVeil,blockOtherCallBacks,metafuseAjaxPostBackObjectServerResponse,additionalNameValueParametersEncoded,excludeViewState,excludeAllFormElements,elementNamesToSendArray){if(UITools.EnableDebugOutput){this.EnableDebug=true;}if(causesValidation&&IsBrowserInternetExplorer()){if(typeof(Page_ClientValidate)=='function'){Page_ClientValidate();}if(!Page_IsValid){return;}}var multipleCheckboxHash=new Object();var theData='';var payload=new Array();var theform=document.forms[0];var thePage=window.location.pathname+window.location.search;var sobj=new String(thePage);if(sobj.lastIndexOf("/")==(sobj.length-1)){thePage=thePage+"default.aspx";};var eName='';if(!eventTarget){eventTarget='';}if(!eventArgument){eventArgument='';}var timestamp=new Date().valueOf();var viewstate="";payload[0]='__AJAXPOSTBACKTS='+timestamp;payload[1]='__EVENTTARGET='+escape(eventTarget.split("$").join(":"));payload[2]='__EVENTARGUMENT='+encodeURIComponent(eventArgument);if(!excludeViewState){viewstate+='__VIEWSTATE='+escape(theform.__VIEWSTATE.value).replace(new RegExp('\\+','g'),'%2b')+'&';}if(!excludeAllFormElements){var radioElements=new Object();for(var i=0;i<theform.elements.length;i++){var element=theform.elements[i];eName=element.name;if(eName&&eName!=''){if(eName=='__EVENTTARGET'||eName=='__EVENTARGUMENT'||eName=='__VIEWSTATE'){}else{var process=true;if(element.type=="radio"){if(radioElements[eName]!=null){process=false;}else{radioElements[eName]=true;}}if(process){var getFormElementValue=true;var elementValue="";if(element.type=="checkbox"){var checkboxElement=theform[eName];if(checkboxElement.length&&checkboxElement.length>1){if(element.checked){var checkboxValueArray=multipleCheckboxHash[eName];if(checkboxValueArray==null){checkboxValueArray=new Array();multipleCheckboxHash[eName]=checkboxValueArray;}checkboxValueArray[checkboxValueArray.length]=element.value;}}else{elementValue=FormTools.GetFormElementValue(element);}}else{elementValue=FormTools.GetFormElementValue(element);}if(elementValue!=""&&element.type=="select-multiple"){var multipleSelectValues=elementValue.split(",");for(var z=0;z<multipleSelectValues.length;z++){payload[payload.length]=encodeURIComponent(eName.split("$").join(":"))+'='+encodeURIComponent(multipleSelectValues[z]);}}else if(elementValue!=""||element.type!="checkbox"){payload[payload.length]=encodeURIComponent(eName.split("$").join(":"))+'='+encodeURIComponent(elementValue);}}}}}}if(multipleCheckboxHash!=null){for(var key in multipleCheckboxHash){var cbArray=multipleCheckboxHash[key];payload[payload.length]=encodeURIComponent(key.split("$").join(":"))+'='+encodeURIComponent(cbArray.join(','));}}if(additionalNameValueParametersEncoded){theData+="&"+additionalNameValueParametersEncoded;}payload[payload.length]=viewstate;theData=payload.join('&');var serverResponse;if(metafuseAjaxPostBackObjectServerResponse==null){serverResponse=new MetafuseAjaxPostBackObjectServerResponse()}else{serverResponse=metafuseAjaxPostBackObjectServerResponse;}if(elementToShowProcessingNear){serverResponse.ElementToShowProcessingNear=elementToShowProcessingNear;}if(processingNearHTML!=null&&processingNearHTML!=""){serverResponse.ProcessingNearHTML=processingNearHTML;}serverResponse.IncludeVeil=includeVeil;if(serverResponse.XmlHttp){if(blockOtherCallBacks||this.CallBackQueue.length>0){this.CallBackQueue[this.CallBackQueue.length]=serverResponse.CallBackID;var waiting=true;while(waiting==true){var nextStamp=this.CallBackQueue[0];if(nextStamp==serverResponse.CallBackID){waiting=false;}else{alert("Another call is currently being processed.  Please wait.");}}if(!blockOtherCallBacks){this.CallBackQueue=this.CallBackQueue.splice(0,1);}}serverResponse.ShowProcessingMessage();var oThis=this;serverResponse.XmlHttp.open('POST',thePage,true);serverResponse.XmlHttp.onreadystatechange=function(){oThis.ReadyStateChange(serverResponse);};serverResponse.XmlHttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');serverResponse.XmlHttp.setRequestHeader("Content-length",theData.length);serverResponse.XmlHttp.send(theData);}else{alert("Unable to create an XmlHttp object.  Please be sure you are using a modern browser (IE 5.5+, FireFox 1.1+, or Safari 1.1+) and that your ActiveX security setting, \"Script ActiveX controls marked safe for scripting,\" is enabled.");}};MetafuseAjaxPostBackObject.prototype.ReadyStateChange=function(serverResponse){if(this.EnableDebug==true){serverResponse.EnableDebug=this.EnableDebug;}if(serverResponse.XmlHttp.readyState==1){serverResponse.StartDateTime=new Date();window.status="AJAX call connecting...";serverResponse.OnLoading(serverResponse);}else if(serverResponse.XmlHttp.readyState==2){if(!serverResponse.StartDateTime){serverResponse.StartDateTime=new Date();}window.status="AJAX call loaded...";serverResponse.OnLoaded(serverResponse);}else if(serverResponse.XmlHttp.readyState==3){window.status="AJAX call processing...";serverResponse.OnInteractive(serverResponse);}else if(serverResponse.XmlHttp.readyState==4){window.status="AJAX call received...";if(serverResponse.XmlHttp.status==0){serverResponse.OnAbort(serverResponse);serverResponse.HideProcessingMessage();this.DeQueueCallBackQueue(serverResponse);}else if((serverResponse.XmlHttp.status==200&&serverResponse.XmlHttp.statusText=="OK"&&serverResponse.XmlHttp.responseText.substring(0,16)!="<!--ERRORPAGE-->")||(BrowserTools.IsSafari()&&serverResponse.XmlHttp.responseText==null)){var responseText=serverResponse.XmlHttp.responseText;if(responseText!=null&&responseText.length>0){var isValidString=responseText.substring(0,1);serverResponse.ResponseText=responseText.substring(1,responseText.length-1);if(isValidString=="0"){serverResponse.IsValid=false;}}serverResponse.OnBeforeExecuteSuccessfulResponse(serverResponse);serverResponse.OnExecuteSuccessfulResponse(serverResponse);var endTime=new Date;serverResponse.EndDateTime=endTime;var deltaTime="";if(serverResponse.StartDateTime){try{deltaTime=((endTime.getTime()-serverResponse.StartDateTime.getTime())/1000);}catch(ex){}}if(deltaTime!=""){window.status="AJAX call complete - "+deltaTime.toString()+" secs";}else{window.status="AJAX call complete";}serverResponse.HideProcessingMessage();this.DeQueueCallBackQueue(serverResponse);serverResponse.OnAfterExecuteSuccessfulResponse(serverResponse);}else{serverResponse.OnBeforeProcessErrorMessage(serverResponse);serverResponse.OnProcessErrorMessage(serverResponse);window.status="AJAX call error";serverResponse.HideProcessingMessage();this.DeQueueCallBackQueue(serverResponse);serverResponse.OnAfterProcessErrorMessage(serverResponse);}}};MetafuseAjaxPostBackObject.prototype.DeQueueCallBackQueue=function(serverResponse){if(this.CallBackQueue.length>0){if(serverResponse.CallBackID==this.CallBackQueue[0]){this.CallBackQueue.splice(0,1);}}};var Ajax=new MetafuseAjaxPostBackObject();function MetafuseAjaxPostBackObjectServerResponse(){this.CallBackTS=new Date().valueOf();this.CallBackID=NewGuid()+this.CallBackTS;this.StartDateTime;this.EndDateTime;this.XmlHttp=GetXmlHttp();this.ElementToShowProcessingNear=null;this.ProcessingDiv=null;this.ProcessingIFrame=null;this.ProcessingNearHTML="Processing...";this.IncludeVeil=false;this.ResponseText=null;this.IsValid=true;this.EnableDebug=false;};MetafuseAjaxPostBackObjectServerResponse.prototype.AbortPostBack=function(metafuseAjaxPostBackObjectServerResponse){if(metafuseAjaxPostBackObjectServerResponse.XmlHttp){metafuseAjaxPostBackObjectServerResponse.XmlHttp.abort();}metafuseAjaxPostBackObjectServerResponse.OnAbort(metafuseAjaxPostBackObjectServerResponse);};MetafuseAjaxPostBackObjectServerResponse.prototype.OnLoading=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnLoaded=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnInteractive=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnAbort=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnBeforeExecuteSuccessfulResponse=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnExecuteSuccessfulResponse=function(metafuseAjaxPostBackObjectServerResponse){if(this.EnableDebug){if(metafuseAjaxPostBackObjectServerResponse.ResponseText!=null){InsertHTML("<div><p/>Response Received: "+new Date().toString()+" : Below :</p></div><textarea style=\"width:100%\" rows=\"10\">"+metafuseAjaxPostBackObjectServerResponse.ResponseText+"</textarea>");}else{InsertHTML("<div><p/>Response Received: "+new Date().toString()+" : No Response</p></div> ");}}try{var s=metafuseAjaxPostBackObjectServerResponse.ResponseText;eval(s);}catch(e){alert("The request was successful, however, a javascript error occurred while updating the form/document.\n\n  The error will be shown and the text response output.\n\n  Please take screen shots of each alert, then send it to support.\n\n Reload the form by navigating away and back to the form to try again.");__Dump(e);alert(metafuseAjaxPostBackObjectServerResponse.ResponseText);}};MetafuseAjaxPostBackObjectServerResponse.prototype.OnAfterExecuteSuccessfulResponse=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnBeforeProcessErrorMessage=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.OnProcessErrorMessage=function(metafuseAjaxPostBackObjectServerResponse){if(this.EnableDebug&&metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText.substring(0,16)!="<!--ERRORPAGE-->"){InsertHTML("<div>Error:<br/>"+metafuseAjaxPostBackObjectServerResponse.XmlHttp.responseText+"</div>");}else{document.location.href=Root+"/Site/Errors/500.aspx";}};MetafuseAjaxPostBackObjectServerResponse.prototype.OnAfterProcessErrorMessage=function(metafuseAjaxPostBackObjectServerResponse){};MetafuseAjaxPostBackObjectServerResponse.prototype.ShowProcessingMessage=MetafuseAjaxPostBackObjectServerResponse_ShowProcessingMessage;function MetafuseAjaxPostBackObjectServerResponse_ShowProcessingMessage(){if(this.ElementToShowProcessingNear){if(isString(this.ElementToShowProcessingNear)){this.ElementToShowProcessingNear=GetElementById(this.ElementToShowProcessingNear);}if(this.ElementToShowProcessingNear){var x=UITools.GetPageXCoordinate(this.ElementToShowProcessingNear);var y=UITools.GetPageYCoordinate(this.ElementToShowProcessingNear);this.ProcessingDiv=this.CreateProcessingDiv(this.CallBackTS,this.ProcessingNearHTML);if(BrowserTools.IsInternetExplorer()){this.ProcessingIFrame=this.CreateProcessingIFrame(this.CallBackTS);}UITools.ShowDivAndIFrameAtXY(x,y,this.ProcessingDiv,this.ProcessingIFrame,0,0,this.IncludeVeil);}}};MetafuseAjaxPostBackObjectServerResponse.prototype.HideProcessingMessage=MetafuseAjaxPostBackObjectServerResponse_HideProcessingMessage;function MetafuseAjaxPostBackObjectServerResponse_HideProcessingMessage(){if(this.ProcessingDiv!=null||this.ProcessingIFrame!=null){UITools.HideDivAndIFrame(this.ProcessingDiv,this.ProcessingIFrame);if(this.ProcessingDiv!=null){document.forms[0].removeChild(this.ProcessingDiv);}if(this.ProcessingIFrame!=null){document.forms[0].removeChild(this.ProcessingIFrame);}}};MetafuseAjaxPostBackObjectServerResponse.prototype.CreateProcessingDiv=MetafuseAjaxPostBackObjectServerResponse_CreateProcessingDiv;function MetafuseAjaxPostBackObjectServerResponse_CreateProcessingDiv(timestamp,processingNearHTML){if(processingNearHTML==null||processingNearHTML==""){processingNearHTML="Processing...";}var processingDivName="ajaxObjectProcessingDiv_"+timestamp;var divHTML="<div id=\""+processingDivName+"\" class=\"AjaxLoadingDiv\" style=\"position: absolute; z-index: 999;padding:3px; display:none;\">"+processingNearHTML+"</div>";InsertHTML(divHTML);return GetElementById(processingDivName);};MetafuseAjaxPostBackObjectServerResponse.prototype.CreateProcessingIFrame=MetafuseAjaxPostBackObjectServerResponse_CreateProcessingIFrame;function MetafuseAjaxPostBackObjectServerResponse_CreateProcessingIFrame(timestamp){var processingIFrameName="ajaxObjectProcessingIFrame_"+timestamp;var iFrameHTML="<iframe id=\""+processingIFrameName+"\" src=\"javascript:false;\" scrolling=\"no\" frameborder=\"0\" style=\"position:absolute; top:0px; left:0px; display:none;\"></iframe>";InsertHTML(iFrameHTML);return GetElementById(processingIFrameName);};function MAPBB(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingHTML,includeVeil,blockOtherCallBacks,onBeforeAjaxPostBackCall,metafuseTableToSave,onAfterAjaxPostBackCall){var keepGoing=true;if(onBeforeAjaxPostBackCall){keepGoing=onBeforeAjaxPostBackCall();}if(keepGoing){if(metafuseTableToSave){metafuseTableToSave.SerializeUpdateXml();}var pbr=new MetafuseAjaxPostBackObjectServerResponse();if(onAfterAjaxPostBackCall){pbr.OnAfterExecuteSuccessfulResponse=onAfterAjaxPostBackCall;}Ajax.DoAjaxPostBack(eventTarget,eventArgument,causesValidation,elementToShowProcessingNear,processingHTML,includeVeil,blockOtherCallBacks,pbr);}}