// JavaScript Document


function call_domain(tab1, div1, domain, path)
{
	//document.getElementById(div1).innerHTML = ""; 
	document.getElementById(div1).style.display = "block"; 
	//alert('template/ajax.php?p='+tab1+'&domain='+domain);
	callAHAH(path+'template/ajax.php?p='+tab1+'&domain='+domain, div1, 'Loading...', 'Error');
}



function call_ajax_component(tab, div, path, id)
{
	/*alert("tab - "+tab);
	alert("div - "+div);
	alert("path - "+path);
	alert("id - "+id);*/
	
	document.getElementById(div).style.display = "block"; 
	//alert('ajax.php?p='+tab+'&id='+id);
	
	callAHAH2(path+'ajax.php?p='+tab+'&id='+id, div, 'Loading...', 'Please Wait',path);
}


function call_followup_question(tab, div, path, qid, cid)
{
	/*alert("tab - "+tab);
	alert("div - "+div);
	alert("path - "+path);
	alert("qs_id - "+qid);
	alert("qc_id - "+cid);*/
	
	//alert(path+'ajax.php?p='+tab+'&qid='+qid+'&cid='+cid);

	//document.getElementById(div).style.display = "block"; 
	
	callAHAH2(path+'ajax.php?p='+tab+'&qid='+qid+'&cid='+cid, div, 'Loading...', 'Please Wait',path);
}


	
//////////AHAH Function start/////////////////////////////////////////

function callAHAH(url, pageElement, callMessage, errorMessage) 
{
	var pageElement=pageElement;
	//alert(url);
    document.getElementById(pageElement).innerHTML = "<img src='../dipm_images/loading.gif'>";
     try 
	 {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responseAHAH(pageElement, errorMessage);};
     req.open("GET",url,true);
     req.send(null);
  }


function responseAHAH(pageElement, errorMessage) {
   var output = '';
   if(req.readyState == 4) {
	 // alert(req.status);
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(pageElement).innerHTML = output;
         } else {
         document.getElementById(pageElement).innerHTML = errorMessage+"\n"+output;
         }
      }
  }
  
  
  
 //////////AHAH2 Function start/////////////////////////////////////////

function callAHAH2(url, pageElement, callMessage, errorMessage,path) 
{
	/*alert("url - "+url);
	alert("path - "+path);*/
	
	var pageElement=pageElement;
	//alert("pageElement - "+pageElement);
	
	//var path=path+'dipm_images/loading.gif';
	
    document.getElementById(pageElement).innerHTML = "<img src='../dipm_images/loading.gif'>";
     try 
	 {
     req = new XMLHttpRequest(); /* e.g. Firefox */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
         } catch (E) {
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responseAHAH2(pageElement, errorMessage);};
     req.open("GET",url,true);
     req.send(null);
  }


function responseAHAH2(pageElement, errorMessage) {
   var output = '';
   if(req.readyState == 4) {
	 // alert(req.status);
      if(req.status == 200) {
         output = req.responseText;
         document.getElementById(pageElement).innerHTML = output;
         } else {
         document.getElementById(pageElement).innerHTML = errorMessage+"\n"+output;
         }
      }
  }





