//  ajax for help contents in pages - By Reza Babakhan;

var url = "help.php";
if (client_mod == 1) {
    url = "../help.php";
}

var what = "LoginStatus(req.responseText)"; 

var st;	

function CheckLogin(data) { 

  DoCallback("data="+data);

  showContactTimer();

}
    
function HideHelpDiv() {
  document.getElementById('helpDiv').style.display='none';
    	
  setheight();
}

function LoginStatus(Status) { 

  st=Status;
		
  document.getElementById('helpDiv').innerHTML=Status

  setheight();   

} 

function hideContactTimer () {

  var loader = document.getElementById('loadBar');
	
  // Hide the load bar alas! Done Loading
  loader.style.display = "none";

}
	
function showContactTimer () {

  var loader = document.getElementById('loadBar');

  loader.style.display = 'block';

  document.getElementById('helpDiv').style.display='none';

  sentTimer = setTimeout(" document.getElementById('helpDiv').style.display='';hideContactTimer()",2000);

}

function DoCallback(data) { 

  // branch for native XMLHttpRequest object 
  if (window.XMLHttpRequest) {

    req = new XMLHttpRequest(); 

    req.onreadystatechange = processReqChange; 

    req.open('POST', url, true); 
	
    req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

    req.send(data); 
	
    // branch for IE/Windows ActiveX version 
 } else if (window.ActiveXObject) {

    req = new ActiveXObject('Microsoft.XMLHTTP');

    if (req) {

      req.onreadystatechange = processReqChange; 

      req.open('POST', url, true); 

      req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); 

      req.send(data); 
    } 

  }

}

function processReqChange() {

  // only if req shows 'loaded' 

   if (req.readyState == 4) { 

    // only if 'OK' 

     if (req.status == 200) { 

       eval(what); 

     } else { 

        alert('There was a problem retrieving the XML data: ' + req.responseText); 

     } 

  } 

}