
//--------------------------------------------------------------------
// sendHTTP()
//--------------------------------------------------------------------
function sendHTTP(strURL, objElement, intAjaxID, strData) {

 if(intAjaxID==1||intAjaxID==""){
  intAjaxID = getAjaxID();
 }
 initiate_ajax(intAjaxID);
 arrAjaxObject[intAjaxID] = objElement;

 if(isObject(objElement)==false){
  ajaxError(intAjaxID,"Object Not Valid");
  return false;
 }

 if(isObject(document.getElementById('sessionTimerTotal'))){
  totalSec=document.getElementById('sessionTimerTotal').value;
  minSec=60;
 }

 arrAjaxObject[intAjaxID].className="http_"+arrAjaxObject[intAjaxID].type+"_unsaved";

 arrAjax[intAjaxID].open("POST",strURL,true);
 arrAjax[intAjaxID].setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 arrAjax[intAjaxID].onreadystatechange = function() {
  if (arrAjax[intAjaxID].readyState==4) {
   if (arrAjax[intAjaxID].status==200) {
    if(isObject(arrAjaxObject[intAjaxID])==false){
     return false;
    }
    if(arrAjax[intAjaxID].responseText.substr(0,9)=="[getsize]"){
     alert("REQUEST DATA:"+strData.length+" Bytes\n RETURN DATA:"+arrAjax[intAjaxID].responseText.length+" Bytes");
    }
    //Projess results
    if(isNaN(arrAjax[intAjaxID].responseText.match("[ajaxprocess]"))==true) {
     var newAJAX = document.getElementById('ajaxProcessCollection').insertCell(1);
     newAJAX.innerHTML=arrAjax[intAjaxID].responseText.replace("[ajaxprocess]","");
    }
    if(isNaN(arrAjax[intAjaxID].responseText.match("success"))==true) {
     if(isObject(arrAjaxObject[intAjaxID])){
      arrAjaxObject[intAjaxID].className="http_"+arrAjaxObject[intAjaxID].type+"_saved";
      setTimeout("resetAjaxStatus(arrAjaxObject["+intAjaxID+"])",2000);
     }
    }
    else {
     if(isObject(arrAjaxObject[intAjaxID])){
      arrAjaxObject[intAjaxID].className="http_"+arrAjaxObject[intAjaxID].type+"_error";
     }
    }
    if(isNaN(arrAjax[intAjaxID].responseText.match("debug"))==true) {
     alert(arrAjax[intAjaxID].responseText);
    }
   }
   else {
    ajaxError(intAjaxID,arrAjax[intAjaxID].responseText);
    arrAjaxObject[intAjaxID].className="http_undefined_error";
   }
  }
 }

 if(strData!=""){
  strData = strData.replace(/ /g,"%20");
  strData = strData.replace(/\n/g,"%0D");
 }
 arrAjax[intAjaxID].send("ajaxRequest=true&"+strData);
}


//--------------------------------------------------------------------
// resetAjaxStatus()
//--------------------------------------------------------------------
var objResetTarget;
function resetAjaxStatus(objTarget){
 if(isObject(objTarget)){
  if(objTarget.className=="http_"+objTarget.type+"_saved"){
   objTarget.className="";
  }
 }
}



