$(document).ready(function()
 {
    // toggles the slickbox on clicking the noted link
    $('a.slick-toggle').click(function()
    {
        /*   $(this).parent().parent().siblings().children().children('.slickbox').hide('slow');
*/
        $(this).next('.slickbox').toggle(400);
        return false;
    });
    $('body').click(function()
    {
        $('.slickbox').hide('slow');
    });
    $('.slickbox').click(function(event)
    {
        event.stopPropagation();
    });
});
// FILLING SHIPPING ADDRESS WITH BILLING INFO
$(document).ready(function()
 {
    //when the checkbox is checked or unchecked
    $('#same').click(function()
    {
        // If checked
        if ($("#same").is(":checked"))
        {
            //for each input field
            $('.billingAddress input', ':visible', document.body).each(function(i)
            {
                //copy the values from the billing_fields inputs
                //to the equiv inputs on the shipping_fields
                $(this).val($('.shippingAddress input').eq(i).val());
            });
        }
        else
        {

            //for each input field
            $('.billingAddress input', ':visible', document.body).each(function(i)
            {
                //set shipping_fields inputs to blank
                $(this).val("");
            });
        }
    });
});
$(document).ready(function()
 {
    $('a.expand').click(function()
    {
        $(this).hide();
        $(this).next('.expansion').show();
        return false;
    });
    $('a.less').click(function()
    {
        $(this).parent().parent().children('a.expand').show();
        $(this).parent().hide();
        $(this).previous('a.expand').show();
    });
});
$(document).ready(function()
 {
    $("#paymentSelector").change(function()
    {
        var paySet = $("#paymentSelector").val();
        $('fieldset.paymentMethod').hide('normal');
        $('fieldset.' + paySet).show('normal');
    });
    $('.ba').click(function()
    {
        });
});
// Feedback for email subscribe submit
$(document).ready(function()
 {
    $("#subscription button").click(function()
    {
        $("#subscription form").hide();
        $("#subscription p").hide();
        $("#subscription ul").show();
        return (false);
    });
});
// Toggle of Shipping address depending on whether shipping to billing address
$(document).ready(function()
 {
    $("input").attr('name', 'sameas').change(function()
    {
        $("fieldset#shippingAddress").toggle();
    });
});
// Input text field watermark
$(document).ready(function()
 {
    $('input[title]').each(function()
    {
        if ($(this).val() === '')
        {
            $(this).val($(this).attr('title'));
        }
        $(this).focus(function()
        {
            if ($(this).val() === $(this).attr('title'))
            {
                $(this).val('').addClass('focused');
            }
        });
        $(this).blur(function()
        {
            if ($(this).val() === '')
            {
                $(this).val($(this).attr('title')).removeClass('focused');
            }
        });
    });
});
$(document).ready(function()
 {
    $(".addToCart").click(function()
    {
        $("ul.eNav").animate({
            backgroundColor: "#fffa0c"
        },
        1000)
        .animate({
            backgroundColor: "#fff"
        },
        1000);
        $("#miniCart").slideDown("slow");
        return (false);
    });
    $("a#cartLink").click(function()
    {
        $("#miniCart").slideToggle("slow");
        return (false);
    });
    $("a#close").click(function()
    {
        $("#miniCart").slideUp("slow");
    });
    $("body").click(function()
    {
        $("#miniCart").slideUp("slow");
    });
    $("#miniCart").click(function(event)
    {
        event.stopPropagation();
    });
});

