jQuery(document).ready(function(){	

	if(jQuery("#catPop").length > 0) {
		
		var catPopHovered = "n"
		
		function showCatPop(){
			//jQuery("#nav-products-hover").show();
			jQuery("#catPopWrap").fadeIn(250);
		};

		function hideCatPop(){
			if(catPopHovered == "n") { 
				//jQuery("#nav-products-hover").hide();
				jQuery("#catPopWrap").fadeOut(250);
			};
		};
		
		var hoverConfig = {    
		     sensitivity: 3, // number = sensitivity threshold (must be 1 or higher)    
		     interval: 0, // number = milliseconds for onMouseOver polling interval    
		     over: showCatPop, // function = onMouseOver callback (REQUIRED)    
		     timeout: 500, // number = milliseconds delay before onMouseOut    
		     out: hideCatPop // function = onMouseOut callback (REQUIRED)    
		};
		jQuery("#nav-products").hoverIntent(hoverConfig);
		
		jQuery("#catPopWrap").mouseover(function(){
			catPopHovered = "y";
		});

		jQuery("#catPopWrap").mouseleave(function(){
			catPopHovered = "n";
			//jQuery("#nav-products-hover").hide();
			jQuery("#catPopWrap").fadeOut(500);
		});

		jQuery("#catPop ul li a.toplevel:not(.direct)").click(function(){
			jQuery("#catPop ul li a.toplevel").removeClass("topLevelSelect");
			jQuery(this).addClass("topLevelSelect");
			jQuery("#catPop ul li ul").hide();
			jQuery(this).parent().children().fadeIn(250);
			return false;
		});
		
		/*
		jQuery("#nav-products").mouseover(function(){
			jQuery("#catPop").show();
		});
		
		jQuery(".catPopHover").mouseleave(function(){
			jQuery("#catPop").hide();
		});
		*/
		
	};
	


	if (jQuery("#slider").length > 0) { 

		jQuery('#slider ul').cycle({
			fx: 'fade',
			timeout: 7000,
			pager: '#slideNumber',
			pause: 1
		});

	};
		
		
	if (jQuery("#search").length > 0) { 
	
		jQuery('#search').focus(function(){
		
			if (jQuery(this).attr("value") == "Product Search") {
				jQuery(this).attr("value","");
			};
			if (jQuery(this).attr("class") == "input-text") {
				jQuery(this).attr("class","input-text highlight");
			};
			
		});

		jQuery('#search').blur(function(){

			if (jQuery(this).attr("value") == "") {
				jQuery(this).attr("value","Product Search");
			};
			if (jQuery(this).attr("class") == "input-text highlight") {
				jQuery(this).attr("class","input-text");
			};

		});
	
	};
	
		
				
	if (jQuery("#newsletter").length > 0) { 
	
		jQuery('#newsletter').focus(function(){
		
			if (jQuery(this).attr("value") == "Enter your email") {
				jQuery(this).attr("value","");
			};
			if (jQuery(this).attr("class") == "required-entry validate-email input-text") {
				jQuery(this).attr("class","required-entry validate-email input-text highlight");
			};
			
		});

		jQuery('#newsletter').blur(function(){

			if (jQuery(this).attr("value") == "") {
				jQuery(this).attr("value","Enter your email");
			};
			if (jQuery(this).attr("class") == "required-entry validate-email input-text highlight") {
				jQuery(this).attr("class","required-entry validate-email input-text");
			};

		});
	};

});