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