//** 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","",20],right:["rightarrowclass",""]},transition:{overtime:300,outtime:0},shadow:{enable:true,offsetx:5,offsety:5},showhidedelay:{showdelay:100,hidedelay:200},detectwebkit:navigator.userAgent.toLowerCase().indexOf("applewebkit")!=-1,detectie6:document.all&&!window.XMLHttpRequest,getajaxmenu:function(a,d){var e=a("#"+d.contentsource[0]);e.html("Loading Menu...");a.ajax({url:d.contentsource[1],async:true,error:function(g){e.html("Error fetching content. Server Response: "+ g.responseText)},success:function(g){e.html(g);ddsmoothmenu.buildmenu(a,d)}})},buildmenu:function(a,d){var e=ddsmoothmenu,g=a("#"+d.mainmenuid+">ul");g.parent().get(0).className=d.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(j){var f=a(this).css({zIndex:100-j}),c=a(this).find("ul:eq(0)").css({display:"block"});c.data("timers",{});this._dimensions= {w:this.offsetWidth,h:this.offsetHeight,subulw:c.outerWidth(),subulh:c.outerHeight()};this.istopheader=f.parents("ul").length==1?true:false;c.css({top:this.istopheader&&d.orientation!="v"?this._dimensions.h+"px":0});f.children("a:eq(0)").css(this.istopheader?{paddingRight:e.arrowimages.down[2]}:{}).append("");if(e.shadow.enable){this._shadowoffset={x:this.istopheader?c.offset().left+e.shadow.offsetx:this._dimensions.w,y:this.istopheader?c.offset().top+e.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 b=f.get(0);clearTimeout(c.data("timers").hidetimer);c.data("timers").showtimer=setTimeout(function(){b._offsets={left:f.offset().left,top:f.offset().top};var h=b.istopheader&&d.orientation!="v"?0:b._dimensions.w;h=b._offsets.left+ h+b._dimensions.subulw>a(window).width()?b.istopheader&&d.orientation!="v"?-b._dimensions.subulw+b._dimensions.w:-b._dimensions.w:h;if(c.queue().length<=1){c.css({left:h+"px",width:b._dimensions.subulw+"px"}).animate({height:"show",opacity:"show"},ddsmoothmenu.transition.overtime);if(e.shadow.enable){h=b.istopheader?c.offset().left+ddsmoothmenu.shadow.offsetx:h;var k=b.istopheader?c.offset().top+e.shadow.offsety:b._shadowoffset.y;!b.istopheader&&ddsmoothmenu.detectwebkit&&b.$shadow.css({opacity:1}); b.$shadow.css({overflow:"",width:b._dimensions.subulw+"px",left:h+"px",top:k+"px"}).animate({height:b._dimensions.subulh+"px"},ddsmoothmenu.transition.overtime)}}},ddsmoothmenu.showhidedelay.showdelay)},function(){var b=f.get(0);clearTimeout(c.data("timers").showtimer);c.data("timers").hidetimer=setTimeout(function(){c.animate({height:"hide",opacity:"hide"},ddsmoothmenu.transition.outtime);if(e.shadow.enable){ddsmoothmenu.detectwebkit&&b.$shadow.children("div:eq(0)").css({opacity:0});b.$shadow.css({overflow:"hidden"}).animate({height:0}, ddsmoothmenu.transition.outtime)}},ddsmoothmenu.showhidedelay.hidedelay)})});g.find("ul").css({display:"none",visibility:"visible"})},init:function(a){if(typeof a.customtheme=="object"&&a.customtheme.length==2){var d="#"+a.mainmenuid;document.write('<style type="text/css">\n'+(a.orientation=="v"?d:d+", "+d)+" ul li a {background:"+a.customtheme[0]+";}\n"+d+" 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(e){typeof a.contentsource=="object"?ddsmoothmenu.getajaxmenu(e,a):ddsmoothmenu.buildmenu(e,a)})}};

ddsmoothmenu.init({
	mainmenuid: "smoothmenu1", //menu DIV id
	orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
	classname: 'ddsmoothmenu', //class added to menu's outer DIV
	//customtheme: ["#1c5a80", "#18374a"],
	contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

$(document).ready(function() {

// form search
$(".go").click(function() {
	$("#frm_search").submit();
});
// newsletter subscribe
$("#newsletter").click(function() {
	$("#newsletter").hide();
	$(".subscribe").show();
	$("#name").focus();
});
});
