﻿/// <reference path="jQuery.intellisense.js" />



function menuAction(action) {
    
    switch(action) {
        case "timeout":
            
            $("ul#menuHover").children("li").mouseover(function () {
                
                if (typeof(menuTimerIndex) != 'undefined') {
                    clearTimeout( menuTimerIndex );
                }
                
                $("ul#menuHover").find("div").css("display", "none");
                $("ul#menuHover").find("ul").css("display", "none");         
                
                $(this).find("div").css("display", "block");
                $(this).find("ul").css("display", "block");        

            });


            $("ul#menuHover").children("li").mouseout(function () {

                if($(this).attr("class") != "selected") {        
                    var self = this;
                    menuTimerIndex = setTimeout(function() {
                  
                        $(self).find("div").css("display", "none");
                        $(self).find("ul").css("display", "none");      
                               
                        $("ul#menuHover").children("li.selected").find("div").css("display", "block");
                        $("ul#menuHover").children("li.selected").find("ul").css("display", "block");                
                    }, 1000);
                }
                else {
                    var self = this;
                    menuTimerIndex = setTimeout(function() {
                    
                        $("ul#menuHover").find("div").css("display", "none");
                        $("ul#menuHover").find("ul").css("display", "none");             
                        
                        $(self).find("div").css("display", "block");
                        $(self).find("ul").css("display", "block");
                    }, 1000);
                }
            });
            break;
        case "click":
            
            $("ul#menuHover4L").find("div").css("display", "none");
            $("ul#menuHover4L").find("ul").css("display", "none");  
            
            $("ul#menuHover4L").children("li.selected").find("div").css("display", "block");                
            $("ul#menuHover4L").children("li.selected").find("ul").css("display", "block");                            

            $("ul#menuHover4L").children("li").children("a").attr("href", "javascript:void(0)");
        
            $("ul#menuHover4L").children("li").click(function () {

                $("ul#menuHover4L").children("li").children("a").css("color", "#FFFFFF");  
                $("ul#menuHover4L").children("li").removeClass("selected");           
                $(this).children("a").css("color", "#e2e65b");
                $(this).addClass("selected");
                $("ul#menuHover4L").find("div").css("display", "none");
                $("ul#menuHover4L").find("ul").css("display", "none");                  
                
                $(this).find("div").css("display", "block");
                $(this).find("ul").css("display", "block"); 
                
                $("ul#menuHover4L").children("li").mouseover(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });   
                $("ul#menuHover4L").children("li").mouseout(function() {
                
                    $(this).children("a").css("color", "#FFFFFF");
                });                       
                $("ul#menuHover4L").children("li.selected").mouseout(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });                

            });
            
            $("ul#menuHover5L").find("div").css("display", "none");
            $("ul#menuHover5L").find("ul").css("display", "none");  
            
            $("ul#menuHover5L").children("li.selected").find("div").css("display", "block");                
            $("ul#menuHover5L").children("li.selected").find("ul").css("display", "block");                            

            $("ul#menuHover5L").children("li").children("a").attr("href", "javascript:void(0)");
        
            $("ul#menuHover5L").children("li").click(function () {

                $("ul#menuHover5L").children("li").children("a").css("color", "#FFFFFF");  
                $("ul#menuHover5L").children("li").removeClass("selected");           
                $(this).children("a").css("color", "#e2e65b");
                $(this).addClass("selected");
                $("ul#menuHover5L").find("div").css("display", "none");
                $("ul#menuHover5L").find("ul").css("display", "none");                  
                
                $(this).find("div").css("display", "block");
                $(this).find("ul").css("display", "block"); 
                
                $("ul#menuHover5L").children("li").mouseover(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });   
                $("ul#menuHover5L").children("li").mouseout(function() {
                
                    $(this).children("a").css("color", "#FFFFFF");
                });                       
                $("ul#menuHover5L").children("li.selected").mouseout(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });                

            });
            
            $("ul#menuHover6L").find("div").css("display", "none");
            $("ul#menuHover6L").find("ul").css("display", "none");  
            
            $("ul#menuHover6L").children("li.selected").find("div").css("display", "block");                
            $("ul#menuHover6L").children("li.selected").find("ul").css("display", "block");                            

            $("ul#menuHover6L").children("li").children("a").attr("href", "javascript:void(0)");
        
            $("ul#menuHover6L").children("li").click(function () {

                $("ul#menuHover6L").children("li").children("a").css("color", "#FFFFFF");  
                $("ul#menuHover6L").children("li").removeClass("selected");           
                $(this).children("a").css("color", "#e2e65b");
                $(this).addClass("selected");
                $("ul#menuHover6L").find("div").css("display", "none");
                $("ul#menuHover6L").find("ul").css("display", "none");                  
                
                $(this).find("div").css("display", "block");
                $(this).find("ul").css("display", "block"); 
                
                $("ul#menuHover6L").children("li").mouseover(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });   
                $("ul#menuHover6L").children("li").mouseout(function() {
                
                    $(this).children("a").css("color", "#FFFFFF");
                });                       
                $("ul#menuHover6L").children("li.selected").mouseout(function() {
                
                    $(this).children("a").css("color", "#e2e65b");
                });                

            });            
            
                                   
            

            
            break;
    }
}

$(function() {

    menuAction("click");
});
