﻿function loadS() {
    $(document).ready(function() {
        $("#showcase").show();
    });
    $(document).ready(function() {
        $("#showcase").awShowcase({ content_width: 766, content_height: 265, fit_to_parent: !1, auto: !0, interval: 5E3, continuous: !0, loading: !0, tooltip_width: 200, tooltip_icon_width: 32, tooltip_icon_height: 32, tooltip_offsetx: 18, tooltip_offsety: 0, arrows: !1, buttons: !1, btn_numbers: !1, keybord_keys: !1, mousetrace: !1, pauseonover: !0, stoponclick: !1, transition: "vslide", transition_delay: 3E3, transition_speed: 300, show_caption: "onhover", thumbnails: !0, thumbnails_position: "outside-first", thumbnails_direction: "vertical",
            thumbnails_slidex: 1, dynamic_height: !1, speed_change: !0, viewline: !1
        })
    })
}
function loadInside() {

    $(document).ready(function() {
        $("a[target='lightbox']").colorbox({ transition: "elastic", speed: 350, photo: "true", rel: "nofollow", scalePhotos: !1, opacity: 0.4, initialWidth: "200px", initialHeight: "200px", width: "700px", height: "700px", closeDuration: 500, closeDurationBox: 200, posLeft: -1, current: "slika {current} od {total}", posTop: -1, rel: "gallery", returnFocus: !1, close: "" });
        $("a[rel='gallery']").colorbox({ transition: "elastic", speed: 350, photo: "true", rel: "nofollow", scalePhotos: !1, opacity: 0.4, initialWidth: "200px", initialHeight: "200px", width: "700px", height: "700px", closeDuration: 500, closeDurationBox: 200, posLeft: -1, current: "slika {current} od {total}", posTop: -1, rel: "gallery", returnFocus: !1, close: "" });

        $("#mycarousel").show();
        jQuery("#mycarousel").jcarousel({ vertical: !0, scroll: 2 })
    });
}

function inform() {

    //$.blockUI({ message: $('#divToBasket') });

    $.blockUI({
        message: $('#divToBasket'),
        fadeIn: 100,
        title: 'Dodajanje v košarico',
        fadeOut: 200,
        //timeout: 3000,
        showOverlay: true,
        centerY: true,
        theme: true,
        centerX: true

    });

}


function informFilter() {
    $.growlUI('Filtriranje', 'Trenutek...');
}

function loadPictures() {

 $(document).ready(function() {
    $("a[rel='gallery']").colorbox({ transition: "elastic", speed: 350, photo: "true", rel: "nofollow", scalePhotos: !1, opacity: 0.4, initialWidth: "200px", initialHeight: "200px", width: "500px", height: "500px", closeDuration: 500, closeDurationBox: 200, posLeft: -1, current: "slika {current} od {total}", posTop: -1, rel: "gallery", returnFocus: !1, close: "" })
 });
}
function resetSearch1() {
    $("#profile").val("");
    $("#type").val("");
    $("#quicksearch").val("");
    $("#manufacturer2").val("0")
}
function checkAA() {
    $("#type2").val() == "" && GetDimensions(3, "#searchTiresWidth");
    $("#type2").val() == "P" && GetDimensions(16, "#searchTiresWidth");
    $("#type2").val() == "C" && GetDimensions(20, "#searchTiresWidth");
    $("#type2").val() == "M" && GetDimensions(24, "#searchTiresWidth");
    $("#type2").val() == "T" && GetDimensions(28, "#searchTiresWidth");
    $("#type2").val() == "" && GetDimensions(6, "#searchTiresHeight");
    $("#type2").val() == "P" && GetDimensions(17, "#searchTiresHeight");
    $("#type2").val() == "C" && GetDimensions(21, "#searchTiresHeight");
    $("#type2").val() == "M" && GetDimensions(25, "#searchTiresHeight");
    $("#type2").val() == "T" && GetDimensions(29, "#searchTiresHeight");
    $("#type2").val() == "" && GetDimensions(7, "#searchTiresDiameter");
    $("#type2").val() == "P" && GetDimensions(18, "#searchTiresDiameter");
    $("#type2").val() == "C" && GetDimensions(22, "#searchTiresDiameter");
    $("#type2").val() == "M" && GetDimensions(26, "#searchTiresDiameter");
    $("#type2").val() == "T" && GetDimensions(30, "#searchTiresDiameter")
}
function check() {
    if ($('#searchRimsWidth').val() == 'REPLIKA')
        $('#searchRimsHeight').show();
    else
        $('#searchRimsHeight').hide();
}
function compare() {
    if ($.cookie('compares') == null || $.cookie('compares') == '' || $.cookie('compares') == ' ') {
        alert("Za primerjavo nimate izbranega nobenega artikla.");
    }
    else

        document.location = "/compare.aspx?ids=" + $.cookie('compares');
}
function compare2() {


    document.location = "/compare.aspx?ids=" + $.cookie('compares');
}


function addCompare(pID) {
    var gag = "";
    gag = pID;
    var col_array = new Array();

    if ($.cookie('compares') == null)
        $.cookie('compares', ' ');
    if ($.cookie('compares') != null) {
        if ($.cookie('compares').indexOf(gag) == -1) {



            $.growlUI('Primerjava artiklov', 'Artikel ste uspešno dodali na seznam!');
            gag = $.cookie('compares') + gag + ",";
            $.cookie('compares', gag, { expires: 360 });

        }
        else {
            $.growlUI('Primerjava artiklov', 'Artikel ste uspešno odstranili iz seznama!');
            gag = $.cookie('compares').replace(pID + ',', '');
            $.cookie('compares', gag, { expires: 360 });

        }
        col_array = $.cookie('compares').split(",");
    }


    //$('#cArticles').fadeOut(100);
    //$('#cArticles').fadeIn(100);
    //$('#compareButton').html($.cookie('compares'));
    //$('#compareButtonA').html('Artikel dodan.');


}


function clearSelection() {
    $("input:checked[rel='comparer']").each(function() { this.checked = false; });
}
function checkCompare() {
    if ($.cookie('compares') == null || $.cookie('compares') == '' || $.cookie('compares') == ' ') {
    }
    else {

        var col_array = $.cookie('compares').split(",");


        jQuery.each(col_array, function() {
            if (this != '')
                $("#" + this).prop("checked", true);

        });




    }
}


function resetSearch2() {
    $("#profile2").val("");
    $("#type2").val("");
    $("#searchTiresWidth").val("");
    $("#searchTiresHeight").val("");
    $("#searchTiresDiameter").val("");
    $("#manufacturer").val("0")
}
function GetDimensions(a, b) {
    $.ajax({ type: "POST", url: "x-bf.getDimensions.xml.config.aspx?sID=" + a, data: "", contentType: "application/x-www-form-urlencoded; charset=utf-8", dataType: "html", success: function(a) {
        $(b).html(a)
    }, error: function() {
    }
    })
}
;


function addH() {

    var gag = "";
    gag = $('#searchTiresWidth').val() + '/' + $('#searchTiresHeight').val() + ' ' + $('#searchTiresDiameter').val();

    if ($('#searchTiresWidth').val() != '' && $('#searchTiresHeight').val() != '' && $('#searchTiresDiameter').val() != '') {


        gag = "<a href=\"s-10-iskalnik-pnevmatik.aspx?searchtireswidth=" + $('#searchTiresWidth').val() + "&searchtiresheight=" + $('#searchTiresHeight').val() + "&searchtiresdiameter=" + $('#searchTiresDiameter').val() + "&stock2=on\">" + $('#searchTiresWidth').val() + "/" + $('#searchTiresHeight').val() + " " + $('#searchTiresDiameter').val() + "</a>";
        if ($.cookie('lastSearch') == null)
            $.cookie('lastSearch', ' ');
        if ($.cookie('lastSearch') != null)
            if ($.cookie('lastSearch').indexOf(gag) == -1) {

            gag = $.cookie('lastSearch') + gag + "</br>";
            $.cookie('lastSearch', gag, { expires: 360 });
        }
    }

}

function clearHistory(cook, cont) {
    $('#dialog-close').dialog({ height: 170, modal: true, draggable: false, resizable: false,
        buttons: [
{
    text: "Da",
    click: function() { $.cookie(cook, ''); clearSelection(); $('#' + cont).text(''); $(this).dialog("close"); return false; }
},
{
    text: "Ne",
    click: function() { $(this).dialog("close"); return false; }
}
]
    });
}
