﻿var ddsmoothmenu={arrowimages:{down:["downarrowclass","images/down.gif",23],right:["rightarrowclass","images/right.gif"]},transition:{overtime:300,outtime:300},shadow:{enable:true,offsetx:5,offsety:5},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(b){a.html("Error fetching content. Server Response: "+b.responseText)},success:function(d){a.html(d);ddsmoothmenu.buildmenu(c,b)}})},buildmenu:function(a,c){var b=ddsmoothmenu,d=a("#"+c.mainmenuid+">ul");d.parent().get(0).className=c.classname||"ddsmoothmenu";var e=d.find("ul").parent();e.hover(function(){a(this).children("a:eq(0)").addClass("selected")},function(){a(this).children("a:eq(0)").removeClass("selected")});e.each(function(g){var d=a(this).css({zIndex:100-g}),e=a(this).find("ul:eq(0)").css({display:"block"});this._dimensions={w:this.offsetWidth,h:this.offsetHeight,subulw:e.outerWidth(),subulh:e.outerHeight()};this.istopheader=d.parents("ul").length==1?true:false;e.css({top:this.istopheader&&c.orientation!="v"?this._dimensions.h+"px":0});d.children("a:eq(0)").css(this.istopheader?{paddingRight:b.arrowimages.down[2]}:{}).append('<img src="'+(this.istopheader&&c.orientation!="v"?b.arrowimages.down[1]:b.arrowimages.right[1])+'" class="'+(this.istopheader&&c.orientation!="v"?b.arrowimages.down[0]:b.arrowimages.right[0])+'" style="border:0;" />');if(b.shadow.enable){this._shadowoffset={x:this.istopheader?e.offset().left+b.shadow.offsetx:this._dimensions.w,y:this.istopheader?e.offset().top+b.shadow.offsety:d.position().top};if(this.istopheader)$parentshadow=a(document.body);else{var f=d.parents("li:eq(0)");$parentshadow=f.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"})}d.hover(function(){var e=a(this).children("ul:eq(0)");this._offsets={left:a(this).offset().left,top:a(this).offset().top};var d=this.istopheader&&c.orientation!="v"?0:this._dimensions.w;d=this._offsets.left+d+this._dimensions.subulw>a(window).width()?this.istopheader&&c.orientation!="v"?-this._dimensions.subulw+this._dimensions.w:-this._dimensions.w:d;if(e.queue().length<=1){e.css({left:d+"px",width:this._dimensions.subulw+"px"}).animate({height:"show",opacity:"show"},ddsmoothmenu.transition.overtime);if(b.shadow.enable){var f=this.istopheader?e.offset().left+ddsmoothmenu.shadow.offsetx:d,g=this.istopheader?e.offset().top+b.shadow.offsety:this._shadowoffset.y;if(!this.istopheader&&ddsmoothmenu.detectwebkit)this.$shadow.css({opacity:1});this.$shadow.css({overflow:"",width:this._dimensions.subulw+"px",left:f+"px",top:g+"px"}).animate({height:this._dimensions.subulh+"px"},ddsmoothmenu.transition.overtime)}}},function(){var c=a(this).children("ul:eq(0)");c.animate({height:"hide",opacity:"hide"},ddsmoothmenu.transition.outtime);if(b.shadow.enable){if(ddsmoothmenu.detectwebkit)this.$shadow.children("div:eq(0)").css({opacity:0});this.$shadow.css({overflow:"hidden"}).animate({height:0},ddsmoothmenu.transition.outtime)}})});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?false:this.shadow.enable;jQuery(document).ready(function(b){if(typeof a.contentsource=="object")ddsmoothmenu.getajaxmenu(b,a);else ddsmoothmenu.buildmenu(b,a)})}}
