LSCSSIDResult 			= "LSResult";
LSCSSIDResultList		= "LSResultList";
LSCSSIDInput			= "LSInput";
var xmlHttp


LSisIE = false;
LSTimeout = 0;
LSWindowTimeout = 0;
LSLastSearch = "";
LSMinimumCharacters = 2;

function liveSearchStart()
{

	if (LSTimeout)
	{
		window.clearTimeout(LSTimeout);
	}
	LSTimeout = window.setTimeout("showResult()", 200);
}

function liveSearchShow()
{
	if (LSWindowTimeout)
	{
		window.clearTimeout(LSWindowTimeout);
	}
	if (document.getElementById(LSCSSIDResult).style.display == "none")
	{
		//highlight = document.getElementById(LSCSSIDResultList).firstChild;
		//i = document.getElementById(LSCSSIDResultList).childNodes.length;
		//while (i > 0)
		//{
			//if(highlight.className == LSCSSCLASSResultListItem)
			//{
				document.getElementById(LSCSSIDResult).style.display = "block";
			//}
			//highlight = highlight.nextSibling;
			//i--;
		//}
	}
}








function showResult()
{
	
if (escape(document.forms.LSForm.search.length)==0)
 { 
 document.getElementById("livesearch").innerHTML="";
 document.getElementById("livesearch").style.border="0px";
 return
 }

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 } 

var url="livesearch/livesearch.php"
url=url+"?q="+escape(document.forms.LSForm.search.value)
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

liveSearchShow()

} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("LSResultList").innerHTML=xmlHttp.responseText;
 document.getElementById("LSResultList").style.border="1px solid #A5ACB2";
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}


function liveSearchMouseOut()
{
	document.getElementById(LSCSSIDInput).value = "";
	liveSearchHideDelayed()
}

function liveSearchHideDelayed()
{
	if (LSWindowTimeout)
	{
		window.clearTimeout(LSWindowTimeout);
	}
	LSWindowTimeout = window.setTimeout("liveSearchHide()",500);
}

function liveSearchHide()
{
	
	if (LSWindowTimeout)
	{
		window.clearTimeout(LSWindowTimeout);
	}
	document.getElementById(LSCSSIDResult).style.display = "none";
	var highlight = document.getElementById(LSCSSIDResultHighlight);
	if (highlight) {
		highlight.removeAttribute("id");
	}
	
	return true;
}