//var site_url ='http://localhost/opp/';
if(top.location.host=='opp-inc.org')
{
	var site_url ='http://opp-inc.org/opp/';
}
else
{
	var site_url ='http://www.opp-inc.org/opp/';
}
var xmlHttp;
var id;
//************* Xml object creation for ajax**********	
function GetXmlHttpObject(handler)
{
	var objXmlHttp=null
	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
		return objXmlHttp
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		}
		try
		{
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler
			return objXmlHttp
		}
		catch(e)
		{
			alert("Error. Scripting for ActiveX might be disabled")
			return
		}
	}
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler
		return objXmlHttp
	}
} 
	function showuseravailChanged(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				document.getElementById('TipName').style.display="";
				document.getElementById('load').style.display="none";
				document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 
	function showuseravail(name,id2){
			document.getElementById('TipName').style.display="none";
			document.getElementById('load').style.display="";	
			idcata = id2;
			var url=site_url+"common/useravail.php?name=" + name;
			xmlHttp=GetXmlHttpObject(showuseravailChanged);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}
	function showschooluseravailChanged(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				document.getElementById('TipName').style.display="";
				document.getElementById('load').style.display="none";
				document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 
	function showschooluseravail(name,id2){
		
			document.getElementById('TipName').style.display="none";
			document.getElementById('load').style.display="";	
			idcata = id2;
			var url=site_url+"common/schooluseravail.php?name=" + name;
			xmlHttp=GetXmlHttpObject(showschooluseravailChanged);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}
		function showadminschooluseravailChanged(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				document.getElementById('TipName').style.display="";
				document.getElementById('load').style.display="none";
				document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 
	function showadminschooluseravail(name,id2,School_ID){
			document.getElementById('TipName').style.display="none";
			document.getElementById('load').style.display="";	
			idcata = id2;
			var url=site_url+"common/adminschooluseravail.php?name=" + name+"&School_ID="+School_ID;
			xmlHttp=GetXmlHttpObject(showadminschooluseravailChanged);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}
	function sendmailChanged(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			{ 
				document.getElementById(idcata).style.display="";
				document.getElementById(load1).style.display="none";
				document.getElementById(design1).style.display="none";
				document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 
	function sendmail(subject,msg,Offer_ID,id2,load,design){
			document.getElementById(id2).style.display="none";
			document.getElementById(design).style.display="none";
			document.getElementById(load).style.display="";	
			idcata = id2;
			load1=load;
			design1=design;
			var url=site_url+"common/sendmail.php?subject=" + subject+"&msg="+msg+"&Offer_ID="+Offer_ID;
			xmlHttp=GetXmlHttpObject(sendmailChanged);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}
	// Subject & Category
	function showDialect(sub,id,cat){
			idcata = id;
			var url=site_url+"common/cat_list.php?sub=" + sub+"&cat="+cat;
			xmlHttp=GetXmlHttpObject(showChanged);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}

	function showChanged(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
					document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 
	// Show city
	function showCity(state,id,sel){
			idcata = id;
			var url=site_url+"common/city_list.php?getState=" + state+"&Selected="+sel;
			xmlHttp=GetXmlHttpObject(showcity1Changed);
			xmlHttp.open("GET", url , true);
			xmlHttp.send(null);
	}

	function showcity1Changed(){ 
			if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
					document.getElementById(idcata).innerHTML=xmlHttp.responseText ;
			}
	} 