
//--------------------------------------------------------------------
// getContent()
//--------------------------------------------------------------------
function getContent(strURL, objElement, intAjaxID, strData, intAjaxStatusType) {
//alert(strData);
 //Initilizations
 intAjaxID = getAjaxID();
 initiate_ajax(intAjaxID);
 hidetip();

 //Ajax Progress Bar
 if(isObject(document.getElementById('ajaxProgressBar'))&&isNaN(strData.match("progressbar=true"))==true){
  document.getElementById('ajaxProgressBar').style.display="inline";
  document.getElementById('ajaxProgressBar').src="http://images.hh2.com/Legacy/ajax_progress_bar_0.gif";
 }

 //Reset Session Timer
 if(isObject(document.getElementById('sessionTimerTotal'))){
  totalSec=document.getElementById('sessionTimerTotal').value;
  minSec=60;
 }

 //Ajax Status (Legacy)
 if(typeof(intAjaxStatusType)=="undefined"){
  if(strData!=""){
   if(isNaN(strData.match("status=none"))==true){
    intAjaxStatusType = 0;
   }
   else if(isNaN(strData.match("status=remain"))==true) {
    intAjaxStatusType = 1;
   }
   else if(isNaN(strData.match("status=wait"))==true) {
    intAjaxStatusType = 2;
   }
   else if(isNaN(strData.match("status=loadimage"))==true) {
    intAjaxStatusType = 3;
   }
   else{
    intAjaxStatusType = 0;
   }
  }
 }

 //Ajax Status Actions
 if(intAjaxStatusType==4&&navigator.appName!="Microsoft Internet Explorer"){
  intAjaxStatusType=3;
 }
 if(intAjaxStatusType==0){
  objElement.style.cursor="wait";
  objElement.innerHTML="&nbsp;";
 }
 else if(intAjaxStatusType==1){
  objElement.style.cursor="wait";
 }
 else if(intAjaxStatusType==2){
  objElement.innerHTML="Please Wait...";
 }
 else if(intAjaxStatusType==3||(intAjaxStatusType==4&&objElement.innerHTML=="")){
  if(findHeight(objElement)>600){
   objElement.innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='top' style='padding-top:250px;'><img src='http://images.hh2.com/Legacy/ajax_loading_content.gif' width='100' height='50'></td></tr></table>";
  }
  else{
   objElement.innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='center'><img src='http://images.hh2.com/Legacy/ajax_loading_content.gif' width='100' height='50'></td></tr></table>";
  }
 }
 else if(intAjaxStatusType==4){
  //Float Loading Graphic
  //objElement.style.filter = "Alpha(Opacity=50)";
  var intZIndex = getZMax();
  var objAjaxStatusDiv = document.createElement("<div id='divAjaxLoadStatus"+intAjaxID+"' style='display:none; position:absolute; cursor:wait;'>&nbsp;</div>");
  document.body.insertBefore(objAjaxStatusDiv);
  var objAjaxStatusFrame = document.createElement("<iframe id='frameAjaxLoadStatus"+intAjaxID+"' style='display:none; position:absolute; Filter:Alpha(Opacity=0);' src='about:blank' frameBorder='0' scrolling='no'></iframe>");
  document.body.insertBefore(objAjaxStatusFrame);
  if(objElement.innerHTML==""){
   objElement.innerHTML = "<table cellpadding='0' cellspacing='0' width='100%' height='100%'><tr><td></td></tr></table>";
  }
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.zIndex = intZIndex;
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.zIndex = (intZIndex + 1);
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.top = findPosY(objElement);
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.top = findPosY(objElement);
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.top = findPosY(objElement);
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.top = findPosY(objElement);
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.left = findPosX(objElement);
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.left = findPosX(objElement);
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.width = findWidth(objElement);
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.width = findWidth(objElement);
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.height = findHeight(objElement);
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.height = findHeight(objElement);
  if(findHeight(objElement)>600){
   document.getElementById("divAjaxLoadStatus"+intAjaxID).innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='top' style='padding-top:250px;'>"+document.getElementById("divAjaxLoadingPopupTemplate").innerHTML+"</td></tr></table>";
  }
  else{
   document.getElementById("divAjaxLoadStatus"+intAjaxID).innerHTML = "<table width='100%' height='100%'><tr><td align='center' valign='center'>"+document.getElementById("divAjaxLoadingPopupTemplate").innerHTML+"</td></tr></table>";
  }
  document.getElementById("divAjaxLoadStatus"+intAjaxID).style.display = "block";
  document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.display = "block";
 }

 //Execute Ajax
 arrAjax[intAjaxID].open("POST",strURL,true);
 arrAjax[intAjaxID].setRequestHeader("Content-Type","application/x-www-form-urlencoded");
 arrAjax[intAjaxID].onreadystatechange = function() {
  if (arrAjax[intAjaxID].readyState==1) {
   if(isObject(document.getElementById('ajaxProgressBar'))&&isNaN(strData.match("progressbar=true"))==true){
    document.getElementById('ajaxProgressBar').src="http://images.hh2.com/Legacy/ajax_progress_bar_1.gif";
   }
  }
  else if (arrAjax[intAjaxID].readyState==2) {
   if(isObject(document.getElementById('ajaxProgressBar'))&&isNaN(strData.match("progressbar=true"))==true){
    document.getElementById('ajaxProgressBar').src="http://images.hh2.com/Legacy/ajax_progress_bar_2.gif";
   }
  }
  else if (arrAjax[intAjaxID].readyState==3) {
   if(isObject(document.getElementById('ajaxProgressBar'))&&isNaN(strData.match("progressbar=true"))==true){
    document.getElementById('ajaxProgressBar').src="http://images.hh2.com/Legacy/ajax_progress_bar_3.gif";
   }
  }
  else if (arrAjax[intAjaxID].readyState==4) {
   if(isObject(document.getElementById('ajaxProgressBar'))&&isNaN(strData.match("progressbar=true"))==true){
    document.getElementById('ajaxProgressBar').src="http://images.hh2.com/Legacy/ajax_progress_bar_4.gif";
   }
   if(isNaN(arrAjax[intAjaxID].responseText.match("debug"))==true) {
    alert(arrAjax[intAjaxID].responseText);
   }
   if (arrAjax[intAjaxID].status==200) {
    if(arrAjax[intAjaxID].responseText.substr(0,9)=="[getsize]"){
     alert("REQUEST DATA:"+strData.length+" Bytes\n RETURN DATA:"+arrAjax[intAjaxID].responseText.length+" Bytes");
    }
    if(isObject(objElement)){
     if(objElement.id=="ajaxProcess"){
      var newAJAX = document.getElementById('ajaxProcessCollection').insertCell(1);
      newAJAX.innerHTML=arrAjax[intAjaxID].responseText;
     }
     else{
      objElement.innerHTML=arrAjax[intAjaxID].responseText;
      objElement.style.cursor="";
     }
    }
   }
   else{
    if(isObject(objElement)){
     objElement.innerHTML="<i>(#"+arrAjax[intAjaxID].status+") This application is temporarily unavailable.</i>";
     enableDiv(objElement);
     objElement.style.cursor="";
    }
    ajaxError(intAjaxID,arrAjax[intAjaxID].responseText);
   }
   //Clear floating load image
   if(intAjaxStatusType==4){
    if(isObject(document.getElementById("divAjaxLoadStatus"+intAjaxID))){
     document.getElementById("divAjaxLoadStatus"+intAjaxID).innerHTML = "";
     document.getElementById("divAjaxLoadStatus"+intAjaxID).style.display = "none";
     document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.display = "none";
     document.getElementById("divAjaxLoadStatus"+intAjaxID).style.top = "1px";
     document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.top = "1px";
     document.getElementById("divAjaxLoadStatus"+intAjaxID).style.left = "1px";
     document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.left = "1px";
     document.getElementById("divAjaxLoadStatus"+intAjaxID).style.width = "1px";
     document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.width = "1px";
     document.getElementById("divAjaxLoadStatus"+intAjaxID).style.height = "1px";
     document.getElementById("frameAjaxLoadStatus"+intAjaxID).style.height = "1px";
    }
   }
  }
 }

 if(strData!=""){
  strData = strData.replace(/ /g,"%20");
  strData = strData.replace(/\n/g,"%0D");
 }
 arrAjax[intAjaxID].send("ajaxRequest=true&"+strData);
 return false ;
}
