
/* begin anylink drop down script part */
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft-15 : what.offsetTop-30;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
// window.alert('ddm fired.');

if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
/* end anylink drop down script part */

function Set_Cookie(name,value,expires,domain,path,secure) {
    document.cookie = name + "=" +escape(value) +
        ( (expires) ? ";expires=" + expires.toGMTString() : "") +
        ( (path) ? ";path=" + path : "") + 
        ( (domain) ? ";domain=" + domain : "") +
        ( (secure) ? ";secure" : "");
}

expires = new Date();
expires.setTime(expires.getTime() + (365 * 24 * 60 * 60 * 1000));

function mysortfn(a,b) {
   // Note that each thing we are passed is an array, so we don't compare the things
   // we're passed; instead, we compare their column c (0 being the first column)
   
   // alert("entered the sorter!  sortby=" +sortBy +" and sortdir=" +sortDir);
   
   if (sortDir > 0){
      // window.alert("sortBy was greater than zero");
      if (a[sortBy]<b[sortBy]) return -1;
      if (a[sortBy]>b[sortBy]) return 1;
      return 0;
   }else{
      /// window.alert("sortBy was less than or equal to zero");
      if (a[sortBy]<b[sortBy]) return 1;
      if (a[sortBy]>b[sortBy]) return -1;
      return 0;
   }
}
function drawUserSortLinks(){
   var objALM2 = document.getElementById("anylinkmenu2");
   var objALM3 = document.getElementById("anylinkmenu3");
   var objPT = document.getElementById("printthis");
   var sPT = "<a target=\"_blank\" href=\"/light/bcwish.php?bcuser=" +whoseList +"&sort=";   // build a string for the printthis innerHTML property
   
   switch(sortBy){
      case 1:
         objALM2.innerHTML = "<a href=\"#\" onclick=\"sortBy=2;drawClientSortable(arrResult);\">date</a><a href=\"#\" onclick=\"sortBy=0;drawClientSortable(arrResult);\">title</a>";
         sPT += "author";
         break;
      case 2:
         objALM2.innerHTML = "<a href=\"#\" onclick=\"sortBy=1;drawClientSortable(arrResult);\">author</a><a href=\"#\" onclick=\"sortBy=0;drawClientSortable(arrResult);\">title</a>";
         sPT += "date";
         break;
      case 0:
         objALM2.innerHTML =  "<a href=\"#\" onclick=\"sortBy=1;drawClientSortable(arrResult);\">author</a><a href=\"#\" onclick=\"sortBy=2;drawClientSortable(arrResult);\">date</a>";
         sPT += "title";
         break;
   }
   
   switch(sortDir){
      case 1:
         objALM3.innerHTML = "<a href=\"#\" onclick=\"sortDir=-1;drawClientSortable(arrResult);\">descending</a>";
         sPT += "&sortdir=asc";
         break;
      case -1:
         objALM3.innerHTML = "<a href=\"#\" onclick=\"sortDir=1;drawClientSortable(arrResult);\">ascending</a>";
         sPT += "&sortdir=desc";
         break;
      default:
   }
   
   sPT += "\">print this?</a>";
   
   objPT.innerHTML = sPT;
}

function drawClientSortable(arrToSort){
   // window.alert("drawClientSortable fired with the current value of sortBy =" +sortBy +" and sortDir=" +sortDir);
   sOut = "";
   targetElement = document.getElementById("clientsortable");
   
   arrToSort.sort(mysortfn);
   var objASB = document.getElementById("activeSortBy");
   var objASD = document.getElementById("activeSortDir");
   
   switch(sortBy){
      case 0:  // sorting by title
         objASB.innerHTML = "title";
         break;
      case 1:
         objASB.innerHTML = "author";
         break;
      case 2:
         objASB.innerHTML = "date";
         break;
      
   }
   
   objASD.innerHTML = (sortDir == 1) ? "ascending" : "descending";
   
   for(ii=0;ii<arrToSort.length;ii++){
   
      // the div for the whole wish record
      sOut += "<div style=\"border-bottom: 1px solid #000000;\">";
      // the div for the title
      sOut += "<div>";
      sOut += unescape(arrToSort[ii][0]);
      sOut += "</div>";
      
      // the div with 25px left padding for author and date
      sOut += "<div style=\"padding-left:25px; font-style:italic;\">";
      
      // the div for the timestamp (floats right)
      sOut += "<div style=\"float:right; text-align:right;\">";
      sOut += unescape(arrToSort[ii][2]);
      sOut += "</div>"; // close the div for the timestamp
      
      // the span for the author
      sOut += "<span>";
      sOut += unescape(arrToSort[ii][1]);
      sOut += "</span>";  // close the author span
      
      sOut += "</div>"; // close the div for the 25px padding

      sOut += "</div>"; // close the div for the whole wish record
   }
   targetElement.innerHTML = sOut;
   drawUserSortLinks();
}

function confirm_username(myForm){
	// alert("confirm_username fired.");
	for (i = 0;i < myForm.newusername.value.length;i++){
		if (!(myForm.newusername.value.charAt(i)=="-" ||
		 (myForm.newusername.value.charAt(i)>="0" &&
	         myForm.newusername.value.charAt(i)<="9") ||
				 (myForm.newusername.value.charAt(i)>="a" && 
				  myForm.newusername.value.charAt(i)<="z") ||
				 (myForm.newusername.value.charAt(i)>="A" && 
				  myForm.newusername.value.charAt(i)<="Z"))){
        alert("Your Screen Name must consist only of letters (A-Z) and numbers (0-1), with no spaces or symbols except for hyphens (-).");	
        // myForm.submitjoin.value="Join Now";	
        myForm.newusername.focus();
				myForm.newusername.select();
        return false;
      }  
    }
	if(myForm.newusername.value.length > 0 ){
		// alert("length was greater than zero!");
		AJAXUsername_confirm(myForm.newusername.value, myForm.newuseremail.value);
	}
}

function username_search(s){
// alert("username_search fired.");
   if(!e) e = window.event;
   
   if (s.length >=4){
      // alert("OK, length >= 4");
      switch(e.keyCode){
         // ignore these key events
         // case 8: 
         case 13: 
         case 16:  // shift
         case 17:  // ctrl
         case 37: 
         case 39: 
         case 38: 
         case 40: 
         case 36: 
         case 35: 
         case 33: 
         case 34: 
            //alert("you pressed a key we don't care to process.");
            break;
         default:
            AJAXUsername_Search();
      }
      
   }else{
      // alert("nope, not long enough yet.");
   }
}

function Edit(iWhich){
   document.getElementById("listing_"+iWhich).style.display="none";
   document.getElementById("editing_"+iWhich).style.display = "";
   document.getElementById("delete_"+iWhich).style.display = "";
}

function UnEdit(iWhich){
   // window.alert("made it into UnEdit");
   
   // hide the element for editing
   document.getElementById("editing_"+iWhich).style.display = "none";
   // reveal the element for display
   document.getElementById("listing_"+iWhich).style.display = "";
   // change the save button text back
   document.getElementById("save_"+iWhich).innerHTML = "save";
   
}


var global_wishID;
var global_action;

function testKey(e){
   /* if(!e) e = window.event;
   alert(e.keyCode);
   */
   return false;
}


function trapEnter(e, saveWhich, myAction){
   // window.alert("we're in the entertrapper");
   
   if (!e) e = window.event;
   if (e.keyCode == 13){
      // window.alert("whoa, gues that was an enter.");
      e.cancelBubble = true;
      if (e.returnValue) e.returnValue = false;
      if (e.stopPropagation) e.stopPropagation();
          // if (enterFunction) eval(enterFunction);
          
      switch(myAction){
         case "addnew":
            document.getElementById("save_addnew").innerHTML="saving...";
            document.forms['form_addnew'].submit();
            break;
         case "username_search":
            AJAXUsername_Search();
            break;
         case "delete":
            break;
         default:
            AJAXupdateWish(saveWhich, myAction);
      }
      
      return false;
   }else{
      return true;
   }     
}

function handleHttpResponse() {
   // window.alert("we're handling it.  global_wishID evals to " +global_wishID +" and the readystate is " +http.readyState);
   
   if (http.readyState == 4) {
      // window.alert("readyState must have been 4.");
      
      if (http.responseText.indexOf('invalid') == -1) {
         // window.alert("yay, nothing invalid");
         
         response = http.responseText;
         // window.alert(response +"\n\nwas our responseText property.");
         isWorking = false;
                  
         switch(global_action){
            case "update":
            case "delete":
               var localDate = new Date();
               var dateAdj = new Date();
               
               // the offset in milliseconds
               var offset = localDate.getTimezoneOffset() * 60 * 1000;
               // window.alert("the offset in ms is: " + offset);
               
               var localDateInt = localDate.getTime();
               // window.alert("localDateInt is " +localDateInt);
               
               dateAdj.setTime(localDateInt + offset);
               
               myMonth = dateAdj.getMonth();
               myMonth = myMonth+1;
               if (myMonth<10){
                  myMonth="0" +myMonth;
               }
               
               myDate = dateAdj.getDate();
               if (myDate<10) {
                  myDate="0" +myDate;
               }
               break;
         }
         
         switch(global_action){
            case "update":
            case "delete":
               //get form elements and put them into the listing div/spans
               document.getElementById("author_"+global_wishID).innerHTML=document.getElementById("editing_"+global_wishID+"_author").value;
               // window.alert("finished author.");
               
               document.getElementById("title_"+global_wishID).innerHTML=document.getElementById("editing_"+global_wishID+"_title").value;
               // window.alert("finished setting title.");
               
               document.getElementById("timestamp_"+global_wishID).innerHTML=dateAdj.getFullYear() +'-' +myMonth +'-' +myDate;
               break;
         }
      
         
         
         // window.alert("finished setting author, title and timestamp...about to leave the handlerfunction.");
         switch (global_action) {
            case "update":
               UnEdit(global_wishID);
               break;
            case "delete":
               //alert("global_action was " +global_action);
               document.getElementById("editing_"+global_wishID).style.display = "none";
               //alert("we should have hidding the editing_" +global_wishID +" by now");
               break;
            case "username_search":
               document.getElementById("username_search_results").innerHTML = response;
               break;
	    case "username_confirm":
	       // prompt("check it:", response);
	       if( response.indexOf("<span>User name OK.</span>") == -1 ){
	        response_msg = new String(response.substring(6,response.indexOf("</span>")));
	        
	        window.alert("Hmm, there was a problem.  Details:\n\n" +response_msg );
	       }else{
	        window.alert("Sign-up complete.  Check your email for details.");
	       }
         }
         
      }
   }
}

var isWorking = false;
function AJAXUsername_confirm(ss, ee){
	//alert("AJAXUsername_confirm fired - whoopdeeshizzle, my nizzle!");
	url = "/check_bcscreenname.php?checkwhom=" + ss +"&checkemail=" +ee;
	// prompt("see?", url);
	global_action = "username_confirm";
	if (!isWorking && http) {
      	http.open("GET", url, true);
      	http.onreadystatechange = handleHttpResponse;
      	http.send(null);
   }

}

function AJAXUsername_Search(){
   // alert("AjAxUsername_search function fired.");
   
   searchString = document.getElementById("username_search_input").value;
   // alert(searchString);
   
   url = "/username_search.php?searchstring=" +escape(searchString);
   
   // prompt("see?", url);
   
   // alert("now?");
   
   global_action = "username_search";
   
   if (!isWorking && http) {
      http.open("GET", url, true);
      http.onreadystatechange = handleHttpResponse;
      http.send(null);
   }
}

function AJAXupdateWish(iWhich,myAction) {
  // window.alert("AJAXupdateWish just fired with " +iWhich +" as the iWhich and " +myAction +" as the myAction."); 
   
   myTitle=document.getElementById("editing_"+iWhich+"_title").value;
   myAuthor=document.getElementById("editing_"+iWhich+"_author").value;
   
   var url;
   global_wishID=iWhich;
   global_action = myAction;
   
   switch (myAction) {
            case "update":
               document.getElementById("delete_"+iWhich).style.display = "none"
               document.getElementById("save_"+iWhich).innerHTML = 'saving...';
               break;
            case "delete":
               document.getElementById("save_"+iWhich).style.display = "none";
               document.getElementById("delete_"+iWhich).innerHTML = 'deleting...';
         }
   
   
   

   if (!isWorking && http) {
      switch(myAction) {
         case "update":
            // url = "http://bcwish.cliff1976.net/bcwish_updater.php?wishid=" + iWhich +"&title=" +escape(myTitle) +"&author=" +escape(myAuthor); // The server-side script 
	    url = "/bcwish_updater.php?wishid=" + iWhich +"&title=" +escape(myTitle) +"&author=" +escape(myAuthor);
            break;
         case "delete":
            // url = "http://bcwish.cliff1976.net/bcwish_deleter.php?wishid=" + iWhich;
	    url = "/bcwish_deleter.php?wishid=" + iWhich;
            break;
      }
      // window.prompt("we're about to call the server-side script with: " , url);
      
      http.open("GET", url, true); 
      http.onreadystatechange = handleHttpResponse; 
      http.send(null);
      
   }
 }

function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  // window.alert("we are at line 1111 and xmlhttp already exists: "+xmlhttp);
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
      if(xmlhttp.overrideMimeType) {
         xmlhttp.overrideMimeType("text/xml"); 
      }
    } catch (e) {
      window.alert("Bummer.  Looks like your browser is not compatible.  Please report this to cliff1976.");
      xmlhttp = false;
    }
  }
  return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object

// ===================================================================
// Author: Matt Kruse <matt@ajaxtoolbox.com>
// WWW: http://www.AjaxToolbox.com/
//

function AjaxRequest(){var req =new Object();
req.timeout =null;
req.generateUniqueUrl =true;
req.url =window.location.href;
req.method ="GET";
req.async =true;
req.username =null;
req.password =null;
req.parameters =new Object();
req.requestIndex =AjaxRequest.numAjaxRequests++;
req.responseReceived =false;
req.groupName =null;
req.queryString ="";
req.responseText =null;
req.responseXML =null;
req.status =null;
req.statusText =null;
req.aborted =false;
req.xmlHttpRequest =null;
req.onTimeout=null;
req.onLoading=null;
req.onLoaded=null;
req.onInteractive=null;
req.onComplete=null;
req.onSuccess=null;
req.onError=null;
req.onGroupBegin=null;
req.onGroupEnd=null;
req.xmlHttpRequest =AjaxRequest.getXmlHttpRequest();
if(req.xmlHttpRequest==null){return null;}req.xmlHttpRequest.onreadystatechange =
function(){if(req==null || req.xmlHttpRequest==null){return;}if(req.xmlHttpRequest.readyState==1){req.onLoadingInternal(req);}if(req.xmlHttpRequest.readyState==2){req.onLoadedInternal(req);}if(req.xmlHttpRequest.readyState==3){req.onInteractiveInternal(req);}if(req.xmlHttpRequest.readyState==4){req.onCompleteInternal(req);}};
req.onLoadingInternalHandled=false;
req.onLoadedInternalHandled=false;
req.onInteractiveInternalHandled=false;
req.onCompleteInternalHandled=false;
req.onLoadingInternal=
function(){if(req.onLoadingInternalHandled){return;}AjaxRequest.numActiveAjaxRequests++;
if(AjaxRequest.numActiveAjaxRequests==1 && typeof(window['AjaxRequestBegin'])=="function"){AjaxRequestBegin();}if(req.groupName!=null){if(typeof(AjaxRequest.numActiveAjaxGroupRequests[req.groupName])=="undefined"){AjaxRequest.numActiveAjaxGroupRequests[req.groupName] =0;}AjaxRequest.numActiveAjaxGroupRequests[req.groupName]++;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==1 && typeof(req.onGroupBegin)=="function"){req.onGroupBegin(req.groupName);}}if(typeof(req.onLoading)=="function"){req.onLoading(req);}req.onLoadingInternalHandled=true;};
req.onLoadedInternal=
function(){if(req.onLoadedInternalHandled){return;}if(typeof(req.onLoaded)=="function"){req.onLoaded(req);}req.onLoadedInternalHandled=true;};
req.onInteractiveInternal=
function(){if(req.onInteractiveInternalHandled){return;}if(typeof(req.onInteractive)=="function"){req.onInteractive(req);}req.onInteractiveInternalHandled=true;};
req.onCompleteInternal=
function(){if(req.onCompleteInternalHandled || req.aborted){return;}req.onCompleteInternalHandled=true;
AjaxRequest.numActiveAjaxRequests--;
if(AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function"){AjaxRequestEnd(req.groupName);}if(req.groupName!=null){AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function"){req.onGroupEnd(req.groupName);}}req.responseReceived =true;
req.status =req.xmlHttpRequest.status;
req.statusText =req.xmlHttpRequest.statusText;
req.responseText =req.xmlHttpRequest.responseText;
req.responseXML =req.xmlHttpRequest.responseXML;
if(typeof(req.onComplete)=="function"){req.onComplete(req);}if(req.xmlHttpRequest.status==200 && typeof(req.onSuccess)=="function"){req.onSuccess(req);}else if(typeof(req.onError)=="function"){req.onError(req);}delete req.xmlHttpRequest['onreadystatechange'];
req.xmlHttpRequest =null;};
req.onTimeoutInternal=
function(){if(req!=null && req.xmlHttpRequest!=null && !req.onCompleteInternalHandled){req.aborted =true;
req.xmlHttpRequest.abort();
AjaxRequest.numActiveAjaxRequests--;
if(AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function"){AjaxRequestEnd(req.groupName);}if(req.groupName!=null){AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
if(AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function"){req.onGroupEnd(req.groupName);}}if(typeof(req.onTimeout)=="function"){req.onTimeout(req);}delete req.xmlHttpRequest['onreadystatechange'];
req.xmlHttpRequest =null;}};
req.process =
function(){if(req.xmlHttpRequest!=null){if(req.generateUniqueUrl && req.method=="GET"){req.parameters["AjaxRequestUniqueId"] =new Date().getTime() + "" + req.requestIndex;}var content =null;
for(var i in req.parameters){if(req.queryString.length>0){req.queryString +="&";}req.queryString +=encodeURIComponent(i) + "=" + encodeURIComponent(req.parameters[i]);}if(req.method=="GET"){if(req.queryString.length>0){req.url +=((req.url.indexOf("?")>-1)?"&":"?") + req.queryString;}}req.xmlHttpRequest.open(req.method,req.url,req.async,req.username,req.password);
if(req.method=="POST"){if(typeof(req.xmlHttpRequest.setRequestHeader)!="undefined"){req.xmlHttpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');}content =req.queryString;}if(req.timeout>0){setTimeout(req.onTimeoutInternal,req.timeout);}req.xmlHttpRequest.send(content);}};
req.handleArguments =
function(args){for(var i in args){if(typeof(req[i])=="undefined"){req.parameters[i] =args[i];}else{req[i] =args[i];}}};
req.getAllResponseHeaders =
function(){if(req.xmlHttpRequest!=null){if(req.responseReceived){return req.xmlHttpRequest.getAllResponseHeaders();}alert("Cannot getAllResponseHeaders because a response has not yet been received");}};
req.getResponseHeader =
function(headerName){if(req.xmlHttpRequest!=null){if(req.responseReceived){return req.xmlHttpRequest.getResponseHeader(headerName);}alert("Cannot getResponseHeader because a response has not yet been received");}};
return req;}AjaxRequest.getXmlHttpRequest =function(){if(window.XMLHttpRequest){return new XMLHttpRequest();}else if(window.ActiveXObject){/*@cc_on @*/
/*@if(@_jscript_version >=5)
try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(E){return null;}}@end @*/}else{return null;}};
AjaxRequest.isActive =function(){return(AjaxRequest.numActiveAjaxRequests>0);};
AjaxRequest.get =function(args){AjaxRequest.doRequest("GET",args);};
AjaxRequest.post =function(args){AjaxRequest.doRequest("POST",args);};
AjaxRequest.doRequest =function(method,args){if(typeof(args)!="undefined" && args!=null){var myRequest =new AjaxRequest();
myRequest.method =method;
myRequest.handleArguments(args);
myRequest.process();}};
AjaxRequest.submit =function(theform, args){var myRequest =new AjaxRequest();
if(myRequest==null){return false;}var serializedForm =AjaxRequest.serializeForm(theform);
myRequest.method =theform.method.toUpperCase();
myRequest.url =theform.action;
myRequest.handleArguments(args);
myRequest.queryString =serializedForm;
myRequest.process();
return true;};
AjaxRequest.serializeForm =function(theform){var els =theform.elements;
var len =els.length;
var queryString ="";
this.addField =
function(name,value){if(queryString.length>0){queryString +="&";}queryString +=encodeURIComponent(name) + "=" + encodeURIComponent(value);};
for(var i=0;i<len;i++){var el =els[i];
if(!el.disabled){switch(el.type){case 'text': case 'password': case 'hidden': case 'textarea':
this.addField(el.name,el.value);
break;
case 'select-one':
if(el.selectedIndex>=0){this.addField(el.name,el.options[el.selectedIndex].value);}break;
case 'select-multiple':
for(var j=0;j<el.options.length;j++){if(el.options[j].selected){this.addField(el.name,el.options[j].value);}}break;
case 'checkbox': case 'radio':
if(el.checked){this.addField(el.name,el.value);}break;}}}return queryString;};
AjaxRequest.numActiveAjaxRequests =0;
AjaxRequest.numActiveAjaxGroupRequests =new Object();
AjaxRequest.numAjaxRequests =0;



