﻿$(document).ready(function() {

    // slider

    $(".slider-submit").click(function() {
        var container = $(this).attr("rel");
        $(container).slideToggle();
    });
    $(".slider-container").hide();

    // jumpmenu

    $(".jumpmenu").change(function() {
        window.location = $(this).val(); o
    });

    $("#gn-firstGroups > li:has('div')").hoverIntent(secondGroups);
    $(".gn-secondGroups > ul > li:has('div')").hoverIntent(thirdGroups).find("a:first").append(' <img src="/shop/App_Themes/image/icon/gn-arrows.png">');

    $(".btn-addCar").click(function() {
        activate();
    });

    $(".gn-tab-car").click(function() {
        $(".gn-tab-active").removeClass("gn-tab-active");
        $(this).parent().addClass("gn-tab-active");
    });

    $(".gn-btn-delete").click(function() {
        $(this).parent().fadeOut(500);
        $(this).parent().parent().find("li:first").addClass("gn-tab-active");
    });

});

    // Navigation

    var secondGroups = {
        sensitivity: 8, // number = sensitivity threshold (must be 1 or higher)    
        interval: 70, // number = milliseconds for onMouseOver polling interval
        over: showSecondGroups, // function = onMouseOver callback (REQUIRED)    
        timeout: 70, // number = milliseconds delay before onMouseOut
        out: hideScondGroups // function = onMouseOut callback (REQUIRED)
    };

    var thirdGroups = {
        sensitivity: 8, // number = sensitivity threshold (must be 1 or higher)    
        interval: 80, // number = milliseconds for onMouseOver polling interval
        over: showThirdGroups, // function = onMouseOver callback (REQUIRED)    
        timeout: 600, // number = milliseconds delay before onMouseOut
        out: hideThirdGroups // function = onMouseOut callback (REQUIRED)    
    };

    function showSecondGroups() {
        $(this).addClass("gn-firstGroups-active").find(".gn-secondGroups").show();
        $("#breadcrumb").css("z-index", "1");
    }

    function hideScondGroups() {
        $(this).removeClass("gn-firstGroups-active").find(".gn-secondGroups").hide();
        $("#breadcrumb").css("z-index", "51");
    }

    function showThirdGroups() {
        if ($(this).find("a:first").width() >= 185) { width = "200"; } else { width = $(this).find("a:first").width()+ 15 }
        $(".gn-secondGroups-active").addClass("gn-thirdGroupTitle").removeClass("gn-secondGroups-active").find(".gn-thirdGroups").hide();
        $(this).removeClass("gn-thirdGroupTitle").addClass("gn-secondGroups-active").find(".gn-thirdGroups").css("left", width).show();
        $(this).css("position", "relative");
       // alert(width);
    }

    function hideThirdGroups() {
        $(this).addClass("gn-thirdGroupTitle").removeClass("gn-secondGroups-active").find(".gn-thirdGroups").hide();
        $(this).css("position", "static");
    }


    // Carfilter

    function activateCarSelection() {
        $("#groupNavigation").addClass("gn-active");
    }

    function deactivateCarSelection() {
        $("#groupNavigation").removeClass("gn-active");
    }

    // PopUp

    function WinOpen(file, winname, w, h, scroll) {
        var clientX;
        clientX = screen.width;
        var clientY;
        clientY = screen.height;
        var posX;
        posX = (clientX - w) / 2;
        var posY;
        posY = (clientY - h) / 2;
        var MyWin;
        var winprops;
        winprops = "top=" + posY + ", left=" + posX + ", height=" + h + ", width=" + w + ",menubar=yes,scrollbars=" + scroll + ",resizable=no,dependent=yes";
        MyWin = window.open(file, winname, winprops);
        MyWin.focus();
    }

