var xmlHttpReq=null; function createxhr() { var xhr=null; try { xhr=new XMLHttpRequest(); xhr.overrideMimeType('text/xml'); } catch (e) { try { xhr=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xhr=new ActiveXObject("Microsoft.XMLHTTP"); } } return xhr; } function get_request_sync(strurl) { var dt=null; if (xmlHttpReq==null) xmlHttpReq=createxhr(); if (xmlHttpReq==null) { alert ("Your browser does not support AJAX!"); return; } try { dt=(function() { xmlHttpReq.open("GET",strurl,false); })(); xmlHttpReq.send(null); dt=xmlHttpReq.responseText; } catch(e) { alert('Πρόβλημα στο δίκτυο...'); } return dt; } function post_request_sync(strurl,strSubmit) { var dt=null; if (xmlHttpReq==null) xmlHttpReq=createxhr(); if (xmlHttpReq==null) { alert ("Your browser does not support AJAX!"); return; } try { dt=(function() { xmlHttpReq.open("POST",strurl,false); })(); xmlHttpReq.send(strSubmit); dt=xmlHttpReq.responseText; } catch(e) { alert('Πρόβλημα στο δίκτυο...'); } return dt; } function get_request(strurl,strResultFunc) { if (xmlHttpReq==null) xmlHttpReq=createxhr(); if (xmlHttpReq==null) { alert ("Your browser does not support AJAX!"); return; } xmlHttpReq.onreadystatechange=function() { if (xmlHttpReq.readyState == 4) { strResponse = xmlHttpReq.responseText; switch (xmlHttpReq.status) { case 404: alert('Error: Not Found. The requested URL ' + strURL + ' could not be found.'); break; case 500: handleErrFullPage(strResponse); break; default: if (strResponse.indexOf('Error:') > -1 || strResponse.indexOf('Debug:') > -1) { alert(strResponse); } else { eval(strResultFunc + '(strResponse);'); } break; } } } xmlHttpReq.open("GET",strurl,true); xmlHttpReq.send(null); } function handleErrFullPage(strIn) { var errorWin; try { errorWin = window.open('', 'errorWin'); errorWin.document.body.innerHTML = strIn; } catch(e) { alert('An error occurred, but the error message cannot be' + ' displayed because of your browser\'s pop-up blocker.\n' + 'Please allow pop-ups from this Web site.'); } } function post_request(strURL, strSubmit, strResultFunc) { if (xmlHttpReq==null) xmlHttpReq=createxhr(); if (xmlHttpReq==null) { alert ("Your browser does not support AJAX!"); return; } xmlHttpReq.open('POST', strURL, true); xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xmlHttpReq.onreadystatechange = function() { if (xmlHttpReq.readyState == 4) { strResponse = xmlHttpReq.responseText; switch (xmlHttpReq.status) { case 404: alert('Error: Not Found. The requested URL ' + strURL + ' could not be found.'); break; case 500: handleErrFullPage(strResponse); break; default: if (strResponse.indexOf('Error:') > -1 || strResponse.indexOf('Debug:') > -1) { alert(strResponse); } else { eval(strResultFunc + '(strResponse);'); } break; } } } xmlHttpReq.send(strSubmit); } function getQuery(sql) { return eval('('+get_request_sync("queryinstance_json?sql="+sql)+')'); }