﻿///<reference path="jquery-1.2.6-vsdoc.js"/>
///<reference path="jquery.UI\ui\ui.core.js"/>
///<reference path="jquery.UI\ui\ui.draggable.js"/>
var showBox = function() { };

$(document).ready(function() {


    //menu
    $('#menuBar li a').hover(function() {
        $(this).stop(true, true);
        $(this).animate({ 'color': '#f6f6f6' }, 300, "swing", function() { });

    },
    function() {
        $(this).animate({ 'color': '#919191' }, 800, "swing", function() { }); //;
    });


    $("#menuBar li.topmenu").hover(function() {
        $(this).find("ul").stop(true, true);
        $(this).find("ul").css("width", $(this).width()).fadeIn(300, function() { });
    },
    function() {
        $(this).find("ul").fadeOut(300, function() { });
    });

    //********************************************************
    //slideshow!
    //********************************************************
    //    var currentIndex = 0;
    //    var imgElements = $("#slideshow img");
    //    var cycle = function() {
    //        $(imgElements[currentIndex]).fadeOut("slow", function() {
    //            currentIndex++;
    //            if (currentIndex >= imgElements.length)
    //                currentIndex = 0;
    //            $(imgElements[currentIndex]).fadeIn("slow", function() {
    //                setTimeout(cycle, 5000);
    //            });
    //        });
    //    };

    //    cycle();

    //********************************************************
    //za povecanje slikice, ko das misko cez
    //********************************************************
    //    $(".grid img").mouseover(function(el, a) {
    //        var originalImage = $(this);
    //        var cloneImage = $(this).clone(false);
    //        //css("display", "none").
    //        cloneImage.appendTo(this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode).
    //                css("position", "absolute").
    //                css("width", 90).
    //                css('top', $(this).position().top - parseInt(cloneImage.height() / 3) + "px").
    //                css('left', $(this).position().left - parseInt(cloneImage.width() / 2) + "px").
    //                css('border', 'solid 1px black').
    //                fadeIn(400, function() { }).mouseout(function() {
    //                    $(this).fadeOut(300, function(el) {
    //                        $(this).remove()
    //                    })
    //                }); //mouse out
    //        var ax = 0;
    //    }); //mouseover

    //********************************************************
    //IE6 fix - zaradi menuja
    //********************************************************
    try {
        document.execCommand("BackgroundImageCache", false, true);
    } catch (err) { }

    //********************************************************
    //pngFix
    //********************************************************
    $(document).pngFix();

    //********************************************************
    //za fade logotov
    //********************************************************
    $('div #footer li').fadeTo("fast", 0.5, function() { }).hover(
        function() {
            $(this).stop();
            $(this).fadeTo(300, 1, function() { });
        },
        function() {
            $(this).fadeTo(300, 0.5, function() { });
        });
    //********************************************************
    //default button
    //********************************************************

    $('.panel').keypress(function(e) {
        //alert(e.which);
        if (e.which == 13) {

            if ($(this).find(".defaultButton").get(0).click)
                $(this).find(".defaultButton").get(0).click();
            else
                window.location = $(this).find(".defaultButton").attr("href");
            return false;
        }
    });


    //********************************************************
    //za skrivanje/prikazovanje kategorij jaht na levi
    //********************************************************
    //    $('.plusMinus').hover(function(){
    //        $(this).toggleClass("plusMinusSelected");
    //    },function(){
    //        $(this).toggleClass("plusMinusSelected");
    //    }).each(function() { //skrije vse na zacetku
    //        if ($(document).getUrlParam("ManufacturerID") == $(this.parentNode).next("ul").attr("ManufacturerID")) //ce je parameter ManufacuterID isti potem pokazi
    //            $(this.parentNode).next("ul").show();
    //       else
    //            $(this).toggleClass("plusMinusActive"); }) //skrije vse dive
    //    .click(function() {
    //        $(this).toggleClass("plusMinusActive");
    //        $(this.parentNode).next("ul").slideToggle("fast", function() { });
    //    });

    showBox = function(img) {

        var fillDiv = $(document.createElement("div")).css({
            "height": $(window).height(),
            "width": $(window).width(),
            "left": "0px",
            "top": "0px",
            "position": "absolute",
            "z-index": "100",
            "background": "red"
        }).click(function() {
            $(this).remove();
        });

        fillDiv.append("<img src='" + img + "'></img>");

        $(document.body).append(fillDiv);

        newEl.show("slow", function() { });

    }

    /* rollover slikic za nove modele */
    $(".newModelImg").hover(function() {
        
        $(this).attr("src", $(this).attr("src").replace("mono", "color"));
    },
    function() {
        $(this).attr("src", $(this).attr("src").replace("color", "mono"));
    });

});