//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/
//** Menu created: Nov 12, 2008

//** Dec 12th, 08" (v1.01): Fixed Shadow issue when multiple LIs within the same UL (level) contain sub menus: http://www.dynamicdrive.com/forums/showthread.php?t=39177&highlight=smooth

//** Feb 11th, 09" (v1.02): The currently active main menu item (LI A) now gets a CSS class of ".selected", including sub menu items.

//** May 1st, 09" (v1.3):
//** 1) Now supports vertical (side bar) menu mode- set "orientation" to 'v'
//** 2) In IE6, shadows are now always disabled


var arrowimages={down:['downarrowclass', '/img/multimusic/down.gif', 23], right:['rightarrowclass', '/img/multimusic/right.gif']}

var jqueryslidemenu={

animateduration: {over: 10, out: 300}, //duration of slide in/ out animation,   in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+" ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			if($curobj.parents("ul").length!=1){
			$curobj.children("a:eq(0)").append(
				'<img src="'+ (arrowsvar.right[1])
				+'" class="' + (arrowsvar.right[0])
				+ '" style="border:0;" width="7" height="7" />'
			)
			}
			//$(this).children("ul:eq(0)").hide();
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					//var menuleft= this.istopheader? 190 : this._dimensions.w
					//menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					if ($targetul.queue().length<=1) //if 1 or less queued animations
						$targetul.css({left:(this.istopheader? '203px' : '207px'), top:0, width: '207px'})
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.css({top:'-2000px'})
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({top:'-2000px', visibility:'visible'})
	}) //end document.ready/
}
}


