/***********************************************************************************************************

			get XML Object function

***********************************************************************************************************/
var xmlHttp;

//this function creates the XMLHttp Object
function GetXmlHttpObject()
{
var x=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  x=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    x=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    x=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return x;
}



function getContent(page_id, divID)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
	alert ("Your browser does not support AJAX!");
	return;
	} 
	var url=page_id+".html";
	url=url+"&sid="+Math.random();
	alert(url)
	xmlHttp.onreadystatechange=function()
		{
		if(xmlHttp.readyState==4)
		{
		document.getElementById(divID).innerHTML=xmlHttp.responseText;
		}
		}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

//function will show "loading..." message and GIF
function showLoader(divID,divIDh1,divIDh2,divIDh3,divIDh4, divIDh5, divIDh6)
{
	document.getElementById(divID).style.display="block";
	document.getElementById(divID).innerHTML='<p style="margin-bottom: 6px; margin-top: 6px;"><small>loading...</small><br><img src="lookups/loading.gif"></p>'
	if (divIDh1)
	{
		document.getElementById(divIDh1).style.display = "none";
	}
	if (divIDh2)
	{	
		document.getElementById(divIDh2).style.display = "none";
	}	
	if (divIDh3)
	{	
		document.getElementById(divIDh3).style.display = "none";
	}	
	if (divIDh4)
	{	
		document.getElementById(divIDh4).style.display = "none";
	}	
	if (divIDh5)
	{	
		document.getElementById(divIDh5).style.display = "none";
	}
	if (divIDh6)
	{	
		document.getElementById(divIDh6).style.display = "none";
	}	
}

function showDIV(divID){
	document.getElementById(divID).style.display="block";
}

function hideDIV(divID){
	document.getElementById(divID).innerHTML="";
	document.getElementById(divID).style.display="none";
	document.getElementById(divID).style.visibility="hidden";
}


function getData(dataName,divID,prog_type,menu1ID,menu2ID,menu3ID,menu4ID,menu5ID){ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="lookups/getData.asp";
	url=url+"?dataName="+dataName;
	url=url+"&menu1ID="+menu1ID;
	url=url+"&menu2ID="+menu2ID;
	url=url+"&menu3ID="+menu3ID;
	url=url+"&menu4ID="+menu4ID;
	url=url+"&menu5ID="+menu5ID;
	url=url+"&prog_type="+prog_type;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState==4)
		{
			var str=xmlHttp.responseText
			if(str.search(/error&/) != -1)
			{
				var start=str.search(/&/)
				alert(str.slice(start+1));
				document.getElementById(divID).innerHTML='';
			}
			else
			{	
				document.getElementById(divID).innerHTML=xmlHttp.responseText;
			}
		}
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(url);
}



