var http_request = false; function makerequest(url, functionname, httptype, senddata) { http_request = false; if (!httptype) httptype = "get"; if (window.xmlhttprequest) { // non-ie... http_request = new xmlhttprequest(); if (http_request.overridemimetype) { http_request.overridemimetype('text/plain'); } } else if (window.activexobject) { // ie try { http_request = new activexobject("msxml2.xmlhttp"); } catch (e) { try { http_request = new activexobject("microsoft.xmlhttp"); } catch (e) {} } } if (!http_request) { alert('cannot send an xmlhttp request'); return false; } var changefunc="http_request.onreadystatechange = "+functionname; eval (changefunc); //http_request.onreadystatechange = alertcontents; http_request.open(httptype, url, true); http_request.setrequestheader('content-type', 'application/x-www-form-urlencoded'); http_request.send(senddata); } function getreturnedtext () { if (http_request.readystate == 4) { if (http_request.status == 200) { var messagereturn = http_request.responsetext; return messagereturn; } else { alert('there was a problem with the request.'); } } } function echoreturnedtext () { if (http_request.readystate == 4) { if (http_request.status == 200) { var messagereturn = http_request.responsetext; if(messagereturn!='isfail') { var r; r=messagereturn.split('|'); if(r.length!=1) { if(r[0]!='') { document.getelementbyid(r[1]).innerhtml=r[0]; } if(r[2]!='') { alert(r[2]); } } else { document.getelementbyid('ajaxarea').innerhtml=messagereturn; } } } else { alert('there was a problem with the request.'); } } }