qcodo.postBack=function(c,e,b,a){var d=document.getElementById(c);d.Qform__FormControl.value=e;d.Qform__FormEvent.value=b;d.Qform__FormParameter.value=a;d.Qform__FormCallType.value="Server";d.Qform__FormUpdates.value=this.formUpdates();d.Qform__FormCheckableControls.value=this.formCheckableControls(c,"Server");d.submit()};qcodo.formUpdates=function(){var b="";for(var c in qcodo.controlModifications){for(var a in qcodo.controlModifications[c]){b+=c+" "+a+" "+qcodo.controlModifications[c][a]+"\n"}}qcodo.controlModifications=new Array();return b};qcodo.formCheckableControls=function(d,c){var f=document.getElementById(d);var b="";var e="";for(var a=0;a<f.elements.length;a++){if(((f.elements[a].type=="checkbox")||(f.elements[a].type=="radio"))&&((c=="Ajax")||(!f.elements[a].disabled))){if(f.elements[a].id.indexOf("[0]")>=0){b+=" "+f.elements[a].id.substring(0,f.elements[a].id.length-3)}else{if(f.elements[a].id.indexOf("_c")>=0){itemName=f.elements[a].name.substring(0,f.elements[a].name.indexOf("["));if(!(b.indexOf(itemName)>=0)){b+=" "+itemName}}else{if(f.elements[a].id.indexOf("_")>=0){if(f.elements[a].id.indexOf("_r")>=0){itemName=f.elements[a].name.substring(0,f.elements[a].name.length);if(!(b.indexOf(itemName)>=0)){b+=" "+itemName}}else{itemName=f.elements[a].id.substring(0,f.elements[a].id.length-2);if(!(b.indexOf(itemName)>=0)){b+=" "+itemName}}}else{b+=" "+f.elements[a].id}}}}}if(b.length>0){return b.substring(1)}else{return""}};qcodo.ajaxQueue=new Array();qcodo.postAjax=function(e,f,d,c,b){if(!qc.unloadFlag){if(qc.beforeUnloadFlag){qc.beforeUnloadFlag=false}var a=false;if(qcodo.ajaxQueue.length==0){a=true}qcodo.ajaxQueue.push(new Array(e,f,d,c,b));if(a){qcodo.dequeueAjaxQueue()}}};qcodo.clearAjaxQueue=function(){qcodo.ajaxQueue=new Array()};qcodo.objAjaxWaitIcon=null;qcodo.dequeueAjaxQueue=function(){if(qcodo.ajaxQueue.length>0){strForm=this.ajaxQueue[0][0];strControl=this.ajaxQueue[0][1];strEvent=this.ajaxQueue[0][2];strParameter=this.ajaxQueue[0][3];strWaitIconControlId=this.ajaxQueue[0][4];if(strWaitIconControlId){this.objAjaxWaitIcon=this.getWrapper(strWaitIconControlId);if(this.objAjaxWaitIcon){this.objAjaxWaitIcon.style.display="inline"}}var objForm=document.getElementById(strForm);objForm.Qform__FormControl.value=strControl;objForm.Qform__FormEvent.value=strEvent;objForm.Qform__FormParameter.value=strParameter;objForm.Qform__FormCallType.value="Ajax";objForm.Qform__FormUpdates.value=qcodo.formUpdates();objForm.Qform__FormCheckableControls.value=this.formCheckableControls(strForm,"Ajax");var strPostData="";for(var i=0;i<objForm.elements.length;i++){switch(objForm.elements[i].type){case"checkbox":if(objForm.elements[i].checked){if(objForm.elements[i].id.indexOf("_c")>=0){strPostData+="&"+objForm.elements[i].name+"="+objForm.elements[i].value}else{strPostData+="&"+objForm.elements[i].id+"="+objForm.elements[i].value}}break;case"radio":if(objForm.elements[i].checked){if(objForm.elements[i].name.indexOf("_r")>=0){strPostData+="&"+objForm.elements[i].name+"="+objForm.elements[i].value}else{var strTestName=objForm.elements[i].name+"_";if(objForm.elements[i].id.substring(0,strTestName.length)==strTestName){strPostData+="&"+objForm.elements[i].name+"="+objForm.elements[i].value}else{strPostData+="&"+objForm.elements[i].id+"="+objForm.elements[i].value}}}break;case"select-multiple":var blnOneSelected=false;for(var intIndex=0;intIndex<objForm.elements[i].options.length;intIndex++){if(objForm.elements[i].options[intIndex].selected){strPostData+="&"+objForm.elements[i].name+"=";strPostData+=objForm.elements[i].options[intIndex].value}}break;default:var strName=objForm.elements[i].id;if((strName.length==0)&&objForm.elements[i].name){strName=objForm.elements[i].name}if(strName.length>0){strPostData+="&"+strName+"=";var strPostValue=objForm.elements[i].value;if(strPostValue){strPostValue=strPostValue.replace(/\%/g,"%25");strPostValue=strPostValue.replace(/&/g,escape("&"));strPostValue=strPostValue.replace(/\+/g,"%2B")}strPostData+=strPostValue}break}}var strUri=objForm.action;var objRequest;if(window.XMLHttpRequest){objRequest=new XMLHttpRequest()}else{if(typeof ActiveXObject!="undefined"){objRequest=new ActiveXObject("Microsoft.XMLHTTP")}}if(objRequest){objRequest.open("POST",strUri,true);objRequest.setRequestHeader("Method","POST "+strUri+" HTTP/1.1");objRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");objRequest.onreadystatechange=function(){if(objRequest.readyState==4){if(!qcodo.beforeUnloadFlag){try{var objXmlDoc=objRequest.responseXML;if(!objXmlDoc){alert("An error occurred during AJAX Response parsing.\r\n\r\nThe error response will appear in a new popup.");var objErrorWindow=window.open("about:blank","qcodo_error","menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50");objErrorWindow.document.open();objErrorWindow.document.write(objRequest.responseText);objErrorWindow.document.close();objErrorWindow.focus();return}else{var intLength=0;var objXmlControls=objXmlDoc.getElementsByTagName("control");intLength=objXmlControls.length;for(var intIndex=0;intIndex<intLength;intIndex++){var strControlId=objXmlControls[intIndex].attributes.getNamedItem("id").nodeValue;var strControlHtml="";if(objXmlControls[intIndex].textContent){strControlHtml=objXmlControls[intIndex].textContent}else{if(objXmlControls[intIndex].firstChild){strControlHtml=objXmlControls[intIndex].firstChild.nodeValue}}if(strControlId=="Qform__FormState"){var objFormState=document.getElementById(strControlId);objFormState.value=strControlHtml}else{var objSpan=document.getElementById(strControlId+"_ctl");if(objSpan){objSpan.innerHTML=strControlHtml}}}var objXmlCommands=objXmlDoc.getElementsByTagName("command");intLength=objXmlCommands.length;for(var intIndex=0;intIndex<intLength;intIndex++){if(objXmlCommands[intIndex]&&objXmlCommands[intIndex].firstChild){var strCommand="";intChildLength=objXmlCommands[intIndex].childNodes.length;for(var intChildIndex=0;intChildIndex<intChildLength;intChildIndex++){strCommand+=objXmlCommands[intIndex].childNodes[intChildIndex].nodeValue}if(strCommand.indexOf("alert")>-1){if(qcodo.objAjaxWaitIcon){qcodo.objAjaxWaitIcon.style.display="none"}}eval(strCommand)}}}}catch(objExc){alert(objExc.message+"\r\non line number "+objExc.lineNumber+"\r\nin file "+objExc.fileName);alert("An error occurred during AJAX Response handling.\r\n\r\nThe error response will appear in a new popup.");var objErrorWindow=window.open("about:blank","qcodo_error","menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes,width=1000,height=700,left=50,top=50");objErrorWindow.document.open();objErrorWindow.document.write(objRequest.responseText);objErrorWindow.document.close();objErrorWindow.focus();return}}qcodo.ajaxQueue.shift();if(qcodo.objAjaxWaitIcon){qcodo.objAjaxWaitIcon.style.display="none"}if(qcodo.ajaxQueue.length>0){qcodo.dequeueAjaxQueue()}}};objRequest.send(strPostData)}}};qc.pB=qcodo.postBack;qc.pA=qcodo.postAjax;
