var smoothnav={
	transition: {overtime:300, outtime:300}, //duration of slide in/ out animation, in milliseconds
	buildmenu:function($, setting){
		var smoothmenu=smoothnav
		var $mainmenu=$("#"+setting.mainmenuid+">ul") //reference main menu UL
		var $headers=$mainmenu.find("ul").parent()
		$headers.hover(
			function(e){ $(this).children('a:eq(0)').addClass('selected') },
			function(e){ $(this).children('a:eq(0)').removeClass('selected') }
		)
		$headers.each(function(i){ //loop through each LI header
			var $curobj=$(this).css({zIndex: 100-i}) //reference current LI header
			var $subul=$(this).find('ul:eq(0)').css({display:'block'})
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false //is top level header?
			$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 && setting.orientation!='v'? 0 : this._dimensions.w
					if ($targetul.queue().length<=1){ //if 1 or less queued animations
						$targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).animate({height:'show',opacity:'show'}, smoothnav.transition.overtime)
					}
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					$targetul.animate({height:'hide', opacity:'hide'}, smoothnav.transition.outtime)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	},
	init:function(setting){
		jQuery(document).ready(function($){ //ajax menu?
			smoothnav.buildmenu($, setting)
		})
	}
} //end ddsmoothmenu variable
