/*
* 	GARAGEDOOR MENU 
* 	A Javascript jQuery script by Gaya Kessler
* 	Version 1.0
* 	Date: 08-04-09
* 
*/

var GarageDoorMenu = {

    scrollYMenu: 0,
    scrollXMenu: 0,

    setBindingsMenu: function (id) {

        $("#" + id + " .mouseMenu").each(function (i) {
            $(this).bind("mouseenter", function (e) {
                GarageDoorMenu.hideMenu(this);
            });
            $(this).bind("mouseleave", function (e) {
                GarageDoorMenu.showMenu(this);
            });

            $(this).bind("click", function (e) {
                window.location = this.parentNode.id;
            });
        });
    },

    hideMenu: function (obj) {
        var xsMenu = GarageDoorMenu.scrollXMenu;
        var ysMenu = GarageDoorMenu.scrollYMenu;

        $(obj).parent().find(".overlayMenu").each(function (i) {
            $(this).stop().animate({
                marginLeft: (ysMenu + 80) + "px"
            }, 200);
        });
        $(obj).parent().find(".overlayMenu2").each(function (i) {
            $(this).stop().animate({
                marginLeft: (ysMenu + 80) + "px"
            }, 200);
        });
    },

    showMenu: function (obj) {
        $(obj).parent().find(".overlayMenu").each(function (i) {
            $(this).stop().animate({
                marginLeft: "0px"
            }, 500);
        });
        $(obj).parent().find(".overlayMenu2").each(function (i) {
            $(this).stop().animate({
                marginLeft: "0px"
            }, 500);
        });
    }
}
