//** 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
//** July 27th, 09" (v1.31): Fixed bug so shadows can be disabled if desired.
//** Feb 2nd, 10" (v1.4): Adds ability to specify delay before sub menus appear and disappear, respectively. See showhidedelay variable below
var ddsmoothmenu={arrowimages:{down:["downarrowclass","spacer.gif",0],right:["rightarrowclass","spacer.gif"]},transition:{overtime:300,outtime:300},shadow:{enable:!0,offsetx:5,offsety:5},showhidedelay:{showdelay:100,hidedelay:200},detectwebkit:navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1,detectie6:document.all&&!window.XMLHttpRequest,getajaxmenu:function(a,b){var c=a("#"+b.contentsource[0]);c.html("Loading Menu..."),a.ajax({url:b.contentsource[1],async:!0,error:function(a){c.html("Error fetching content. Server Response: "+a.responseText)},success:function(d){c.html(d),ddsmoothmenu.buildmenu(a,b)}})},buildmenu:function(a,b){var c=ddsmoothmenu,d=a("#"+b.mainmenuid+">ul");d.parent().get(0).className=b.classname||"ddsmoothmenu";var e=d.find("ul").parent();e.hover(function(b){a(this).children("a:eq(0)").addClass("selected")},function(b){a(this).children("a:eq(0)").removeClass("selected")}),e.each(function(d){var e=a(this).css({zIndex:100-d}),f=a(this).find("ul:eq(0)").css({display:"block"});f.data("timers",{}),this._dimensions={w:this.offsetWidth,h:this.offsetHeight,subulw:f.outerWidth(),subulh:f.outerHeight()},this.istopheader=e.parents("ul").length==1?!0:!1,f.css({top:this.istopheader&&b.orientation!="v"?this._dimensions.h+"px":0}),e.children("a:eq(0)").css(this.istopheader?{paddingRight:c.arrowimages.down[2]}:{}).append('<img src="'+(this.istopheader&&b.orientation!="v"?c.arrowimages.down[1]:c.arrowimages.right[1])+'" class="'+(this.istopheader&&b.orientation!="v"?c.arrowimages.down[0]:c.arrowimages.right[0])+'" style="border:0;" />');if(c.shadow.enable){this._shadowoffset={x:this.istopheader?f.offset().left+c.shadow.offsetx:this._dimensions.w,y:this.istopheader?f.offset().top+c.shadow.offsety:e.position().top};if(this.istopheader)$parentshadow=a(document.body);else{var g=e.parents("li:eq(0)");$parentshadow=g.get(0).$shadow}this.$shadow=a('<div class="ddshadow'+(this.istopheader?" toplevelshadow":"")+'"></div>').prependTo($parentshadow).css({left:this._shadowoffset.x+"px",top:this._shadowoffset.y+"px"})}e.hover(function(d){var g=f,h=e.get(0);clearTimeout(g.data("timers").hidetimer),g.data("timers").showtimer=setTimeout(function(){h._offsets={left:e.offset().left,top:e.offset().top};var d=h.istopheader&&b.orientation!="v"?0:h._dimensions.w;d=h._offsets.left+d+h._dimensions.subulw>a(window).width()?h.istopheader&&b.orientation!="v"?-h._dimensions.subulw+h._dimensions.w:-h._dimensions.w:d;if(g.queue().length<=1){g.css({left:d+"px",width:h._dimensions.subulw+"px"}).animate({height:"show",opacity:"show"},ddsmoothmenu.transition.overtime);if(c.shadow.enable){var f=h.istopheader?g.offset().left+ddsmoothmenu.shadow.offsetx:d,i=h.istopheader?g.offset().top+c.shadow.offsety:h._shadowoffset.y;!h.istopheader&&ddsmoothmenu.detectwebkit&&h.$shadow.css({opacity:1}),h.$shadow.css({overflow:"",width:h._dimensions.subulw+"px",left:f+"px",top:i+"px"}).animate({height:h._dimensions.subulh+"px"},ddsmoothmenu.transition.overtime)}}},ddsmoothmenu.showhidedelay.showdelay)},function(a){var b=f,d=e.get(0);clearTimeout(b.data("timers").showtimer),b.data("timers").hidetimer=setTimeout(function(){b.animate({height:"hide",opacity:"hide"},ddsmoothmenu.transition.outtime),c.shadow.enable&&(ddsmoothmenu.detectwebkit&&d.$shadow.children("div:eq(0)").css({opacity:0}),d.$shadow.css({overflow:"hidden"}).animate({height:0},ddsmoothmenu.transition.outtime))},ddsmoothmenu.showhidedelay.hidedelay)})}),d.find("ul").css({display:"none",visibility:"visible"})},init:function(a){if(typeof a.customtheme=="object"&&a.customtheme.length==2){var b="#"+a.mainmenuid,c=a.orientation=="v"?b:b+", "+b;document.write('<style type="text/css">\n'+c+" ul li a {background:"+a.customtheme[0]+";}\n"+b+" ul li a:hover {background:"+a.customtheme[1]+";}\n"+"</style>")}this.shadow.enable=document.all&&!window.XMLHttpRequest?!1:this.shadow.enable,jQuery(document).ready(function(b){typeof a.contentsource=="object"?ddsmoothmenu.getajaxmenu(b,a):ddsmoothmenu.buildmenu(b,a)})}}

