
function reload_page(){location.reload(false);}
var __ajax=new Array();function ajax(inline){this.reset=_ajax_reset;this.inline=inline;this.send_get=_ajax_inline_get;this.send_post=_ajax_inline_post;this.check_for_errors=_ajax_check_for_errors;this.check_for_success=_ajax_check_for_success;this.reset();this._id=__ajax.length;__ajax[this._id]=this;this.populate_div='';}
function _ajax_reset(){this.http=new ajax_xml_obj;if(!this.http){alert('Error, get a better browser, unable to create XML HTTP Object');return false;}
this.eval_result=false;this.xml='';this.onload=null;this.load_complete=0;}
function _ajax_readystatechange(){for(var key in __ajax){if(__ajax[key].http){if((__ajax[key].http.readyState==4)&&(__ajax[key].load_complete==0)){__ajax[key].load_complete=1;if(__ajax[key].eval_result==true){try{eval(__ajax[key].http.responseText);}catch(e){alert('Invalid Response: '+__ajax[key].http.responseText);}}else if(__ajax[key].populate_div!=''){var d=document.getElementById(__ajax[key].populate_div);d.innerHTML=__ajax[key].http.responseText;var s=d.getElementsByTagName('SCRIPT');for(var i=0;i<s.length;i++){if(s[i].getAttribute('src')){alert('To be implemented.. (ajax.js::load js.src: '+s[i].getAttribute('src')+')');}
try{eval(s[i].innerHTML);}catch(e){alert('Failed to eval JavaScript embedded in responce..\nErr: '+e.message+'\nCode to follow...');alert(s[i].innerHTML);}}}else{__ajax[key].xml=__ajax[key].http.responseXML;if(__ajax[key].onload){switch(typeof(__ajax[key].onload)){case'function':__ajax[key].onload(__ajax[key]);break;case'string':var responseText=__ajax[key].http.responseText;eval(__ajax[key].onload);break;default:alert('Unknown type of __ajax[key].onload: '+typeof(__ajax[key].onload));break;}}}}}}}
function _ajax_check_for_success(){try{var s=this.xml.getElementsByTagName("success");if(s.length>0){return true;}
return false;}catch(e){return false;}}
function _ajax_check_for_errors(){try{var e=this.xml.getElementsByTagName("error");var r=false;if(!e)return false;if(e.length>0){for(var i=0;i<e.length;i++){try{alert(e[i].firstChild.data);r=true;}catch(err){alert('Error in AJAX Call, unable to display error message:'+err.message);r=true;}}}
return r;}catch(e){return true;}}
function _ajax_inline_post(url,params){try{if(this.inline==false){this.http.onreadystatechange=_ajax_readystatechange;this.load_complete=0;}else{this.load_complete=1;}
this.http.open('POST',url,(this.inline==true?false:true));this.http.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.http.setRequestHeader("Content-length",params.length);this.http.setRequestHeader("Connection","close");this.http.send(params);if(this.inline==false){return true;}
this.xml=this.http.responseXML;}catch(e){this.hide_loading();alert('Error posting AJAX Request: '+e.message);return false;}
if(this.check_for_errors()==true)return false;if(this.check_for_success()==true)return true;var r=this.xml.getElementsByTagName('data');if(!r){alert('Invalid Response: '+this.http.responseText.toString());return false;}
return r;}
function _ajax_inline_get(url){try{if(this.inline==false){this.http.onreadystatechange=_ajax_readystatechange;this.load_complete=0;}else{this.load_complete=1;}
this.http.open('GET',url,(this.inline==true?false:true));this.http.send(null);if(this.inline==false){return true;}
this.xml=this.http.responseXML;}catch(e){this.hide_loading();alert('Error posting AJAX Request: '+e.message);return false;}
if(this.check_for_errors()==true)return false;if(this.check_for_success()==true)return true;var r=this.xml.getElementsByTagName('data');if(!r){alert('Invalid Response: '+this.http.responseText.toString());return false;}
return r;}
function ajax_xml_obj(){if(window.XMLHttpRequest&&!(window.ActiveXObject)){try{req=new XMLHttpRequest();}catch(e){req=false;}}else if(window.ActiveXObject){try{req=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){req=false;}}}
return req;}