


// we want to be global
var navActive = 1;

$(document).ready(function() {


/*	$("#header #mainnav ul li ul li").mouseover(function() {
		$(this).parent().parent().css("background-image", "url(/themes/default/images/navtab.gif)");
	});

	$("#header #mainnav ul li ul li").mouseout(function() {
		$(this).parent().parent().css("background-image", "url(/themes/default/images/navtab-blue.gif)");

	});

	$("#header #mainnav ul li").mouseout(function() {
		$(this).css("background-image", "url(/themes/default/images/navtab.gif)");

	});

*/


	$("#paymentForm").each(function(){
		this.reset();
	});
	
	if ($("#paymentForm :input[name='bAcceptTerms']").is(":not(:checked)")) {
		$("#paymentForm :submit").attr('disabled',true).addClass('disabled');
	}
	$("#paymentForm :input[name='bAcceptTerms']").bind('change',function(){
		if ($(this).is(":checked")) {
			$("#paymentForm :submit").attr('disabled',false).removeClass('disabled');
		} else {
			$("#paymentForm :submit").attr('disabled',true).addClass('disabled');
		}
	});
	
	if ($("#paymentForm :input[name='bPayType']:checked").val()!='3') {
		$("#paymentForm .ccInfo").hide();
	}
	$("#paymentForm :input[name='bPayType']").bind('change',function(){
		if ($(this).val()=='3') {
			$("#paymentForm .ccInfo").slideDown(500);
		} else {
			$("#paymentForm .ccInfo").slideUp(500);
		}
	});


	// another fix for you know who
	$("div#banner div.txtBar ul li").hover(function(){
		$(this).addClass('ie6hover');
	},function(){
		$(this).removeClass('ie6hover');
	});
	

	$(".cartDisplay :input[name='quantity']").bind('keyup',function(){
		
		this.value = this.value.replace(/[^0-9\.]/g,'');
		if (this.value) {

			$("#paymentItems").addClass("loading");

			$.get("_customelements/_ajax/updateQuantity.php",{
			
				'nCartID':$(this).attr('nCartID'),
				'nQuantity':this.value
			
			},function(){
				
				$("table tbody","#paymentItems").load("_customelements/_ajax/getPaymentTableItems.php",function(e){

					$("#paymentItems").removeClass("loading");

				});
			});
		}
	
	}).trigger('keyup');

	$("a[href*=.pdf]").click(function(){
	window.open(this.href);
	return false;
	});


});

function goToSlide(num)
{
	$("#slides").children().fadeOut("slow");
	$("#slides div:nth-child("+num+")").fadeIn("slow");
	navActive = num;
	
}


