﻿// JScript File

// JScript File
var xmlHttp
function set_region_cmb()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchregion.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_region 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_region() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("region_id").innerHTML=xmlHttp.responseText	
		} 
} 

function GetXmlHttpObject()
	{ 
		var objXMLHttp=null
		if (window.XMLHttpRequest)
		{
			objXMLHttp=new XMLHttpRequest()
		}
		else if (window.ActiveXObject)
		{
			objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
		}
		return objXMLHttp
}
function set_ethnicity_cmb()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetch_ethnicity.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_ethnicity 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_ethnicity() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("ethnicity_id").innerHTML=xmlHttp.responseText	
		} 
} 

 
 // set county combo box
 
 function set_county()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchcounty.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_county

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_county() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("c_county_id").innerHTML=xmlHttp.responseText	
		} 
} 



function set_country()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchcountry.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_country

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_country() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("country_id").innerHTML=xmlHttp.responseText	
		} 
} 

function set_m_county()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="m_fetchcounty.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_m_county

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_m_county() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("m_county_id").innerHTML=xmlHttp.responseText	
		} 
} 


function set_m_country()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="m_fetchcountry.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_m_country

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_m_country() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("m_country_id").innerHTML=xmlHttp.responseText	
		} 
} 



function set_m_location()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="m_fetchlocation.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_m_location

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_m_location() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("m_location_id").innerHTML=xmlHttp.responseText	
		} 
} 

function set_language()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchlanguage.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_language

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_language() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("language_id").innerHTML=xmlHttp.responseText	
		} 
} 
function set_ptitle()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchptitle.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_ptitle

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_ptitle() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("ptitle_id").innerHTML=xmlHttp.responseText	
		} 
} 


function show_loc(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchsearchlocation.aspx"
	url=url+"?q="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_loc

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_loc() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("s_loc_id").innerHTML=xmlHttp.responseText	
		} 
} 

function show_default_location()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchlocation.aspx"
	//url=url+"?q="+str
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_default

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_default() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("s_loc_id").innerHTML=xmlHttp.responseText	
		} 
} 
function call()
{
	alert("hi");
}

function show_dynamic_location(reg)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="DynamicLocation.aspx"
	url=url+"?r="+reg
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_Dynamic

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_Dynamic() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("s_loc_id").innerHTML=xmlHttp.responseText	
		} 
} 

/*function set_img()
{
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="setarrow.aspx"
	//url=url+"?q="+str
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_img
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChanged_img() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("img1").innerHTML=xmlHttp.responseText	
		} 
}
*/
function set_churchname()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetch_churchname.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_Churchname

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_Churchname() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("churchname_id").innerHTML=xmlHttp.responseText	
		} 
} 


function set_username()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchusername.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_username

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_username() 
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("username_id").innerHTML=xmlHttp.responseText	
		} 
} 


function openurl(str)
{
	window.open(str,'','');
}


// display Update Button

function disp_btn()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="Update_Button.aspx"
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_disp_btn

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_disp_btn()
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("btn_id").innerHTML=xmlHttp.responseText	
		} 
} 

function btn()
{
	var a=document.getElementById("languageselect").value;
	alert(a);
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="Edit_Button.aspx?q=" ;
	url = url + a;
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_btn

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged_btn()
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("btn_id").innerHTML=xmlHttp.responseText	
		
		} 
} 

function disp_textbox(lan)
{
xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="Lan_Textbox.aspx?lan=";
	url = url + lan;
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_disp_txt
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	

}

function stateChanged_disp_txt()
{
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
		document.getElementById("language_id").innerHTML=xmlHttp.responseText	
		} 
} 
var f=false;
function disp_language(){   // call this fn from Amend_church.aspx page
	var aa;
	if ( f == false ) 
	{
		set_Amend_language();
		aa=document.getElementById("languageselect");
		//alert(aa);
		f=true;
	}
	else
	{
		a=document.getElementById("hidelanguage");
		disp_textbox(a.value);
		//alert(a.value);
		f=false;
	}
	
}

function sethidelanguage(str)
{
	var a;
	a=document.getElementById("hidelanguage");
	a.value=str;
	//alert(str);
	
	
}

function set_Amend_language()
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert ("Browser does not support HTTP Request")
	return
	} 
	var url="fetchlanguage.aspx"
	
	//url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged_language

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}





