function myAJAX(myURL){if(myURL!='undefined'){this.url=myURL;}else{this.url='';}
this.targetURL='';this.async=true;this.method='GET';this.paramVals=new Array();this.paramKeys=new Array();this.http='';this.onComplete=function(t){alert("this is Default and should be replaced:\r\nContent returned:\r\n "+t);};var self=this;this.makeRequest=function(){if(this.http==''){if(window.XMLHttpRequest){this.http=new XMLHttpRequest();}
else{if(window.ActiveXObject){try{this.http=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{this.http=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){}}}}}
var ParamString=self.processParams();if(this.method.toLowerCase()=="post"){this.http.open("POST",this.url,this.async);this.http.setRequestHeader("Content-length",ParamString.length);this.http.setRequestHeader("Connection","close");}
else if(this.method.toLowerCase()=="get"){var myURL=this.url;if(myURL.indexOf('?')>-1){myURL+='&'+ParamString;}
else{myURL+='?'+ParamString;}
ParamString=null;this.http.open("GET",myURL,this.async);}
this.http.onreadystatechange=this.processChange;this.http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');this.http.send(ParamString);};this.processParams=function(){var ParamString='';for(i=0;i<=(self.paramKeys.length-1);i++){var values=self.paramVals[i];if(values instanceof Array){for(j=0;j<=(values.length-1);j++){if(i>0||j>0){ParamString+='&';}
ParamString+=self.paramKeys[i]+"="+values[j];}}
else{if(i>0){ParamString+="&";}
ParamString+=self.paramKeys[i]+"="+self.paramVals[i];}}
return ParamString;};this.processChange=function(){switch(self.http.readyState){case 1:if(typeof self.onLoading=='function')self.onLoading();break;case 2:if(typeof self.onLoaded=='function')self.onLoaded();break;case 3:if(typeof self.onInteractive=='function')self.onInteractive();break;case 4:if(typeof self.onComplete=='function')self.onComplete(self.http.responseText);break}};this.processForm=function(form,takeURL,takeMethod){if((typeof takeURL!='undefined')&&takeURL==true){self.url=form.action;}
if((typeof takeMethod!='undefined')&&takeMethod==true){self.method=form.method.toUpperCase();}
var inputs=form.elements;var formEm=new Object();formEm.keys=new Array();formEm.vals=new Array();for(emKey in inputs){var em=inputs[emKey];if(typeof em=='object'){var type=em.type;switch(type.toLowerCase()){case'hidden':case'text':case'textarea':case'submit':case'hidden':if(em.name!=''&&em.value.length>0){self.addParam(em.name,em.value);}
break;case'radio':case'checkbox':if(em.checked){self.addParam(em.name,em.value);}
break;case'select-one':case'select-multiple':formEm.keys[formEm.keys.length]=em.name;if(em.multiple==true){var mySelections=Array();for(i=0;i<em.options.length;i++){var mOPTION=em.options[i];if(mOPTION.selected){mySelections[mySelections.length]=mOPTION.value;}}
self.addParam(em.name,mySelections);}
else{self.addParam(em.name,em.value);}
break;default:}}}};this.addParam=function(key,value){self.paramKeys[self.paramKeys.length]=key;self.paramVals[self.paramVals.length]=value;};this.SubmitForm=function(form,newURL,newMethod){this.processForm(form,true,true);if((typeof newURL!='undefined')){this.url=newURL;}
if((typeof newMethod!='undefined')){this.method=newMethod.toUpperCase();}
this.addParam('ajax',true);this.makeRequest();return false;};this.ReplaceFormSubmit=function(form,newURL,newMethod){form.onsubmit=function(){return self.SubmitForm(form,newURL,newMethod);};};}
function showMenu(theID,theHeight2)
{document.getElementById(theID).className='menuShow';}
function hideMenu(theID)
{document.getElementById(theID).className='menuHide';}
function goPrint(printID)
{var theTime=new Date();var xx=new myAJAX();xx.onComplete=function(t)
{};xx.url='results.php?action=goprint&id='+printID+"&date="+theTime;xx.makeRequest();window.print();return void(0);}
