$(document).ready(function() {
    /* *** Cards Tab *** */
	var cardsTab = {    
		sensitivity: 40, // number = sensitivity threshold (must be 1 or higher)    
		interval: 100, // number = milliseconds for onMouseOver polling interval    
		over: cardsOn, // function = onMouseOver callback (REQUIRED)    
		timeout: 100, // number = milliseconds delay before onMouseOut    
		out: cardsOff // function = onMouseOut callback (REQUIRED)    
	};
	function cardsOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function cardsOff(){
		$(this).children().animate( { left: "-235px" }, 200 );
	}
	if ($("body").hasClass("cards")) {
		$("#navigation li.cards a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.cards a").hoverIntent( cardsTab );
	}
    
    /* *** Prices Tab *** */
    var pricesTab = {    
		sensitivity: 40,
		interval: 100,
		over: pricesOn,
		timeout: 100,
		out: pricesOff
	};
	function pricesOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function pricesOff(){
		$(this).children().animate( { left: "-215px" }, 200 );
	}
    if ($("body").hasClass("prices")) {
		$("#navigation li.prices a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.prices a").hoverIntent( pricesTab );
	}
	
	/* *** Quote Tab *** */
	var quoteTab = {    
		sensitivity: 40,
		interval: 100,
		over: quoteOn,
		timeout: 100,
		out: quoteOff
	};
	function quoteOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function quoteOff(){
		$(this).children().animate( { left: "-272px" }, 200 );
	}
    if ($("body").hasClass("quote")) {
		$("#navigation li.quote a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.quote a").hoverIntent( quoteTab );
	}
    
    /* *** Contact Tab *** */
    var contactTab = {    
		sensitivity: 40,    
		interval: 100,    
		over: contactOn,   
		timeout: 100,    
		out: contactOff    
	};
	function contactOn(){
		$(this).children().stop(true, true);
		$(this).children().animate( { left: "0px" }, 200);
	}
	function contactOff(){
		$(this).children().animate( { left: "-270px" }, 200 );
	}
    if ($("body").hasClass("contact")) {
		$("#navigation li.contact a").children().css({ 'left' : '0px' });
	} else {
		$("#navigation li.contact a").hoverIntent( contactTab );
	}
	
	/* *** Logo Glow *** */
	$("#head h1 a").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { opacity: 0.1 }, 300);
	},
	function(){
		$(this).animate( { opacity: 1.0 }, 200);
	});

	/* *** Quote Button *** */
	$("#left h1 a").fadeTo("fast", 0.9);
	$("#left h1 a").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { marginRight: "0px", opacity: 1.0 }, 200);
	},
	function(){
		$(this).animate( { marginRight: "4px", opacity: 0.9 }, 200);
	});
	
	/* *** Quote Button (Home) *** */
	$(".leading h3 a.quote").fadeTo("fast", 0.9);
	$(".leading h3 a.quote").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { marginLeft: "4px", opacity: 1.0 }, 200);
	},
	function(){
		$(this).animate( { marginLeft: "0px", opacity: 0.9 }, 200);
	});
	
	/* *** Quote Button (Prices) *** */
	$(".prices .head a.quote").fadeTo("fast", 0.9);
	$(".prices .head a.quote").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { right: "21px", opacity: 1.0 }, 200);
	},
	function(){
		$(this).animate( { right: "24px", opacity: 0.9 }, 200);
	});
	
	/* *** CardMarque Badge *** */
	$("#right .sticker").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { marginTop: "3px", opacity: 0.9 }, 200);
	},
	function(){
		$(this).animate( { marginTop: "0px", opacity: 1.0 }, 200);
	});
	
	/* *** Go to Card Button (Prices) *** */
	$(".prices .head a.link").fadeTo("fast", 0.9);
	$(".prices .head a.link").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { right: "20px", opacity: 1.0 }, 200);
	},
	function(){
		$(this).animate( { right: "25px", opacity: 0.9 }, 200);
	});
	
	/* *** Promo Ads (Home) *** */
	$("#banners .ad").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { right: "4px" }, 100);
	},
	function(){
		$(this).animate( { right: "0px" }, 100);
	});
	
	/* *** Card Range *** */
	$(".range a").hover(function(){
		$(this).children().stop(true, true);
    	$(this).children("img").animate( { top: "2px" }, 100);
    	$(this).children("em").animate( { opacity: 0.6 }, 200);
	},
	function(){
		$(this).children("img").animate( { top: "0px" }, 100);
    	$(this).children("em").animate( { opacity: 1.0 }, 200);
	});
	
	/* *** Extras Button *** */
	$("li.extras a, .spec h4 a").fadeTo("fast", 0.8);
	$("li.extras a, .spec h4 a").hover(function(){
		$(this).stop(true, true);
    	$(this).fadeTo("fast", 1.0);
	},
	function(){
		$(this).fadeTo("fast", 0.8);
	});
	
	/* *** Email Link *** */
	$("#intro .contact a").hover(function(){
		$(this).stop(true, true);
    	$(this).animate( { opacity: 0.7 }, 300);
	},
	function(){
		$(this).animate( { opacity: 1.0 }, 300);
	});
	
	/* *** Signup Button *** */
	$("#signup fieldset.button input, .form fieldset input.submitform").hover(function(){
		$(this).stop(true, true);
    	$(this).fadeTo("fast", 0.8);
	},
	function(){
		$(this).fadeTo("fast", 1.0);
	});
	
	/* *** Signup Input *** */
	$("input.sign-email").focus(function(){
		if ( $(this).val() == "Enter your email address")
        $(this).val('');
	});
	$("input.sign-email").blur(function(){
		if ( $(this).val() == "")
		$(this).val('Enter your email address');
	});
	
	/* *** Pricing Nav *** */
	$("li.howmuch").addClass("active");
	$("li.spec").click(function(){
		$("li.howmuch").removeClass("active");
		$(this).addClass("active");
		$(".scroller .chart").animate( { left: "-378px" } );
		$(".scroller .spec").animate( { left: "0px" } );
		return false;
	});
	$("li.howmuch").click(function(){
		$("li.spec").removeClass("active");
		$(this).addClass("active");
		$(".scroller .chart").animate( { left: "0px" } );
		$(".scroller .spec").animate( { left: "378px" } );
		return false;
	})
	
	/* *** Pricing Tables *** */
	$(".chart table td, .chart table th, .big-chart table td, .big-chart table th").nthCol(1).addClass("amount");
	$(".chart table td, .chart table th, .big-chart table:not('#basics-table') td, .big-chart table:not('#basics-table') th").nthCol(2).addClass("highlight");
	$(".big-chart table#basics-table td, .big-chart table#basics-table th").nthCol(3).addClass("highlight");
	$(".chart table td:eq(26), .big-chart td:eq(26), .big-chart td:eq(57), .big-chart td:eq(86), .big-chart td:eq(116), .big-chart td:eq(146), .big-chart td:eq(176), .big-chart td:eq(206), .big-chart td:eq(236)").css({ 'padding-bottom' : '5px', 'border-bottom' : '1px solid #e0f2f5' });
	$(".chart table th, .chart table td").nthCol(3).css({ 'padding-left' : '20px' });
	$(".chart table th, .chart table td, .big-chart table th, .big-chart table td").nthCol(5).css({ 'padding-right' : '0px' });
	$(".big-chart table tr:even").css({ 'background-color' : '#f8fbfc' });
	$(".big-chart table tr:nth-child(2) td").css({ 'padding-top' : '8px' });
	
	/* *** Fancyzoom *** */
	$("li.extras a, .examples a, .prices h4 a").fancybox();
	
	/* *** Example Cards *** */
	$(".examples a").hover(function(){
		$(this).stop(true, true);
    	$(this).children().animate( { left: "3px", opacity: 0.8 }, 100);
	},
	function(){
		$(this).children().animate( { left: "0px", opacity: 1.0 }, 100);
	});
	
	/* *** Artwork Dropdown *** */
	$("ol li.artwork").click(function(){
		$("#dropit").slideToggle("fast");
		return false;
	});
			
});