/*********************
//* jQuery Multi Level CSS Menu #2- By Dynamic Drive: http://www.dynamicdrive.com/
//* Last update: Nov 7th, 08': Limit # of queued animations to minmize animation stuttering
//* Menu avaiable at DD CSS Library: http://www.dynamicdrive.com/style/
*********************/

//Specify full URL to down and right arrow images (23 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']};

var jqueryslidemenu={

animateduration: {over: 200, out: 100}, //duration of slide in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	
		var $mainmenu=$("#"+menuid+">ul");
		//$mainmenu.css("width","75px");
		//$mainmenu.css("float","left");
		$mainmenu.css("background-color","#FFD566");

		var $headers=$mainmenu.find("ul").parent();
		$headers.each(function(i){
			var $curobj=$(this);
			var $subul=$(this).find('ul:eq(0)');
			this.istopheader=$curobj.parents("ul").length==1? true : false;
			this._dimensions={h:this.offsetHeight, subulh:$subul.outerHeight()};
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0});
			if(arrowimages)	$curobj.append('<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])	+'" style="border:0;" />');
			this._dimensions.w=$subul.outerWidth();
			
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)");
					this._offsets={left:$(this).offset().left, top:$(this).offset().top};
					var menuleft=0,aWidth=0;
					var prt=$(this).find('ul:eq(0)');
					aWidth=prt.outerWidth();
					if(!this.istopheader){
						prt=$(this).parents('ul:first');
						menuleft=prt.outerWidth();
					}
					if ($targetul.queue().length<=1){	//if 1 or less queued animations
						$targetul.css({left:(menuleft)+"px"}).slideDown(jqueryslidemenu.animateduration.over);
					}
				},
				function(e){
					var $targetul=$(this).children("ul:eq(0)");
					$targetul.slideUp(jqueryslidemenu.animateduration.out);
				}
			); //end hover
		}); //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'});
	
	
	}
};

function randomColor( ) {
    var rand = Math.floor(Math.random( ) * 0xFFFFFF).toString(16);
    if(rand.length == 6){
        return rand;
    }else{
        return randomColor();
    }
}

//build menu with ID="myslidemenu" on page:
