$(document).ready(function() {
	$('#nav > ol li').hover(
		function () {
			$(this).toggleClass('over');
			if ($(this).next().hasClass('press')) {
				$(this).next().toggleClass('ie6fix');
			}
		},
		function () {
			$(this).toggleClass('over');
			if ($(this).next().hasClass('press')) {
				$(this).next().toggleClass('ie6fix');
			}
		}
	);

	$('#scroll_me').jScrollPane({showArrows:true, scrollbarWidth: 11, arrowSize: 11});
});

function checkQuantity(quantity) {
    
    if (!quantity || isNaN(quantity) || parseInt(quantity) <= 0) {
        alert("Quantity must be a number greater than 0");
        $('qty').focus();
        return false;
        
    }
    
}

function popUp(URL) {

var centerWidth = (window.screen.width - 400) / 2;
var centerHeight = (window.screen.height - 350) / 2;

day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=350,left = " + centerWidth + ",top = " + centerHeight + "');");
}  

function setCardDiv() {
   
   if ($('#payment_method').val() == 'invoice')
        $('#card_information').hide();
    else
        $('#card_information').show();
}

function setInvoiceOnly() {
    
    if ($("#ship_date_pulldown").attr("selectedIndex") == 0) {
        //$('#card_information').show();
       $("#payment_method").prepend("<option value='credit'>Credit Card</option>");
    }
    else {
        $('#card_information').hide();
        $("#payment_method option[value='credit']").remove();
    }
    
    
}

function initalizePaymentForms() {
    
    if ($("#ship_date_pulldown").attr("selectedIndex") != 0) {
       $('#card_information').hide();
        $("#payment_method option[value='credit']").remove();
    }
    
    if ($('#payment_method').val() == 'invoice') {
        $('#card_information').hide();
        
    }
}

function toggleTerms() {
    if ($("#shipping_pulldown").val() == 'usps_0')
        $("#terms").show();
    else
        $("#terms").hide();
}