//** Smooth Navigational Menu- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com
var ddsmoothmenu={transition:{overtime:300,outtime:300},shadow:{enable:true,offsetx:5,offsety:5},showhidedelay:{showdelay:100,hidedelay:200},detectwebkit:navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1,detectie6:document.all&&!window.XMLHttpRequest,css3support:window.msPerformance||!document.all&&document.querySelector,getajaxmenu:function(a,b){var d=a("#"+b.contentsource[0]);d.html("Loading Menu...");a.ajax({url:b.contentsource[1],async:true,error:function(g){d.html("Error fetching content. Server Response: "+ g.responseText)},success:function(g){d.html(g);ddsmoothmenu.buildmenu(a,b)}})},buildmenu:function(a,b){var d=ddsmoothmenu,g=a("#"+b.mainmenuid+">ul");g.parent().get(0).className=b.classname||"ddsmoothmenu";var i=g.find("ul").parent();i.hover(function(){a(this).children("a:eq(0)").addClass("selected")},function(){a(this).children("a:eq(0)").removeClass("selected")});i.each(function(l){var f=a(this).css({zIndex:b.zIndex-l}),e=a(this).find("ul:eq(0)").css({display:"block"});e.data("timers",{});this._dimensions= {w:this.offsetWidth,h:this.offsetHeight,subulw:e.outerWidth(),subulh:e.outerHeight()};this.istopheader=f.parents("ul").length==1?true:false;e.css({top:this.istopheader&&b.orientation!="v"?this._dimensions.h+"px":0});f.children("a:eq(0)").css(this.istopheader?{paddingRight:b.arrowimages.down[2]}:{}).append('<img src="'+(this.istopheader&&b.orientation!="v"?b.arrowimages.down[1]:b.arrowimages.right[1])+'" class="'+(this.istopheader&&b.orientation!="v"?b.arrowimages.down[0]:b.arrowimages.right[0])+'" style="border:0;" />'); if(d.shadow.enable&&!d.css3support){this._shadowoffset={x:this.istopheader?e.offset().left+d.shadow.offsetx:this._dimensions.w,y:this.istopheader?e.offset().top+d.shadow.offsety:f.position().top};$parentshadow=this.istopheader?a(document.body):f.parents("li:eq(0)").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"})}f.hover(function(){var c=f.get(0);clearTimeout(e.data("timers").hidetimer); e.data("timers").showtimer=setTimeout(function(){c._offsets={left:f.offset().left,top:f.offset().top};var h=c.istopheader&&b.orientation!="v"?0:c._dimensions.w;h=c._offsets.left+h+c._dimensions.subulw>a(window).width()?c.istopheader&&b.orientation!="v"?-c._dimensions.subulw+c._dimensions.w:-c._dimensions.w:h;if(e.queue().length<=1){e.css({left:h+"px",width:c._dimensions.subulw+"px"}).animate({height:"show",opacity:"show"},ddsmoothmenu.transition.overtime);if(d.shadow.enable&&!d.css3support){h=c.istopheader? e.offset().left+ddsmoothmenu.shadow.offsetx:h;var m=c.istopheader?e.offset().top+d.shadow.offsety:c._shadowoffset.y;!c.istopheader&&ddsmoothmenu.detectwebkit&&c.$shadow.css({opacity:1});c.$shadow.css({overflow:"",width:c._dimensions.subulw+"px",left:h+"px",top:m+"px"}).animate({height:c._dimensions.subulh+"px"},ddsmoothmenu.transition.overtime)}}},ddsmoothmenu.showhidedelay.showdelay)},function(){var c=f.get(0);clearTimeout(e.data("timers").showtimer);e.data("timers").hidetimer=setTimeout(function(){e.animate({height:"hide", opacity:"hide"},ddsmoothmenu.transition.outtime);if(d.shadow.enable&&!d.css3support){ddsmoothmenu.detectwebkit&&c.$shadow.children("div:eq(0)").css({opacity:0});c.$shadow.css({overflow:"hidden"}).animate({height:0},ddsmoothmenu.transition.outtime)}},ddsmoothmenu.showhidedelay.hidedelay)})});if(d.shadow.enable&&d.css3support){i=a("#"+b.mainmenuid+" ul li ul");for(var n=parseInt(d.shadow.offsetx)+"px "+parseInt(d.shadow.offsety)+"px 5px #aaa",k=["boxShadow","MozBoxShadow","WebkitBoxShadow","MsBoxShadow"], j=0;j<k.length;j++)i.css(k[j],n)}g.find("ul").css({display:"none",visibility:"visible"})},init:function(a){if(typeof a.customtheme=="object"&&a.customtheme.length==2){var b="#"+a.mainmenuid;document.write('<style type="text/css">\n'+(a.orientation=="v"?b:b+", "+b)+" 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?false:this.shadow.enable;jQuery(document).ready(function(d){typeof a.contentsource== "object"?ddsmoothmenu.getajaxmenu(d,a):ddsmoothmenu.buildmenu(d,a)})}};
