/** 
 *  
 * Version  	Date          Author       				Comment
 *	1     04/17/2009         Infosys(Deepak Suneja)		put '/' before images
 *  2	  01/08/2010		 Infosys(Deepak Agarwal)	M#6272-Revision to Search Box Pop Up Interaction 
 *	3	  02/11/2010		 Infosys(Selva Kumar P)	    ENH 30 - Updated code for allowing product search results URLs to be book marked
 *  4	  06/08/2010		 Infosys(Sujay Padalkar)	Added code for Japanese Language images
 *  5     05/11/2011    	 Infosys(Selva Kumar P)   	Added code for search filters enhancement.
 *  6     07/07/2011    	 Infosys(Selva Kumar P)   	Update code to display loading results dialog while filtering search results in search page
 */
$(function() {

/*
	$("#searchterm input[type=image], #attribute_category input[type=image], #headerSearch input[type=image]").hover(

		function(event) {$(event.target).attr("src", "/images/b_search_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_search.png");}
	);
	$("#searchterm input[type=image], #attribute_category input[type=image], #headerSearch input[type=image]").focus(
		function(event) {$(event.target).attr("src", "/images/b_search_rollover.png");}
	);
	$("#searchterm input[type=image], #attribute_category input[type=image], #headerSearch input[type=image]").blur(
			function(event) {$(event.target).attr("src", "/images/b_search.png");}
	);
	
	$("#exploreButton").hover(
			function(event) {$(event.target).attr("src", "/images/b_explore_rollover.png");},
			function(event) {$(event.target).attr("src", "/images/b_explore.png");}
	);
	
	$("#goButton").hover(
			function(event) {$(event.target).attr("src", "/images/b_go_rollover.png");},
			function(event) {$(event.target).attr("src", "/images/b_go.png");}
	);
	
	$(".cancelButton").hover(
		function(event) {$(event.target).attr("src", "/images/b_cancel_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_cancel.png");}
	);
	
	$(".okButton").hover(
			function(event) {$(event.target).attr("src", "/images/b_ok_rollover.png");},
			function(event) {$(event.target).attr("src", "/images/b_ok.png");}
	);
	
	$(".signinButton").hover(
			function(event) {$(event.target).attr("src", "/images/b_signin_rollover.png");},
			function(event) {$(event.target).attr("src", "/images/b_signin.png");}
	);
	
	$(".checkout").hover(
		function(event) {$(event.target).attr("src", "/images/b_checkout_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_checkout.png");}
	);

	$(".reviewcart").hover(
		function(event) {$(event.target).attr("src", "/images/b_review_cart_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_review_cart.png");}
	);
	
	$(".add_wide").hover(
		function(event) {$(event.target).attr("src", "/images/b_add_wide_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_add_wide.png");}
	);
	
	$("img.detailTable").hover(
		function(event) {$(event.target).attr("src", "/images/b_table_detail_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_table_detail.png");}
	);
	$("img.simpleTable").hover(
		function(event) {$(event.target).attr("src", "/images/b_table_simple_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_table_simple.png");}
	);	
	$("img.detailTable_jp").hover(
			function(event) {$(event.target).attr("src", "/images/b_table_detail_rollover_jp.png");},
			function(event) {$(event.target).attr("src", "/images/b_table_detail_jp.png");}
	);
	$("img.simpleTable_jp").hover(
		function(event) {$(event.target).attr("src", "/images/b_table_simple_rollover_jp.png");},
		function(event) {$(event.target).attr("src", "/images/b_table_simple_jp.png");}
	);
	$(".supportbtn").hover(
		function(event) {$(event.target).attr("src", "/images/b_support_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_support.png");}
	);
	$(".b_add_to_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_add_to_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_add_to_quote.png");}
	);
	$(".b_cancel_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_cancel_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_cancel_quote.png");}
	);
	$(".b_confirm_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_confirm_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_confirm_quote.png");}
	);
	$(".b_empty_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_empty_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_empty_quote.png");}
	);
	$(".b_get_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_get_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_get_quote.png");}
	);
	$(".b_save_quote_as_list").hover(
		function(event) {$(event.target).attr("src", "/images/b_save_quote_as_list_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_save_quote_as_list.png");}
	);
	$(".b_update_quote").hover(
		function(event) {$(event.target).attr("src", "/images/b_update_quote_rollover.png");},
		function(event) {$(event.target).attr("src", "/images/b_update_quote.png");}
	);
*/
	
	
	$("#confirmDialog").css("left", Math.max((($(window).width() - $("#confirmDialog").width()) / 2), 0) + 'px');
	$("#confirmDialog").css("top", Math.max((($(window).height() - $("#confirmDialog").height()-6) / 2), 0) + 'px');

});

/*
 * The Following functions (show_search_options_menu, delay_hide_search_options_menu, and hide_search_options_menu) added 2009/11/10 by Jon Baize to support the menu dropdown on the search box
 */
var timeValue ;
function show_search_options_menu(){
	document.getElementById("search_options_container").style.visibility = 'visible';
	document.getElementById("search_options_container").style.opacity = '1';
	document.getElementById("pagetop").style.zIndex = 3000;
}
function delay_hide_search_options_menu(){
	timeValue = setTimeout("hide_search_options_menu()", 100);
}
function hide_search_options_menu(){
	document.getElementById("search_options_container").style.visibility = 'hidden';
	document.getElementById("search_options_container").style.opacity = '0';
	document.getElementById("pagetop").style.zIndex = 1;
}
function focus_search(){
	clearTimeout(timeValue);
	document.forms[0].key.focus();
	document.getElementById("search_options_container").style.visibility = 'visible';
}
function filterSearch(selectedFilter){
	$("#timeoutDialog").modal({closeHTML:""});
	document.forms[1].cs.value = selectedFilter;
	document.forms[1].submit();
}

