var xmlHttp

function showPage(str,icid,srch)
{ 
	var url="getpage.php?sid=" + Math.random() + "&q=" + str + "&iCID=" + icid + "&srch=" + srch	
	showContactTimer(); // quickly begin the load bar
	xmlHttp=GetXmlHttpObject(stateChanged)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
	
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
		//document.form9.vAudience.focus();
		document.getElementById("srch").focus();
		//document.form1.srch.focus();
	} 
} 
// organise by
function showOrgBy(str,srch)
{ 
	var url="selectlist.php?sid=" + Math.random() + "&q=" + str + "&srch=" + srch
	//showContactTimer(); // quickly begin the load bar
	xmlHttp=GetXmlHttpObject(stateChangedOrgBy)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
} 

function stateChangedOrgBy() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("txtshowOrgBy").innerHTML=xmlHttp.responseText 
	} 
} 

function selectCategory(id,name,q)
{	
	if(q=='organiseby') {
		document.form4.vOrgby.value=name;	
		document.form4.vOrgbyid.value=id;
		document.getElementById("txtshowOrgBy").innerHTML='' 
		document.form4.vOrgby.focus();	
	}
	if(q=='location') {
		document.form4.vLocation.value=name;	
		document.form4.vLocId.value=id;
		document.getElementById("txtLocation").innerHTML='' 
		document.form4.vLocation.focus();	
	}
		
} 
// end organise by
//location
function showLocation(str,srch)
{ 
	var url="selectlist.php?sid=" + Math.random() + "&q=" + str + "&srch=" + srch
	//showContactTimer(); // quickly begin the load bar
	xmlHttp=GetXmlHttpObject(stateChangedLoc)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
} 

function stateChangedLoc() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("txtLocation").innerHTML=xmlHttp.responseText 
	} 
}
// end location
// calender
function showCalender(req_month,year,today) {
	var url="eLanka_event_calender/calender.php?req_month=" + req_month + "&year=" + year + "&today=" + today
	showContactTimer1(); // quickly begin the load bar
	xmlHttp=GetXmlHttpObject(stateChangedCal)
	xmlHttp.open("GET", url , true)
	xmlHttp.send(null)
} 
function stateChangedCal() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("txtshowCalender").innerHTML=xmlHttp.responseText 
	} 
} 
//
function GetXmlHttpObject(handler)
{ 
var objXmlHttp=null

if (navigator.userAgent.indexOf("Opera")>=0)
{
alert("This example doesn't work in Opera") 
return 
}
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 showContactTimer () {
	var loader = document.getElementById('loadBar');
	loader.style.display = 'block';
	sentTimer = setTimeout("hideContactTimer()",1000);
}
function hideContactTimer () {
	var loader = document.getElementById('loadBar');
	loader.style.display = "none";
}

function showContactTimer1 () {
	var loader = document.getElementById('loadBar1');
	loader.style.display = 'block';
	sentTimer = setTimeout("hideContactTimer1()",1000);
}
function hideContactTimer1 () {
	var loader = document.getElementById('loadBar1');
	loader.style.display = "none";
}