
//--------------------------------------------------------------------
// ajaxError()
//--------------------------------------------------------------------
function ajaxError(intsendHTTPID,strError) {

 initiate_ajax(intsendHTTPID);

 arrAjax[intsendHTTPID].open("POST","/ajax/get_user.asp",true);
 arrAjax[intsendHTTPID].setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 arrAjax[intsendHTTPID].onreadystatechange = function() {
  if (arrAjax[intsendHTTPID].readyState==4) {
   if (arrAjax[intsendHTTPID].status==200) {
    if(arrAjax[intsendHTTPID].responseText=="0"){
     curTime = new Date();
     var errorWin = window.open("/system/blank.asp", "ajaxError"+curTime.getMilliseconds(),"resizable=yes,toolbar=no,scrollbars=yes,status=yes,location=no,left=50,top=50,width=640,height=480");
     errorWin.document.write("<html><head><title>AJAX ERROR</title></head><body style='font-family:arial;'>");
     errorWin.document.write("<b>Ajax Encountered the following error:</b><br><br>");

     arrError = new Array("HTTP/1.1 404 Not Found","Server Object","Microsoft OLE DB Provider","Microsoft VBScript runtime","ADODB.Recordset","error '");
     var errorCursor = -1
     var newStrError = ""
     for(i=0;i<arrError.length;i++){
      errorCursor = strError.search(arrError[i])
      if(errorCursor!=-1){
       newStrError = strError.substr(errorCursor,1000);
      }
     }
     if(newStrError==""){
      newStrError = strError
     }
     errorWin.document.write(newStrError);
     errorWin.document.write("</body></html>");
    }
   }
   else{
    void(0);
   }
  }
 }
 arrAjax[intsendHTTPID].send("error=true");
 return false ;
}


//--------------------------------------------------------------------
// ajaxDebug()
//--------------------------------------------------------------------
var intAjaxDebugID = 0;
function ajaxDebug(strDebugText){
 intAjaxDebugID = (intAjaxDebugID + 1);
 var objAjaxNewDebugDiv = document.createElement("<div id='divAjaxDebug"+intAjaxDebugID+"' style='position:absolute; padding:10px; background-color:#000000; border:1px solid gray; color:#FFFFFF;' onClick='this.style.zIndex=getZMax();'></div>");
 document.body.insertBefore(objAjaxNewDebugDiv);
 document.getElementById("divAjaxDebug"+intAjaxDebugID).innerHTML = "<b>AJAX Debug Output:</b><br><textarea id='textareaAjaxDebug"+intAjaxDebugID+"' style='width:500px; height:300px;'></textarea><br><center><input type='button' value='Close Debug Window' onClick='ajaxDebugClose("+intAjaxDebugID+");'></center>";
 document.getElementById("divAjaxDebug"+intAjaxDebugID).style.zIndex = getZMax();
 document.getElementById("divAjaxDebug"+intAjaxDebugID).style.top = (intAjaxDebugID * 50) + "px";
 document.getElementById("divAjaxDebug"+intAjaxDebugID).style.left = (intAjaxDebugID * 50) + "px";
 document.getElementById("textareaAjaxDebug"+intAjaxDebugID).value = strDebugText;

 //intAjaxDebugID = (intAjaxDebugID + 1);
 //var ajaxDebugWin = window.open("/system/blank.asp", "ajaxDebug"+intAjaxDebugID,"resizable=yes,toolbar=no,scrollbars=yes,status=yes,location=no,left=50,top=50,width=640,height=480");
 //ajaxDebugWin.document.write("<html><head><title>Ajax Debug</title></head><body style='font-family:arial; font-size:10px;'>");
 //ajaxDebugWin.document.write("<b>Ajax Debug Output:</b><br><br>");
 //ajaxDebugWin.document.write(strDebugText);
 //ajaxDebugWin.document.write("</body></html>");
}

function ajaxDebugClose(intAjaxCloseDebugID){
 document.getElementById("divAjaxDebug"+intAjaxCloseDebugID).style.display = "none";
 intAjaxDebugID = (intAjaxDebugID - 1);
}


