﻿
$(document).ready(function () {


    $('.nav li').hover(function () {
        $(this).find('a.menu').stop().animate({ opacity: "1" }, 200).css("z-index", "200");
    }, function () {
        $(this).find('a.menu').stop().animate({ opacity: "0" }, 500);
    })
    .click(function () {
        $(this).addClass("active");

        if ($(this).find('ul').hasClass('submenu') == true) {
            $('.lineopacity').animate({ height: "22px" }, 400);
            $(this).find('ul').delay(300).fadeIn();
        }
        $('.nav li').not(this).find('ul').fadeOut('fast');
        $('.nav li').not(this).removeClass("active");
    });



    var path = location.pathname;
    var home = "/";
    var homeExt = "/default.aspx";


    if (path == "/default.aspx" || path == "/Default.aspx" || path == "/") {
        $('#header').css("top", "-100px");
        $('#footer').css("bottom", "-35px");
        //player con autoload in home
        $(window).load(function () {
            $('#supersized').fadeTo(3000, 1);
            $('#supersized > img').fadeTo(3000, 1);
            $('#supersized > li > a').fadeTo(3000, 1);

            $("#jquery_jplayer_1").jPlayer({
                ready: function () {
                    $(this).jPlayer("setMedia", {
                        mp3: "sound/sound.mp3"
                    }).jPlayer("play");
                },
                loop: true,
                swfPath: "js",
                supplied: "mp3",
                wmode: "window"
            });
        });
    }
    else {
        //player senza autoload nelle altre pagine
        $(window).load(function () {
            $('#supersized').fadeTo(3000, 1);
            $('#supersized > img').fadeTo(3000, 1);
            $('#supersized > li > a').fadeTo(3000, 1);

            $("#jquery_jplayer_1").jPlayer({
                ready: function () {
                    $(this).jPlayer("setMedia", {
                        mp3: "sound/sound.mp3"
                    });
                },
                swfPath: "js",
                supplied: "mp3",
                wmode: "window"
            });
        });
    }

    $("a[href='" + path + "']").not("a[href='" + homeExt + "']").each(function () {
        $(this).parents().eq(1).prev().css("opacity", "1");
        if ($(this).next().hasClass('submenu') == true || $(this).parents().eq(1).hasClass('submenu') == true) {
            $('.lineopacity').animate({ height: "22px" }, 400);
        }
        $(this).parents().eq(1).delay(300).fadeIn();
        $(this).addClass("activeNav");
    });

    var a = path.indexOf('runway');
    if (a != -1) {
        $('.lineopacity').animate({ height: "22px" }, 400);
        $('.runway').delay(300).fadeIn();
        $('.runway').prev().css("opacity", "1");
    }


    if ($(".eshopInt").length || path == "/eshop.aspx") {
        $('.eshopsub').fadeIn();
    }


    $('.openNL').click(function () {
        $('.newsletter').slideDown();
    });
    $('.closeNL').click(function () {
        $('.newsletter').slideUp();
    });


    $("input[type=checkbox], select").uniform();



});
