

var setactive = function(nr){
    $(".fase").removeClass("active");
    $(".fase").removeClass("inactive");
    $(".fase").removeClass("done");
    for(i = 1; i <= 5; i++){
        if(i < nr){
            $("#fase" + i).addClass("done");
        } else if(i == nr){
            $("#fase" + i).addClass("active");
        } else {
            $("#fase" + i).addClass("inactive");
        }
    }
}

var updateProces = function(){
    $("#afrekenProcesAdres").find("address").html(
        $("#stap2a #voornaam").val() + " " + $("#stap2a #achternaam").val() + "<br />" +
        $("#stap2a #adres").val() + " " + "<br />" +
        $("#stap2a #postcode").val() + " " + $("#stap2a #city").val() + "<br />" +
        $("#stap2a #telefoon").val() + " " + "<br />" +
        $("#stap2a #email").val() + " " 
        );
}

$("div#winkelWagenDropper").bind("mouseover", function(){
    $("div#navContentCartDrop").show();
});

$("div#winkelWagenDropper").bind("mouseout", function(){
    $("div#navContentCartDrop").hide();
});

$("#naarStap1").bind("click", function(){
    $("ul#checkoutStappen li").hide();
    $("ul#checkoutStappen li#stap1").show();        
    setactive(1);  
    updateProces();  
    return false;
});

$("#naarStap2").bind("click", function(){
    if ($("#loginguest").is(':checked')) {
        $("ul#checkoutStappen li").hide();
        $("ul#checkoutStappen li#stap2a").show();
        setactive(2);
    } else if ($("#loginregister").is(':checked')) {
        $("ul#checkoutStappen li").hide();
        $("ul#checkoutStappen li#stap2b").show();        
        setactive(2);
    } else {
        alert('U dient een keuze te maken (Registreer/ gast)');
    }
    
    return false; 
});

$("#naarStap3").bind("click", function(){
    if ($("#use_for_shipping_yes").is(':checked')) {
        $("ul#checkoutStappen li").hide();
        $("ul#checkoutStappen li#stap4").show();
        setactive(4);
    } else if ($("#use_for_shipping_no").is(':checked')) {
        $("ul#checkoutStappen li").hide();
        $("ul#checkoutStappen li#stap3").show();        
        setactive(3);
    } else {
        alert('U dient een keuze te maken voor bezorgadres');
    }
    
    return false; 
});
