

// FONT REPLACEMENT
// Replace all tags with cufon equivalant
Cufon.replace('h1,h2,h3,h4,h5,h6,#commentform label');
//

// JQUERY
$(function(){
		   
	   // Clear searchform on click
		$("#searchform #s").click(function(){
			$(this).val("");   
		});
		
	
		// Dropdown Menu config
		$("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    30,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason.
	
	
	// Softbutton = soft fade on hover, used for social media icons
	$(".softbutton a").stop().fadeTo("fast", .55);
	$(".softbutton a").hover(
		function(){
			$(this).stop().fadeTo("fast", 1);
		},
		function(){
			$(this).stop().fadeTo("fast", .55);
		}
	);
	
	
	// Promo slider setup, inserted on when promo is in use to save bandwidth
	
	$('#promos').cycle({ 
		fx:     'fade', 
		speed:  3000, 
		timeout: 25000,
		pager: '#promo-nav',
		pause: 1,
		height: 'auto',
		pauseOnPagerHover: 1,
		fastOnEvent: 350,
		pagerAnchorBuilder: function(idx, slide) { 
			return "#promo-nav li:eq("+ idx +") a"; 
		}
	});
	
	// Fix applied so menu appears OVER cycled images
	// Reverse the default z-index stacking order of the elements
	var startIndex = 1500;
	$('div').each(function() {
		$(this).css('zIndex', startIndex);
		startIndex -= 5;
	});
	

});// end jquery


var coup1="TDB001";
var coup2="GOLD15";
var coup3="GOLD20";

function CalculateOrder(form) {

 if (form.text1.value == coup1)
 {
 form.discount_amount.value = "2.5";
 form.discount_amount2.value = "0";
 form.on0.value = "Coupon";
 form.os0.value = "TDB001 - Free Shipping";
 }
  if (form.text1.value == coup2)
 {
 form.discount_rate.value = "15";
 form.discount_rate2.value = "15";
 form.on0.value = "Coupon";
 form.os0.value = "TDB002 - Discount 15%";
 }
  if (form.text1.value == coup3)
 {
 form.discount_rate.value = "20";
 form.discount_rate2.value = "20";
 form.on0.value = "Coupon";
 form.os0.value = "TDB003 - Discount 20%";
 }
}
