function bikesAnzeigen(sessionid, typ, id) {
    var bikestyle = $('#bikestyle').val();
    var biketype = $('#biketype').val();
    var usertype = $('#usertype').val();
    var male = $('#male').val();
    var female = $('#female').val();
    var price = $('#price').val();


    if (typ == "biketype") {
        $("#biketype").val(id);
        biketype = id;

        $(".bikelist li").css({'background' : 'none'});
        $(".bikelist li a").css({'color' : '#fff', 'background' : 'none'});

        $("#"+typ+"_"+id).css({'background': 'url(/app/webroot/img/transparent-brown-bg.png) repeat', 'text-decoration': 'none'});
        $("#"+typ+"_"+id+" a").css({'color': '#e0b955'});
    } else if (typ == "usertype") {
        $("#usertype").val(id);
        usertype = id;

        $(".typelist li").css({'background' : 'none'});
        $(".typelist li a").css({'color' : '#fff', 'background' : 'none'});

        $("#"+typ+"_"+id).css({'background': 'url(/app/webroot/img/transparent-brown-bg.png) repeat', 'text-decoration': 'none'});
        $("#"+typ+"_"+id+" a").css({'color': '#e0b955'});
    } else if (typ == "bikestyle") {
        $("#bikestyle").val(id);
        bikestyle = id;

        $(".styleslist li").css({'background' : 'none'});
        $(".styleslist li a").css({'color' : '#fff', 'background' : 'none'});

        $("#"+typ+"_"+id).css({'background': 'url(/app/webroot/img/transparent-brown-bg.png) repeat', 'text-decoration': 'none'});
        $("#"+typ+"_"+id+" a").css({'color': '#e0b955'});
    } else if (typ == "male") {
        $("#male").val(id);
        $("#female").val(0);
        male = 1;
        female = 0;
        id = 1;

        $("#female").css({'background': 'none', 'color' : '#fff'});
        $("#male").css({'color': '#e0b955', 'background': 'url(/app/webroot/img/transparent-brown-bg.png) repeat', 'text-decoration': 'none'});
    } else if (typ == "female") {
        $("#female").val(id);
        $("#male").val(0);
        female = 1;
        male = 0;
        id = 1;

        $("#male").css({'background': 'none', 'color' : '#fff'});
        $("#female").css({'color': '#e0b955', 'background': 'url(/app/webroot/img/transparent-brown-bg.png) repeat', 'text-decoration': 'none'});
    } else if (typ == "price") {
        var pricerange = $('#pricerange').val();
        $("#price").val(pricerange);
        price = pricerange;
        id = pricerange;
    }


    $.getJSON("/ajax_bikes/index/sessionid:"+sessionid+"/typ:"+typ+"/id:"+id+"/bikestyle:"+bikestyle+"/biketype:"+biketype+"/usertype:"+usertype+"/male:"+male+"/female:"+female+"/price:"+price,
         function(json){
            $('#produktcontainer').html(json.products);
            if (json.typ == 'price' && (json.neue_auswahl == 0 || json.neue_auswahl == null)) {
                $('#'+json.typ+'_selection').empty();
            } else {
                $('#'+json.typ+'_selection').html(json.neue_auswahl+'<br /><span><a onclick="loescheAuswahl(\''+json.typ+'\', \''+json.sessionid+'\')" class="reset">Reset</a></span>');
            }
         }
    );

}

function loescheAuswahl(typ, sessionid) {
    var bikestyle = $('#bikestyle').val();
    var biketype = $('#biketype').val();
    var usertype = $('#usertype').val();
    var male = $('#male').val();
    var female = $('#female').val();
    var price = $('#price').val();

    $('#'+typ+'_selection').empty();

    if (typ == "biketype") {
        $("#biketype").val(0);
        biketype = 0;

        $(".bikelist li").css({'background' : 'none'});
        $(".bikelist li a").css({'color' : '#fff', 'background' : 'none'});
    } else if (typ == "usertype") {
        $("#usertype").val(0);
        usertype = 0;

        $(".typelist li").css({'background' : 'none'});
        $(".typelist li a").css({'color' : '#fff', 'background' : 'none'});
    } else if (typ == "bikestyle") {
        $("#bikestyle").val(0);
        bikestyle = 0;

        $(".styleslist li").css({'background' : 'none'});
        $(".styleslist li a").css({'color' : '#fff', 'background' : 'none'});
    } else if (typ == "gender") {
        $("#male").val(0);
        $("#female").val(0);

        $("#male").css({'background': 'none', 'color' : '#fff'});
        $("#female").css({'background': 'none', 'color' : '#fff'});

        male = 0;
        female = 0;
    } else if (typ == "price") {
        $("#price").val(0);
        price = 0;

        $('#pricerange').val(0);
    }

    $.getJSON("/ajax_bikes/filterEntfernen/sessionid:"+sessionid+"/typ:"+typ+"/bikestyle:"+bikestyle+"/biketype:"+biketype+"/usertype:"+usertype+"/male:"+male+"/female:"+female+"/price:"+price,
         function(json){
            $('#produktcontainer').html(json.products);
         }
    );
}

function produktbildAnzeigen(count_productfoto, bildname) {
    $('#produktbild_'+count_productfoto).attr("src", '/app/webroot/dateien/standard/'+bildname);

}

function zumMerkzettelHinzufuegen(id, sessionid) {
    var productsize_id = 0;
    var productcolor_id = 0;
    var anzahl = 0;

    if ($('#productsize_'+id).val() != undefined) {
        productsize_id = $('#productsize_'+id).val();
    }

    if ($('#anzahl_'+id).val() != undefined) {
        anzahl = $('#anzahl_'+id).val();
    }

    window.location.href = "/wishlists/zumMerkzettelHinzufuegen/id:"+id+"/productsize_id:"+productsize_id+"/productcolor_id:"+productcolor_id+"/anzahl:"+anzahl+"/sessionid:"+sessionid;
         
}

 function hometextAusblenden() {
    $("#hometext").css({'display' : 'none'});
 }
