var xmlHttp
var temp;
function showResult(str)
{
	$("#loader_id").fadeIn();
	$("#cx").hide();
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 } 
	 
	 	
	if (str.length==0)
	 { 
		
		str=" ";
		stateChanged();
	 }
	var url="livesearch.php5";
	url=url+"?q="+str;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged; 
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	var btimageUrl ='/codes/nav_button_down-blue.png' ;
	$("#boxright a").css( {'font-weight' : 'normal', 'background-image' : 'none'  ,   'color': '#666666'  });
	$("#bt_"+str).css( {'font-weight' : 'normal', 'background-image' : 'url(' + btimageUrl + ')' ,   'background-repeat': 'no-repeat'  ,   'color': '#000000'  });
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
			$(".fadein").fadeOut('', function(){
											
											
											if (xmlHttp.responseText!=temp)
											{
												document.getElementById("livesearch"). innerHTML=xmlHttp.responseText;
												document.getElementById("livesearch"). style.border="0px solid #ffffff";
												$("#livesearch").fadeIn();
												$('.result_first').showdelay();
												$('.result').showdelay();
												
												temp=xmlHttp.responseText;
											}
											$("#loader_id").fadeOut();
										});
												

	 }
	 
	 
	 				// new -- focuse selected
	/*
						$(".result, .result_first").hover(
					  function () {
						$(".result, .result_first").not(this).fadeTo( "fast",0.20);
					  }, 
					  function () {
						$(".result, .result_first").fadeTo(20,1);
					  }
					);		 
	 
	 */
	 
	 
}
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;
}




