var dropdown = {

animateduration: {over: 200, out: 100}, //duration of slide in/ out animation, in milliseconds

add:function(menuid,_par){
	jQuery(document).ready(function($){
		var $mainmenu = $("#"+menuid).addClass('ui-menu');
		var $headers=$mainmenu.find("div.ui-menu-item").parent();
		if ($.browser.msie && $.browser.version == '6.0') {
			$('<iframe scrolling="no" frameborder="0" marginheight="0" marginwidth="0"></iframe>').css({
				display:'none',
				position:'absolute',
				zIndex:'-1',
				margin:0,
				padding:0
			}).insertAfter($mainmenu.find('div.ui-menu-item'));
		}
		$headers.each(function(i){
			var $curobj=$(this);
			var $subul=$(this).find('kbd');
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()};
			this.istopheader=$curobj.parents(_par).length==1? true : false;
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0});
			$curobj.hover(
				function(e){
					var $this = this;
					menu = setTimeout(function(e){
						$curobj.addClass("active").find('a:first').addClass('hover');
						var $targetul=$($this).children("div:eq(0)");
						$this._offsets={left:$($this).offset().left, top:$($this).offset().top};
						var menuleft=0; //this.istopheader? 0 : 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($curobj.hasClass('full-width'))
							menuleft=menuleft-$curobj.position().left;
						if ($targetul.queue().length<=1) { //if 1 or less queued animations
							$targetul.css({left:menuleft, width:$this._dimensions.subulw}).slideDown(dropdown.animateduration.over,function(){
								if ($.browser.msie && $.browser.version == '6.0') {
									$curobj.find('iframe').css({
										height:$targetul.height()+'px'
									})
								}
							});
						}
						if ($.browser.msie && $.browser.version == '6.0') {
							$curobj.find('iframe').css({
								top:$this._dimensions.h+'px',
								left:menuleft,
								width:$targetul.width()+'px'
							}).show();
						}
                    },500);
				},
				function(e){
					clearTimeout(menu)
                    $curobj.removeClass("active").find('a:first').removeClass('hover');
					var $targetul=$(this).children("div:eq(0)");
					$targetul.slideUp(dropdown.animateduration.out);
					$curobj.find('iframe').hide();
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("div:eq(0)").css({display:'none', visibility:'visible'});
	}) //end document.ready
}
}

//build menu with ID="myslidemenu" on page:
dropdown.add("topnav","ul");
dropdown.add("header-selectbox","div");
dropdown.add("comparison","span");
dropdown.add("navi","ul");
