﻿    //menu
    $(document).ready(function() {
    /*
      var toggle = function(direction, display) {
        return function() {
          var self = this;
          var ul = $("ul", this);
          if( ul.css("display") == display && !self["block" + direction] ) {
            self["block" + direction] = true;
            ul["slide" + direction]("slow", function() {
              self["block" + direction] = false;
            });
          }
        };
      }
      $("li.menu").hover(toggle("Down", "none"), toggle("Up", "block"));
      //$("li.menu ul").hide();
      */
	    $("#menu li ul").hide(); 

	    $("#menu li").hover(
            function () {
		    $(this).children("ul").show();
            },function(){
		    $(this).children("ul").hide();
	    });//hover
	    
	    // set the on state for the top nav
	    var isMerchandise = (location.href.indexOf("merchandise") == -1) ? false : true;
	    var isOwner = (location.href.indexOf("owner") == -1) ? false : true;
	    var isArtists = (location.href.indexOf("artists") == -1) ? false : true;
	    var isOurShop = (location.href.indexOf("shop") == -1) ? false : true;

	    if (!isMerchandise)
	    {
	      if (isArtists || isOwner)
	      {
	        document.getElementById('topnav_two').src = "/images/artists_on.gif";
	        document.getElementById('topnav_two').setAttribute("onmouseout", "");
	      }
	      else if (isOurShop)
	      {
	        document.getElementById('topnav_four').src = "/images/our-shop_on.gif";
	        document.getElementById('topnav_four').setAttribute("onmouseout", "");
	      }
	      else
	      {
	        document.getElementById('topnav_one').src = "/images/links_on.gif";
	        document.getElementById('topnav_one').setAttribute("onmouseout", "");
	      }
	    }
	    else
	    {
	      document.getElementById('topnav_three').src = "/images/merchandise_on.gif";
	      document.getElementById('topnav_three').setAttribute("onmouseout", "");
	    }

    });
    
    function toggleTopNav(topNavItem, imgSrc)
    {
      document.getElementById(topNavItem).src=imgSrc;
    }
