var xmlHttp; var requestURL = 'ajaxpilot.aspx'; var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0; var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5") != -1) ? 1 : 0; var is_opera = ((navigator.userAgent.indexOf("Opera6") != -1)|| (navigator.userAgent.indexOf("Opera/6") != -1)) ? 1 : 0; var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0; var is_onbeforeunload = false; window.onbeforeunload = onbeforeunloadf; if (history.navigationMode) { //Opera history.navigationMode = "fast"; } function show_data(str) { if (document.forms[0] == null) { return; } if (str == 'refresh') { document.getElementById("ahideid").value = 'start'; document.getElementById("ahidecancelactionid").value = 'cancel'; document.getElementById("ahideactionid").value = ''; var d = new Date(); window.location.reload(true); } else { disable_all_input('true'); document.getElementById("ahideactionid").value = str; var url = requestURL; xmlHttp = GetXmlHttpObject(ChangeHandler); var d = new Date(); url += "?"; for(var i = 0 ; i < document.forms.length ; i++) { var params = formData2QueryString(this.document.forms[i]); if (i == 0) { url += params; } else { url += '&'+params; } } url += '&d='+d.getTime(); xmlHttp_Get(xmlHttp, url); } } function ChangeHandler() { var begintargetid = "" if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete') { document.getElementById('message').innerHTML = ""; document.getElementById('inform').innerHTML = ""; var spl = xmlHttp.responseText; var target = ""; var targetstring = ""; var endi = 0; var starti = 0; while (spl.indexOf(begintargetid,starti) != -1) { if (target != "") { if (targetstring.substr(0,3) == " -1) { target = spl.substr(starti,endi-starti); starti = endi+endtargetid.length; if (spl.indexOf(begintargetid,starti) > -1) { targetstring = spl.substr(starti,spl.indexOf(begintargetid,starti)-starti); starti = starti+targetstring.length; } else { targetstring = spl.substr(starti); spl = ""; } } } if (target != "") { if (targetstring.substr(0,3) == "Please " + "wait"; } } function xmlHttp_Get(xmlhttp, url) { xmlhttp.open('GET', url, true); xmlhttp.send(null); } function GetXmlHttpObject(handler) { var objXmlHttp = null; if (is_ie) { var strObjName = (is_ie5) ? 'Microsoft.XMLHTTP' : 'Msxml2.XMLHTTP'; try { objXmlHttp = new ActiveXObject(strObjName); objXmlHttp.onreadystatechange = handler; } catch(e) { alert('ActiveXObject cannot be created verify if ' + 'Active scripting and activeX controls are enabled'); return; } } else { if (is_opera) { alert('Opera6 browser'); return; } else { document.getElementById('message').innerHTML = "
Please " + "wait
"; objXmlHttp = new XMLHttpRequest(); objXmlHttp.onload = handler; objXmlHttp.onerror = handler; } } return objXmlHttp; } function paramEscape(paramValue) { return encodeURIComponent(paramValue); } function disable_all_input(disable) { if (document.forms[0] == null) { return; } var docForm = this.document.forms[0]; var formElement = ''; var fdisable = true; if (disable == 'false') { fdisable = false; } for(var i = 0 ; i < document.forms[0].elements.length ; i++) { formElement = docForm.elements[i]; switch(formElement.type) { case 'text' : case 'button' : case 'select-one' : case 'hidden' : case 'password' : case 'textarea' : case 'radio' : case 'checkbox' : formElement.disabled = fdisable; break; } } } function defaultvalue_all_input() { if (document.forms[0] == null) { return; } var docForm = this.document.forms[0]; var formElement = ''; for(var i = 0 ; i < document.forms[0].elements.length ; i++) { formElement = docForm.elements[i]; switch(formElement.type) { case 'text' : case 'button' : case 'select-one' : case 'hidden' : case 'password' : case 'textarea' : case 'radio' : case 'checkbox' : formElement.defaultValue = formElement.value; break; } } } function formData2QueryString(docForm) { var submitString = ''; var formElement = ''; var lastElementName = ''; for(i = 0 ; i < docForm.elements.length ; i++) { formElement = docForm.elements[i]; switch(formElement.type) { case 'text' : case 'button' : case 'select-one' : case 'hidden' : case 'password' : case 'textarea' : if (formElement.name == '__VIEWSTATE' || formElement.name.substr(0,4) == 'ww__') { // input name begins with __VIEWSTATE or ww__ break; } submitString += formElement.name + '=' + paramEscape(formElement.value) + '&'; break; case 'radio' : if(formElement.checked) { submitString += formElement.name + '=' + paramEscape(formElement.value) + '&'; } break; case 'checkbox' : if(formElement.checked) { if(formElement.name = lastElementName) { if(submitString.lastIndexOf('&') == submitString.length - 1) { submitString = submitString.substring(0, submitString.length - 1); } submitString += ',' + paramEscape(formElement.value); } else { submitString += formElement.name + '=' + paramEscape(formElement.value); } submitString += '&'; lastElementName = formElement.name; } break; } } submitString = submitString.substring(0, submitString.length - 1); return submitString; } function onloadf() { if (document.forms[0] == null) { return; } if (document.getElementById("ahideid").value == '') { document.getElementById("ahideid").value = 'start'; } if (document.getElementById("ahidecancelactionid").value == '') { document.getElementById("ahidecancelactionid").value = 'cancel'; } if (document.getElementById("ahidecancelactionid").value == 'refresh') { document.getElementById("container").innerHTML = document.getElementById("ww__ahidesavepageid").value; } disable_all_input('false'); } function onunloadf() { if (is_onbeforeunload) { is_onbeforeunload = false; } else { defaultvalue_all_input(); document.getElementById("ww__ahidesavepageid").value = leftTrimAndR(document.getElementById("container").innerHTML); } } function onbeforeunloadf() { is_onbeforeunload = true; defaultvalue_all_input(); document.getElementById("ww__ahidesavepageid").value = leftTrimAndR(document.getElementById("container").innerHTML); } function leftTrimAndR(sString) { while (sString.substring(0,1) == ' ' || sString.substring(0,1) == '\n' || sString.substring(0,1) == '\r') { sString = sString.substring(1, sString.length); } return sString; } function nullaction() { }