/* 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
 * updated 090409 by R-Styles SIMP : http://r-styles.blogspot.com/ --> added persistent hover class on parent while hover on child & timeout & current page active */
var jqnav={anim:{over:100,out:100},simplify:function(menuid,active,timeout){jQuery(document).ready(function($){
if(active==null){active="active";}if(timeout==null){timeout="350";} var timer; 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}); $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? 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($targetul.is(':visible')){clearTimeout(timer);}$targetul.css({left:menuleft+"px",width:this._dimensions.subulw+'px'}).slideDown(jqnav.anim.over);$targetul.parent().find("a:first").addClass(active);},function(e){var $targetul=$(this).children("ul:eq(0)");timer=setTimeout(function(){$targetul.slideUp(jqnav.anim.out)},timeout);$targetul.parent().find("a:first").removeClass(active);})});$mainmenu.find("ul").css({display:'none',visibility:'visible'});});
$("#"+menuid+" a").each(function(){if(this.href==window.location.href.split("#")[0]){$(this).attr('id',active);}});}}
