/* Cufon'd headings */
	if (!$.browser.msie && $.browser.version != '6.0') {
		Cufon.replace(
			'#pagebody h1:not(#pagebody .masthead h1),' +  
			'#pagebody h2:not(.productName, #productlister .name, #categorylister .name, .productzone .name, .noCufon)', 
			{fontFamily: 'Dax'}
		);
	}
	
	$(function() {
		// hack for IE to allow dropdowns to show over multiple rows
		$('#navigation > li').hover(function() { 
			//Changed to a direct child selector to speed lookups
			$('#navigation > li').css('z-index', '0');
			$(this).css('z-index', '1');
			//Removed 'reset to zero' as any subsequent actions on other items will do this anyway. Prevents the 'flash of glitchiness' in IE
		}); 
		
		//Animate in the system messages where possible, to draw attention
		$('body .message').fadeIn(500);
				
		 //Enhance the main product image with zoom 
		//These should be able to be combined, but the plugins don't like it.
				
		 if (typeof($().jqzoom) != 'undefined') {
			 $('a.pdlargerimage', 'body.productdetails')
				.jqzoom({
						zoomWidth:485,
						zoomHeight:273,
						xOffset:49,
						yOffset:-20, //To account for the padding+border on the image frame
						title:false
				 })
				.lightBox({
						overlayBgColor: '#FFFFFF',
						overlayOpacity: 0.5,
						imageLoading: '/wcsstore/ConsumerDirectStorefrontAssetStore/images/Master1_1/icon_lightBox_ticker.gif',
						useNavigation: false
				 });
			$('a.pdlargerimage', 'body.rangeDetail')
				 .lightBox({
						overlayBgColor: '#FFFFFF',
						overlayOpacity: 0.5,
						imageLoading: '/wcsstore/ConsumerDirectStorefrontAssetStore/images/Master1_1/icon_lightBox_ticker.gif',
						useNavigation: false
				 })
				.jqzoom({
						zoomWidth:460,
						zoomHeight:282,
						xOffset:40,
						yOffset:-19, //To account for the padding+border on the image frame
						title:false
				 });
 			}
					
			//Do some nice tabbing on the details panel:
			//Set the default tab
			 $('#pagebody ol.tabs, #pagebody ol.tabbedPanels')
			 .find('li:first').addClass('active');
			 
			// display appropriate tab content when tab clicked
			 $('#pagebody ol.tabs a').click(function(){
				$(this)
					.closest('li')
							.addClass('active')
							.siblings('li').removeClass('active')
					.closest('ol')
					.siblings('ol.tabbedPanels')
						.children('li.tab').removeClass('active')
						.filter('li.tab:eq(' + $('ol.tabs a').index(this) + ')').addClass('active');
					return false;
			 });


			// display delivery details when any of icons clicked
			$('div.deliveryIcons div.avail span.desc').bind('click', showDelivTab); 
			
			function showDelivTab() {
				// make delivery tab active and show delivery content
				$('div.details ol.tabs li.delivery, div.details ol.tabbedPanels li.delivery')
					.addClass('active')
					.siblings('li').removeClass('active'); 
			}

			 /* DELIVERY MASTHEAD MESSAGE ---------------------------------------------------------------- */
			 
			//Change delivery text in blue masthead on the delivery options page
			$('#pagebody #AdvancedCartForm ul.shippingMethods input[type="radio"]').click(function () {
				if ($(this).hasClass ("nextday")) {
					//Change blue masthead message based on selected delivery type
					$('#shippingModeOverallHeader span.typedelivery').text(nextDayName);
					$('#shippingModeOverallHeader span.chargedelivery').text(nextDayCharge);
				} else {
					//Set Delivery message to standard (default)
					$('#shippingModeOverallHeader span.typedelivery').text(defaultName);
					$('#shippingModeOverallHeader span.chargedelivery').text(defaultCharge);
				}
			});

		   //product images lightbox functions
		   if($("a.tbProd").length) {
	   			$("a.tbProd").lightBox({
						overlayBgColor: '#FFFFFF',
						overlayOpacity: 0.5,
						imageLoading: '/wcsstore/ConsumerDirectStorefrontAssetStore/images/Master1_1/icon_lightBox_ticker.gif',
						useNavigation: false
				 });
			}
			$('#basket_display a.actionButton').click(function() {
				var isDisabled = $(this).attr('class');
				if(isDisabled=="actionButton continue disabled") {
				  $('.clearfix.continueAction').addClass('highLight');
				}
			});
		});

