$(document).ready(function() {

/* Start ready() functions */ 

	/* USE SUPERFISH & BGIFRAME ON CAT NAV DROP-DOWNS */
	 
	$("#navigation").superfish({
		animation : { opacity:"show", height:"show" }
		})
		.find(">li:has(ul)")
			.mouseover(function(){
				$("ul", this).bgiframe({opacity:false});
				})
				.find("a")
			.focus(function(){
		$("ul", $("#navigation>li:has(ul)")).bgiframe({opacity:false});
	});
	
	/*  LOAD IMAGE ZOMM FUNCTIONALITY */
	$(".jqzoom").jqueryzoom();
	
	// BS-SPECIFIC
	
	storeIsBS = $("#logo a img").attr("alt").indexOf("Sherman");
	/* Match SAFE site to store name */
		if (storeIsBS!==-1) {
		
		//alert('test');
		
		
			// REMOVE TITLE ON SEARCH BUTTON AS INTERFERING WITH :HOVER STATE
			$('#searchbutton').attr('title','');
			
			// REMOVE TITLES ON TOPLINKS AS INTERFERING WITH :HOVER STATE
			$('#toplinks li a').attr('title','');
			
			// REMOVE TITLES ON NAVIGATION TOP LINKS AS INTERFERING WITH :HOVER STATE
			$('.toplink').attr('title','');

			// ADD CLASS TO HIDE SHOW WORLDWIDE SITES LINK DEPENDING UPON LOCATION IN SITE AS SHOULD ONLY BE VISIBLE ON HOME OR STATIC PAGES
			// search for text in link - leave out first letter in case of case sensitivity when someone changes!
			$('#toplinks').find("li a:contains('orldwide')").parent().addClass("link_worldwide");
			
			// Identify previous link so can then style as though final link on pages where link_worldwide not visible
			$('#toplinks').find("li a:contains('orldwide')").parent().prev().addClass("link_pre_worldwide");
		
			// ADD CLASS TO FOOTER NEWSLETTER LINK SO CAN STYLE DIFFERENTLY FROM OTHERS
			$('#footerlinks').find("li a:contains('ewsletter')").parent().addClass("link_newsletter");
			
			/* Commented out APW 05/02/2009. Elements moved on JSP so don't need to move them here.
			// MOVE PRODUCT DESCRIPTION TO BELOW BUTTONS ON PDP
			var productdetails = $('.detailsdisplay dd.details ').text();
			var productmaterials = $('.detailsdisplay dd.materials').text();
			var productdescriptiveAttributes = $('.detailsdisplay dd.descriptiveAttributes').html();
			if (productdescriptiveAttributes == null) productdescriptiveAttributes='';
			var productlongdescription = $('.detailsdisplay .productlongdescription').text();
			
			$('.detailsdisplay .productlongdescription').remove();
			$(".detailsdisplay .action").after("<dd class='BS_productlongdescription'>" + productlongdescription + "</dd>");	
					
			//$('.detailsdisplay dd.details ').remove();
			//$(".detailsdisplay .BS_productlongdescription").after("<dd class='BS_details'>" + productdetails + "</dd>");
			
			$('.detailsdisplay dd.materials').remove();
			$(".detailsdisplay .share").before("<dd class='BS_materials'>" + productmaterials + "</dd>");
			
			$('.detailsdisplay dd.descriptiveAttributes').remove();
			$(".detailsdisplay .BS_materials").after("<dd class='BS_descriptiveAttributes'>" + productdescriptiveAttributes + "</dd>");
			*/
					if($.browser.msie && parseInt($.browser.version) <= 6){ 
						$('.jqzoom').mouseover(function(){
							//$('.detailsdisplay #dropdownoptions').css('display','none');
							//$('.detailsdisplay #quantity').css('display','none');
						 });
						 
						$('.jqzoom').mouseout(function(){
							//	$('.detailsdisplay #dropdownoptions').css('display','block');
							//	$('.detailsdisplay #quantity').css('display','block');
						 });
					}
		}
		else {}

	/* USE SEARCH FORM LABEL IN SEARCH FIELD */

	  var searchLabel = $('#CatalogSearchForm label').remove().text();
	  $('#searchbox').addClass('placeholder').val(searchLabel).focus(function() {
	    if (this.value == searchLabel) {
	      $(this).removeClass('placeholder').val('');
	    };
	  }).blur(function() {
	    if (this.value == '') {
	      $(this).addClass('placeholder').val(searchLabel);
	    };
	  });
	  $('#searchbutton').click(function() {
	    if ($('#searchbox').val() == searchLabel) {
	      $('#searchbox').val('');
	    }
	  });  
	  $('#searchbutton').blur(function() {
	   if ($('#searchbox').val() == '') {
	     $('#searchbox').val(searchLabel);
	    }
	  });
	 
	 /* USE SEARCH FORM LABEL IN SEARCH FIELD */
	if($('#SLISearchForm').length > 0)
	{
		var searchLabel = $('#SLISearchForm label').remove().text();
		  $('#sli_search_1').addClass('placeholder').val(searchLabel).focus(function() {
		    if (this.value == searchLabel) {
		      $(this).removeClass('placeholder').val('');
		    };
		  }).blur(function() {
		    if (this.value == '') {
		      $(this).addClass('placeholder').val(searchLabel);
		    };
		  });
		  $('#searchbutton').click(function() {
		    if ($('#sli_search_1').val() == searchLabel) {
		      $('#sli_search_1').val('');
		    }
		  });  
		  $('#searchbutton').blur(function() {
		   if ($('#sli_search_1').val() == '') {
		     $('#sli_search_1').val(searchLabel);
		    }
		  });
	}
	  
/* Close ready() functions */ 
  
});	