//<![CDATA[
(function($)
{

$(document).ready(function()
{
    $("div.shopping-cart-wrapper").slideToggle(500);
    $("#tabs").tabs();
    $("div.cart").click(function(){
        $("div.shopping-cart-wrapper").slideToggle(500);
    });
$(".wpsc_top_level_categories > li:has(ul)").prepend("<span class=\"CatExpander\">[+]</span>");
$("div.footer_catgories ul.wpsc_top_level_categories li span").remove();
$("div.footer_catgories ul.wpsc_second_level_categories").removeClass("wpsc_second_level_categories");
$(".CatExpander").click(function()
{

if($(this).html()=='[+]')
    $(this).html('[-]');
else
    $(this).html('[+]');

$(this).toggleClass("CatExpanded").siblings("ul").slideToggle(500);
return false;
}).eq(0).addClass("CatExpanded").end().slice(1).siblings("ul").hide();

$('input#user_email').change(function(){
    $('#wpsc_checkout_form_9').val($(this).val());
});
$('.wpsc_email_address').hide();

$("div#progress-step-1").show();
$("div#progress-step-2").hide();
$("div#progress-step-3").hide();


    $("img#register-new, img#guest-checkout").click(function(){
        $("div#progress-step-2a").hide();
        $("div#progress-step-2b").show();
        $("div#progress-step-2c").hide();
    });

    $("img#step2back2b").click(function(){
        $("div#progress-step-2a").show();
        $("div#progress-step-2b").hide();
        $("div#progress-step-2c").hide();
    });
    $("img#step2back2c").click(function(){
        $("div#progress-step-2a").show();
        $("div#progress-step-2b").hide();
        $("div#progress-step-2c").hide();
    });
    $("img#step2back").click(function(){
        $("div#progress-step-1").show();
        $("div#progress-step-2").hide();
        $("div#progress-step-3").hide();
    });
    
    /*$("img#continue2step3").click(function(){
        $('#img1').attr('src',$('#img1').attr('inasrc'));
        $('#img2').attr('src',$('#img2').attr('inasrc'));
        $('#img3').attr('src',$('#img3').attr('asrc'));
        
        $("div#progress-step-1").hide();
        $("div#progress-step-2").hide();
        $("div#progress-step-2a").hide();
        $("div#progress-step-2b").hide();
        $("div#progress-step-2c").hide();
        $("div#progress-step-3").show();
    });*/

    $("img#continue2step2").click(function(){
        $('#img1').attr('src',$('#img1').attr('inasrc'));
        $('#img2').attr('src',$('#img2').attr('asrc'));
        $('#img3').attr('src',$('#img3').attr('inasrc'));


        $("div#progress-step-1").hide();
        $("div#progress-step-2").show();
        $("div#progress-step-2a").show();
        $("div#progress-step-2b").hide();
        $("div#progress-step-2c").hide();
        $("div#progress-step-3").hide();
    });

    $("img.progressbar").click(function(){
        
        if( $(this).attr('alt')=="1")
            {

                $('#img1').attr('src',$('#img1').attr('asrc'));
                $('#img2').attr('src',$('#img2').attr('inasrc'));
                $('#img3').attr('src',$('#img3').attr('inasrc'));


                $("div#progress-step-1").show();
                $("div#progress-step-2").hide();
                $("div#progress-step-3").hide();

            }
        if( $(this).attr('alt')=="2")
            {

                $('#img1').attr('src',$('#img1').attr('inasrc'));
                $('#img2').attr('src',$('#img2').attr('asrc'));
                $('#img3').attr('src',$('#img3').attr('inasrc'));


                $("div#progress-step-1").hide();
                $("div#progress-step-2").show();
                $("div#progress-step-2a").show();
                $("div#progress-step-2b").hide();
                $("div#progress-step-2c").hide();
                $("div#progress-step-3").hide();
            }
        /*if( $(this).attr('alt')=="3")
            {

                $('#img1').attr('src',$('#img1').attr('inasrc'));
                $('#img2').attr('src',$('#img2').attr('inasrc'));
                $('#img3').attr('src',$('#img3').attr('asrc'));


                $("div#progress-step-1").hide();
                $("div#progress-step-2").hide();
                $("div#progress-step-3").show();
            }*/
    });

var redurl = $('div.wpsc_registration_form input[name="redirect_to"]').attr('value');
if(redurl){$('div.wpsc_registration_form input[name="redirect_to"]').attr('value',redurl+"/shop/checkout/?tab=1");}
var tabs = getUrlVars()["tab"];
if(tabs){
    if(tabs=="1"){
                $('#img1').attr('src',$('#img1').attr('inasrc'));
                $('#img2').attr('src',$('#img2').attr('asrc'));
                $('#img3').attr('src',$('#img3').attr('inasrc'));


                $("div#progress-step-1").hide();
                $("div#progress-step-2").show();
                $("div#progress-step-2a").show();
                $("div#progress-step-2b").hide();
                $("div#progress-step-2c").hide();
                $("div#progress-step-3").hide();
    }
    if(tabs=="2"){
                $('#img1').attr('src',$('#img1').attr('inasrc'));
                $('#img2').attr('src',$('#img2').attr('asrc'));
                $('#img3').attr('src',$('#img3').attr('inasrc'));


                $("div#progress-step-1").hide();
                $("div#progress-step-2").show();
                $("div#progress-step-2a").hide();
                $("div#progress-step-2b").show();
                $("div#progress-step-2c").hide();
                $("div#progress-step-3").hide();
    }
}

});


})(jQuery);

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}
//]]>



