$(document).ready(function(){

    // pretty Photo initialization
    $("a[rel^='prettyPhoto']").prettyPhoto({
        animationSpeed: 'normal', /* fast/slow/normal */
        padding: 40, /* padding for each side of the picture */
        opacity: 0.35, /* Value betwee 0 and 1 */
        showTitle: false, /* true/false */
        allowresize: true, /* true/false */
        counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
        theme: 'facebook', /* light_rounded / dark_rounded / light_square / dark_square */
        hideflash: true,
        wmode: 'opaque'
    });

    //

    $("input.count-field").focus(function() {
        $(this).val('')
    });

    $("input.count-field").blur(function() {
        if($(this).val() == '' || isNaN($(this).val()) || $(this).val()%1 != 0) {
            $(this).val('1');
        }
    });
});

// basket product items count change
function SendAction(product, type) {

    $("#orderForm input#product").val(product);
    $("#orderForm input#action").val(type);

    //alert("Product: " + $("#orderForm input#product").val() + ", " + $("#orderForm input#action").val());

    $("#orderForm").submit();

    return false;
}

function ChangeTransportType() {
    $("#orderForm input#action").val('changeTransport');

    $("#orderForm").submit();

    return false;
}

function AddToBasket(id) {
    $("form#form_polozka_"+id).submit();

    return false;
}
