/* Project overrides for Rococo Couture Web Site (June 2011)
   Netshell Limited <http://www.netshell.co.uk>
   Drew Durkin <drew.durkin@netshell.co.uk> */

// This replaces menu.js provided in default templates

var activeSubNav = -1;
$(document).ready(function() {

  $("[name^=top-]").hover(function() { 
      var id = $(this).attr("name").substring(4);
      $(".subnav").hide();
      $("#subnav-" + id).show();
      activeSubNav = id;
      $(".selectednav").attr("class","");
      if($(this).attr("class") != "activenav")
      {
        $(this).attr("class","selectednav");
      }
    });  
  
  $(".subnav").hover(function() {
      var id = $(this).attr("id").substring(7);
      activeSubNav = id;
    });

  $(".subnav").mouseleave(function() {
      activeSubNav = -1;
      $(this).hide();
      $(".selectednav").attr("class","");
      $("[name^=activemenu]").show();
    });

  $("[name^=top-]").mouseleave(function() {
      activeSubNav = -1;   
    window.setTimeout(function() {
        if(activeSubNav == -1) { 
          $(".subnav").hide(); 
          $(".selectednav").attr("class","");
          $("[name^=activemenu]").show();
         }
      },100); 
    });
  });

