// JavaScript Document

$().ready( function()  	{
	
		$("#nav li:has(ul)").hover( function()	{
			$(this).children("ul").css("display", "block");
			},	function()	{
			$(this).children("ul").fadeOut("normal");
		});
		
		// JS Code for Google Search Form
		if( $(".googleSearchForm .inputText").length > 0 ) {

			$(".googleSearchForm .inputText").click( function() {
				var $cValue = $(this).val();
				if( $cValue == "search: www.wfn.tv") {
					$(".googleSearchForm .inputText").val("");
				}
			});
		}
		// end of JS Google Search Form's Code
		
		$("#wfnLoginBtn").click( function() {
			$(".wfnloginNormalDiv").slideUp("normal").next().slideDown("normal");
		});

		// JS code for selecting different Country
		if( $('.select_country_div').length > 0 ) { 
		
			$(".select_country_div > a").click( function(e1) {
				if( $(this).is('.country_selected') ) {
					return;	
				}
				var $region = $(this).attr("title");
				var leftX=e1.pageX+10+"px";
			  	var topY=e1.pageY+5+"px";
				
				$('#set_country').attr("href", "setcountry.php?country="+$region);
				if( $region == "CAN" ) $region = "Canada";
				$('#set_country').html("Proceed to WFN Shop "+$region);
 			 	$('#popup_div').css( {'left':leftX, 'top':topY } ).fadeIn('normal');
			});	
		
			$("#popup_div .link_div > a.hide_popup").click( function() {	
				$(this).parent().parent().fadeOut('normal');
			});	
		}

		// end of Selecting different Country's Code
		newsletterSignUp();

});



