jQuery(document).ready(function() {
   
        
    if (jQuery('.autoclear').length) {
        jQuery(".autoclear").attr().focus(function(){
             
                var initial_values = ["enter email", "zip code"];
            
                if(jQuery.inArray(jQuery(this).val(), initial_values) != -1){
                   jQuery(this).val("");
                }
                
                
                
           });
    }
    
    
});


function checkCVV2() {
   
    
    
    if (jQuery("#cvv2").val() == "" && !jQuery('#gift_card').attr('checked')) {
        alert ("You must enter the 3 or 4 digit CVV2 security code located on your credit card before proceeding.");
        jQuery("#cvv2").focus();
        return false;
    }
    return true;
}

function toggleBillingForm(value) {
    
    if (value) 
        jQuery("input[name*='new_shipping']").attr("disabled", "disabled");
    else
        jQuery("input[name*='new_shipping']").removeAttr("disabled");
    
    
}

function guestLogin() {
    
    var sPath = window.location.pathname;
    var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);

    window.location = sPage + '?proceed_as_guest=1';
    
}

function balanceWindow(balance) {
    window.open('http://www.skyniceland.com/_inc/gift_card_balance.inc.php?balance=' + balance, 'balance', 'height=250;width=250');
    
}