/*
** These are globe variables so that the functions can't be called in same file twice
** If you want to use twice, you have to call second set of functions
*/

var xmlHttp
var field1
var field2

var xmlHttp_2
var field1_2
var field2_2

var xmlHttp_3
var field1_3
var field2_3

var xmlHttp_4
var field1_4
var field2_4



/*
** Get XML HTTP Object
** -------------------------------------------------------------
*/
function GetXmlHttpObject()
{ 
	var objXMLHttp = null
	if (window.XMLHttpRequest)
	{
		objXMLHttp = new XMLHttpRequest()
		
		if (objXMLHttp.overrideMimeType)
		{
			objXMLHttp.overrideMimeType('text/xml');
        }
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
} 
/*
** -------------------------------------------------------------
*/


/*
** show hint on search box
** -------------------------------------------------------------
*/

function AjaxShow(qstr, file, f1, f2)
{ 
	field1 = f1
	field2 = f2
	
	if (qstr.length == 0)
	{ 
		field1.innerHTML = ""
		return
	}
	
	xmlHttp = GetXmlHttpObject()	
	
	if (xmlHttp == null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	
	var url = file + "?q=" + qstr
		
	xmlHttp.onreadystatechange=StateChanged
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
} 



function StateChanged() 
{ 
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == "complete")
	{ 
		field1.innerHTML = xmlHttp.responseText
		
		if (typeof(field2) == "object") {
			field2.innerHTML = ""
		}
	} 
}

/*
** -------------------------------------------------------------
*/

/*
** Second set of functions
*/

/*
** show hint on search box
** -------------------------------------------------------------
*/

function AjaxShow_2(qstr, file, f1, f2)
{ 
	field1_2 = f1
	field2_2 = f2
	
	if (qstr.length == 0)
	{ 
		field1_2.innerHTML = ""
		return
	}
	
	xmlHttp_2 = GetXmlHttpObject()	
	
	if (xmlHttp_2 == null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	
	var url = file + "?q=" + qstr
		
	xmlHttp_2.onreadystatechange=StateChanged_2
	xmlHttp_2.open("GET",url,true)
	xmlHttp_2.send(null)
} 



function StateChanged_2() 
{ 
	if (xmlHttp_2.readyState == 4 || xmlHttp_2.readyState == "complete")
	{ 
		field1_2.innerHTML = xmlHttp_2.responseText
		
		if (typeof(field2_2) == "object") {
			field2_2.innerHTML = ""
		}
	} 
}



/*
** -------------------------------------------------------------
*/

/*
** Third set of functions
*/

/*
** show hint on search box
** -------------------------------------------------------------
*/

function AjaxShow_3(qstr, file, f1, f2)
{ 
	field1_3 = f1
	field2_3 = f2
	
	if (qstr.length == 0)
	{ 
		field1_3.innerHTML = ""
		return
	}
	
	xmlHttp_3 = GetXmlHttpObject()	
	
	if (xmlHttp_3 == null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	
	var url = file + "?q=" + qstr
		
	xmlHttp_3.onreadystatechange=StateChanged_3
	xmlHttp_3.open("GET",url,true)
	xmlHttp_3.send(null)
} 



function StateChanged_3() 
{ 
	if (xmlHttp_3.readyState == 4 || xmlHttp_3.readyState == "complete")
	{ 
		field1_3.innerHTML = xmlHttp_3.responseText
		
		if (typeof(field2_3) == "object") {
			field2_3.innerHTML = ""
		}
	} 
}

/*
** -------------------------------------------------------------
*/




/*
** -------------------------------------------------------------
*/

/*
** Fourth set of functions
*/

/*
** show hint on search box
** -------------------------------------------------------------
*/

function AjaxShow_4(qstr, file, f1, f2)
{ 
	field1_4 = f1
	field2_4 = f2
	
	if (qstr.length == 0)
	{ 
		field1_4.innerHTML = ""
		return
	}
	
	xmlHttp_4 = GetXmlHttpObject()	
	
	if (xmlHttp_4 == null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}
	
	var url = file + "?q=" + qstr
		
	xmlHttp_4.onreadystatechange=StateChanged_4
	xmlHttp_4.open("GET",url,true)
	xmlHttp_4.send(null)
} 



function StateChanged_4() 
{ 
	if (xmlHttp_4.readyState == 4 || xmlHttp_4.readyState == "complete")
	{ 
		field1_4.innerHTML = xmlHttp_4.responseText
		
		if (typeof(field2_4) == "object") {
			field2_4.innerHTML = ""
		}
	} 
}

/*
** -------------------------------------------------------------
*/







