$(document).ready(function() {
	$('#product-wrap div:not(#benefits-area)').hide();
	$('#country').hide();
	$('#product-tabs li a').click(function(){
		$('#product-tabs li').removeClass('tab-on').addClass('tab-off');
		$(this).parent().removeClass('tab-off').addClass('tab-on');
		$("#product-wrap").children('div').hide();
		var clicked = "#" + $(this).parent().attr('id') + "-area";
		$(clicked).fadeIn();
	});
	$("#reviews").click(function(){
		$("#reviews-area div").show();
	});
	var clicked = 0;
	$('#countryContainer, #close').click(function() {
		if (clicked == 0){
			$('#country').slideDown('fast');
			clicked = 1;
		} else {
			$('#country').slideUp('fast');
			clicked = 0;
		}
	});
	$("#products-cart input").change(function() {
		var numOnly = new RegExp(/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/);
		var currentVal = this.value;
		if(!currentVal.match(numOnly)){
			this.value = 0;
		}
	});
	$("div.item-feat .boxed .checkbox").click(function(){
		if($("input:checked").length > 6){
			$(".boxed").css("background","#E0E0E0 none repeat scroll 0 0");
			$(".boxed a").css({color: "#494949", textDecoration: "none"});
			alert("Please select 6 or fewer products to compare.");
		} else if ($("input:checked").length > 1){
			$(".boxed").css("background","#FFFFAA none repeat scroll 0 0");
			$(".boxed a").css({color: "#000000", textDecoration: "underline"});
		} else {
			$(".boxed").css("background","#E0E0E0 none repeat scroll 0 0");
			$(".boxed a").css({color: "#494949", textDecoration: "none"});
		}
	});
	
});
