var xmlreqs; var ie5=document.all&&document.getElementById; if (!ie5) {document.captureEvents(Event.MOUSEMOVE)} document.onmousemove = getMouseXY; function getMouseXY(e) { if (ie5) { // grab the x-y pos.s if browser is IE mouseX = event.clientX + document.body.scrollLeft; mouseY = event.clientY + document.body.scrollTop; } else { // grab the x-y pos.s if browser is NS mouseX = e.pageX; mouseY = e.pageY; } if (mouseX < 0){mouseX = 0;} if (mouseY < 0){mouseY = 0;} if(document.getElementById('loading_img')) { document.getElementById('loading_img').style.left = mouseX; document.getElementById('loading_img').style.top = mouseY - 18; } return true; } var xmlreqs = new Array(); function CXMLReq(freed, loadType) { this.freed = freed; this.xmlhttp = false; this.loadType = loadType; if (window.XMLHttpRequest) { this.xmlhttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function nonRefreshUpdate(url, data, loadType) { //var topMostLayer = findTopMostLayer(); var topMostLayer = 1000; if(document.getElementById('loading_img')) { document.getElementById('loading_img').style.display = 'block'; document.getElementById('loading_img').style.zIndex = topMostLayer; } else { var loading_img = document.createElement("img"); loading_img.id = "loading_img"; loading_img.alt = "loading_img"; loading_img.className = "loading_img"; loading_img.src = "/common/images/loading.gif"; loading_img.style.display = 'block'; loading_img.style.zIndex = topMostLayer; document.body.appendChild(loading_img); } var pos = -1; for (var i=0; i < xmlreqs.length; i++) { if (xmlreqs[i].freed == 1) { pos = i; break; } } if (pos == -1) { pos = xmlreqs.length; xmlreqs[pos] = new CXMLReq(1);} if (xmlreqs[pos].xmlhttp) { xmlreqs[pos].freed = 0; xmlreqs[pos].loadType = loadType; xmlreqs[pos].xmlhttp.open("POST",url,true); if (loadType == "V2") { xmlreqs[pos].xmlhttp.onreadystatechange = function() { if (typeof(htgAjax_V2_response) != 'undefined') { htgAjax_V2_response(pos); } } } else { xmlreqs[pos].xmlhttp.onreadystatechange = function() { if (typeof(xmlhttpChange) != 'undefined') { xmlhttpChange(pos); } } } xmlreqs[pos].xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8;"); xmlreqs[pos].xmlhttp.send(data + "&sessionkey" + "=" + new Date().getTime()); } } function xmlhttpChange(pos) { if (typeof(xmlreqs[pos]) != 'undefined' && xmlreqs[pos].freed == 0 && xmlreqs[pos].xmlhttp.readyState == 4) { if(document.getElementById('loading_img')) { document.getElementById('loading_img').style.display = 'none'; } if (xmlreqs[pos].xmlhttp.status == 200 || xmlreqs[pos].xmlhttp.status == 304) { if(xmlreqs[pos].loadType) { mainDiv = document.getElementById(xmlreqs[pos].loadType); mainDiv.innerHTML = xmlreqs[pos].xmlhttp.responseText; } else { eval(xmlreqs[pos].xmlhttp.responseText); } } else { viewError = confirm("There was a problem proccessing data:\n" + xmlreqs[pos].xmlhttp.statusText); if (viewError){document.body.innerHTML = xmlreqs[pos].xmlhttp.responseText;} //if (viewError){alert(xmlreqs[pos].xmlhttp.responseText);} } xmlreqs[pos].freed = 1; } } function htgAjax_V2_response(pos) { if (typeof(xmlreqs[pos]) != 'undefined' && xmlreqs[pos].freed == 0 && xmlreqs[pos].xmlhttp.readyState == 4) { if(document.getElementById('loading_img')) { document.getElementById('loading_img').style.display = 'none'; } if (xmlreqs[pos].xmlhttp.status == 200 || xmlreqs[pos].xmlhttp.status == 304) { var xmlData = xmlreqs[pos].xmlhttp.responseXML.documentElement; var xmlLoop; for (xmlLoop=0; xmlLoop < xmlData.childNodes.length; xmlLoop++) { if(xmlData.childNodes[xmlLoop].nodeType == 1){ if(xmlData.childNodes[xmlLoop].nodeName=='script') { eval(xmlData.childNodes[xmlLoop].childNodes[0].nodeValue); } else if (xmlData.childNodes[xmlLoop].nodeName=='html_content') { var output_text = xmlData.childNodes[xmlLoop].firstChild.nodeValue; output_text = output_text.replace(/\r|\n|\r\n|\t/g, ""); output_text = output_text.replace(/\s+/g, " "); output_text = output_text.replace(/>\s+/g, ">"); output_text = output_text.replace(/^\s+/g, ""); output_text = output_text.replace(/!newline!/g, "\n"); output_text = output_text.replace(/!return!/g, "\r"); document.getElementById(xmlData.childNodes[xmlLoop].attributes.getNamedItem('container').value).innerHTML = output_text; } } } } else { viewError = confirm("There was a problem proccessing data:\n" + xmlreqs[pos].xmlhttp.statusText); if (viewError){ my_window= window.open ("", "","status=1,width=1024,height=768"); my_window.document.write(""); //document.body.innerHTML = xmlreqs[pos].xmlhttp.responseText; } } xmlreqs[pos].freed = 1; } } function view_file_ajax (file_name) { var n = 'file_' + Math.floor(Math.random() * 99999); var d = document.createElement('iframe'); d.style.display = "none"; d.src = file_name; d.id = n; document.body.appendChild(d); }