function ajaxSearch(value){
			 if (value.length<3) {
				  hidesearch();
				  return ;
			 }
			 waitSaerchOn();
			//var oVariable = $('myFormSearch').toQueryString(); 
			var oVariable = 'inputKeyword='+$('inputKeyword').value; 
			var oFileName = '../search/ajax-search.php';
			new Ajax(oFileName , { method: 'post', postBody: oVariable, update: 'search-result-home', 
			onComplete: function(){
				waitSaerchOff();		
				overlay("result-box", "search-result-home");
			}
		}).request();
}
function waitSaerchOn(){
	$('wait-search').style.display='';
}
function waitSaerchOff(){
	$('wait-search').style.display='none';
}
function getposOffset(overlay, offsettype){
     var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
     var parentEl=overlay.offsetParent;
     while (parentEl!=null) {
          totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
          parentEl=parentEl.offsetParent;
     }
     return totaloffset;
}

function overlay(curobjstr, subobjstr) {
     if (document.getElementById) {
          var subobj=document.getElementById(subobjstr);
          var curobj=document.getElementById(curobjstr);
          subobj.style.display="block";
          var xpos=getposOffset(curobj, "left");
          xpos=xpos-subobj.offsetWidth+curobj.offsetWidth;
          if (xpos<0) xpos=0;
          subobj.style.left=xpos+"px";
          var ypos=getposOffset(curobj, "top");
          subobj.style.top=ypos+curobj.offsetHeight+2+"px";
          
     };
}
var timedelay = 0;
function hidesearch() {
     timedelay=setTimeout('document.getElementById("search-result-home").style.display="none"', 250);
}
function delayhidesearch() {
     clearTimeout(timedelay);
}
function formSerachsubmit(){
	var x = $('inputKeyword').value;
	if(x.length>2){
		document.myFormSearch.action='../search/index.php';
		$('inputKeywordSubmit').value=x;
		document.myFormSearch.submit();
	}
	else $('inputKeyword').focus();
}

