$('head').append('<link href="/shared/css/noflicker.css" media="all" rel="stylesheet" type="text/css" />')

$(document).ready(function(){
	
	// menu
	//$("dd:not(#active)").hide();
	$("dd#active").show();	
	$("dt a").click(function(){
		$(this).parent().next().siblings("dd:visible").slideUp("fast");
		$(this).parent().next().slideDown("fast");
		$(".current").removeClass("current");
		$(this).addClass("current");
		return false;
	});	
	
	$('div.shipmentMethodLongDesc').hide();
	
	// every time shipment method is clicked
	$("input[@type=radio][@name=SHIPMENT_METHOD]").click( function() {

		// if it has a class, use it as a hook
		if( $(this).hasClass('shipWarningSat') ){
			//hide any existing warnings
			$('div.shipWarningMessage').hide();
			// display message
			$(this).before('<div class="shipWarningMessage">This package will be delivered on Monday, if you need Saturday delivery please check the Saturday delivery option below.</div>');
			// highlight the option we want them to check in green
			$('tr.saturdayDelivery').addClass('messagegreen');
		}
		else if( $(this).hasClass('shipWarningSun') ){
			// hide any existing warnings
			$('div.shipWarningMessage').hide();
			// display message
			$(this).before('<div class="shipWarningMessage">This package will be delivered on Monday, if you need Sunday delivery please check the Sunday delivery option below.</div>');
			// highlight the option we want them to check in green
			$('tr.sundayDelivery').addClass('messagegreen');
		}
		else{
			// if no class then remove all messages and highlights
			$('div.shipWarningMessage').hide();
			$('tr.saturdayDelivery').removeClass('messagegreen');
			$('tr.sundayDelivery').removeClass('messagegreen');			
		};
		
		// shipment method long desc
		if( $(this).parent().find('shipmentMethodLongDesc') ){
			$('div.shipmentMethodLongDesc').hide();
			$(this).parent().find('div.shipmentMethodLongDesc').show();
		}
		else{
			$('div.shipmentMethodLongDesc').hide();
		};
		
	});
	
	// hide the alertRush div
	$('.rushDeliveryDisplay').hide();
	
	// if ORDER_RUSH_DELIVERY_FG wasn't checked on step 2, we're giving them one last chance to check it on step 4
	// if it wasn't checked then ORDER_RUSH_DELIVERY_FG = 0 and we're adding an ID to that input button
	// when the button is clicked
	$('input[type=submit].rushDeliveryButton').click(function(){
		$(this).hide();
		$(this).next('div').show('fast');
		return false;
	});
			
});