
/*function toggleSearchForm(){
 	document.getElementById("search_btn").onclick = function(){
		searchform = document.getElementById('search_form_wrapper');
		searchBtnATag = this.getElementsByTagName("a")[0];
		searchBtnATag.className = (searchBtnATag.className == "current") ? "none" : "current";
		
		searchform.style.display = (!searchform.style.display || searchform.style.display == "none") ?  "block" : "none";
		
	}
}*///function toggleSearchForm end

function toggleSearchForm(){
/* 	document.getElementById("search_btn").onclick = function(){
		searchform = document.getElementById('search_form_wrapper');
		searchBtnATag = this.getElementsByTagName("a")[0];
		searchBtnATag.className = (searchBtnATag.className == "current") ? "none" : "current";
		
		searchform.style.display = (!searchform.style.display || searchform.style.display == "none") ?  "block" : "none";
		
	}
	*/
	$("#search_btn").click(function(){
		$(this).toggleClass("current");
		if($("#search_form_wrapper").css("display")=="block")
			{
				$("#search_form_wrapper").css("display","none");
				$("#searchMaskBgDiv").css("display","none");
			}
		else 
		{
			$("#search_form_wrapper").css("display","block");
			$("#searchMaskBgDiv").css("display","block");
		}
	});//click end
	
	var searchFormHideID;
	$("#search_btn").hover(
		function (){
			clearTimeout(searchFormHideID);
			//searchFormShowID = setTimeout(function(){
				$("#search_form_wrapper").css("display","block");
				$("#search_btn > a").addClass("current");
				$("#searchMaskBgDiv").css("display","block");
				//},100);
			
			},
		function (){
				//clearTimeout(searchFormShowID);
				searchFormHideID = setTimeout(function(){
				$("#search_form_wrapper").css("display","none");
				$("#search_btn > a").removeClass("current");
				$("#searchMaskBgDiv").css("display","none");
				},100);
				
				( $("#search_form_wrapper #keywords").get()[0].focused == true ) ? clearTimeout(searchFormHideID) : "";//keywords input element onFocus, clear search form hide action
			}
		);//hover end
	
	$("#search_form_wrapper").hover(
		function (){
			clearTimeout(searchFormHideID);
			},
		function (){
			searchFormHideID = setTimeout(function(){
				$("#search_form_wrapper").css("display","none");
				$("#search_btn > a").removeClass("current");
				$("#searchMaskBgDiv").css("display","none");
				},500);

			( $("#search_form_wrapper #keywords").get()[0].focused == true ) ? clearTimeout(searchFormHideID) : "";//keywords input element onFocus, clear search form hide action
			}
		);//hover end
	
	$("#search_form_wrapper #keywords").focus(function(){
			this.focused = true;
		}).blur(function(){
			this.focused = false;
			});//focus blur end
}//function toggleSearchForm end

/*function firstSearchForm(){
 	document.getElementById("search_btn").onmouseover = function(){
		searchform = document.getElementById('search_form_wrapper');
		searchBtnATag = this.getElementsByTagName("a")[0];
		if(searchBtnATag.className != "current")
		{
			searchBtnATag.className = "current";
			searchform.style.display = "block";
		}
	}
}*///function toggleSearchForm end

//addEvent(window,"load",toggleSearchForm);
//addEvent(window,"load",firstSearchForm);
