﻿var _hoverColour = "rgb(0,130,214)";
var _baseColor = "#15444E";

$(document).ready(function() {
    $(function() {
        $("a.hoverBtn").show("fast", function() {
            $(this).wrap("<div class=\"hoverBtn\">");
            $(this).attr("class", "");
        });

        //display the hover div
        $("div.hoverBtn").show("fast", function() {
            //append the background div
            $(this).append("<div></div>");

            //get link's size
            var wid = $(this).children("a").width();
            var hei = $(this).children("a").height();

            //set div's size
            $(this).width(wid);
            $(this).height(hei);
            $(this).children("div").width(wid);
            $(this).children("div").height(hei);

            $("#contenitore").hover(function() {
               
                //fade in the background
                $("div.hoverBtn div")
				.stop()
				.css({ "display": "none", "opacity": "1" })
				.fadeIn("fast");
               
                //fade the colour
                $("div.hoverBtn a")
                .stop()
				.animate({ "color": _hoverColour }, 350);
            }, function() {
              
                //fade out the background
                $("div.hoverBtn div")
				.stop()
				.fadeOut("slow");
               
                //fade the colour
                $("div.hoverBtn a")
                .stop()
				.animate({ "color": _baseColor }, 250);
            });

        });
    });
});

$(document).ready(function() {
    $("#contenitore").bind("mouseenter", function() {
        $(".sottomenu li a").css("color", "#91d2ff");

    });
    $("#contenitore").bind("mouseleave", function() {
        $(".sottomenu li a").css("color", "#15444e");

    });

});

//$(document).ready(function() {
//$("#contenitore").bind("mouseenter", function() {
///*        $(".sezioniprincipali").animate({ color: "rgb(0,130,214)" }, 350);*/
//        $(".sottomenu li a").animate({ color: "rgb(145,210,255)" }, 350);
//    });

//    $("#contenitore").bind("mouseleave", function() {
//        /*$(".sezioniprincipali").animate({ color: "rgb(21,68,78)" }, 350);*/
//        $(".sottomenu li a").animate({ color: "rgb(21,68,78)" }, 350);
//    });
//});
