// This script is a combination of two scripts and custom stuff at the bottom //----------------- edge detect hover menu ------------------------// //** Smooth Navigational Menu - By Dynamic Drive DHTML code library: http://www.dynamicdrive.com //** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/ //removed arrow images showing empty image holder if(document.documentElement.clientWidth>849){ var ddsmoothmenu={arrowimages:{down:[],right:[]},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,css3support:window.msPerformance||(!document.all&&document.querySelector),ismobile:navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i)!=null,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,j){var f=ddsmoothmenu;var b=d("#"+j.mainmenuid+">ul");b.parent().get(0).className=j.classname||"ddsmoothmenu";var g=b.find("ul").parent();g.hover(function(i){d(this).children("a:eq(0)").addClass("selected")},function(i){d(this).children("a:eq(0)").removeClass("selected")});g.each(function(l){var n=d(this).css({zIndex:100-l});var k=d(this).find("ul:eq(0)").css({display:"block"});k.data("timers",{});this._dimensions={w:this.offsetWidth,h:this.offsetHeight,subulw:k.outerWidth(),subulh:k.outerHeight()};this.istopheader=n.parents("ul").length==1?true:false;k.css({top:this.istopheader&&j.orientation!="v"?this._dimensions.h+"px":0});if(f.shadow.enable&&!f.css3support){this._shadowoffset={x:(this.istopheader?k.offset().left+f.shadow.offsetx:this._dimensions.w),y:(this.istopheader?k.offset().top+f.shadow.offsety:n.position().top)};if(this.istopheader){$parentshadow=d(document.body)}else{var m=n.parents("li:eq(0)");$parentshadow=m.get(0).$shadow}this.$shadow=d('
').prependTo($parentshadow).css({left:this._shadowoffset.x+"px",top:this._shadowoffset.y+"px"})}n.hover(function(o){var i=k;var p=n.get(0);clearTimeout(i.data("timers").hidetimer);i.data("timers").showtimer=setTimeout(function(){p._offsets={left:n.offset().left,top:n.offset().top};var s=p.istopheader&&j.orientation!="v"?0:p._dimensions.w;s=(p._offsets.left+s+p._dimensions.subulw>d(window).width())?(p.istopheader&&j.orientation!="v"?-p._dimensions.subulw+p._dimensions.w:-p._dimensions.w):s;if(i.queue().length<=1){i.css({left:s+"px",width:p._dimensions.subulw+"px"}).animate({height:"show",opacity:"show"},ddsmoothmenu.transition.overtime);if(f.shadow.enable&&!f.css3support){var r=p.istopheader?i.offset().left+ddsmoothmenu.shadow.offsetx:s;var q=p.istopheader?i.offset().top+f.shadow.offsety:p._shadowoffset.y;if(!p.istopheader&&ddsmoothmenu.detectwebkit){p.$shadow.css({opacity:1})}p.$shadow.css({overflow:"",width:p._dimensions.subulw+"px",left:r+"px",top:q+"px"}).animate({height:p._dimensions.subulh+"px"},ddsmoothmenu.transition.overtime)}}},ddsmoothmenu.showhidedelay.showdelay)},function(o){var i=k;var p=n.get(0);clearTimeout(i.data("timers").showtimer);i.data("timers").hidetimer=setTimeout(function(){i.animate({height:"hide",opacity:"hide"},ddsmoothmenu.transition.outtime);if(f.shadow.enable&&!f.css3support){if(ddsmoothmenu.detectwebkit){p.$shadow.children("div:eq(0)").css({opacity:0})}p.$shadow.css({overflow:"hidden"}).animate({height:0},ddsmoothmenu.transition.outtime)}},ddsmoothmenu.showhidedelay.hidedelay)})});if(f.shadow.enable&&f.css3support){var a=d("#"+j.mainmenuid+" ul li ul");var e=parseInt(f.shadow.offsetx)+"px "+parseInt(f.shadow.offsety)+"px 5px #aaa";var h=["boxShadow","MozBoxShadow","WebkitBoxShadow","MsBoxShadow"];for(var c=0;c\n'+a+" ul li a {background:"+c.customtheme[0]+";}\n"+b+" ul li a:hover {background:"+c.customtheme[1]+";}\n")}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)}})}}; } //----------------- multi level accordion ------------------------// /* * DC jQuery Vertical Accordion Menu - jQuery vertical accordion menu plugin * Copyright (c) 2011 Design Chemical * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ if(document.documentElement.clientWidth<849){ (function($){$.fn.dcAccordion=function(options){var defaults={classParent:"dcjq-parent",classActive:"active",classArrow:"dcjq-icon",classCount:"dcjq-count",classExpand:"dcjq-current-parent",eventType:"click",hoverDelay:300,menuClose:true,autoClose:true,autoExpand:false,speed:"slow",saveState:true,disableLink:true,showCount:false,cookie:"dcjq-accordion"};var options=$.extend(defaults,options);this.each(function(options){var obj=this;setUpAccordion();if(defaults.saveState==true){checkCookie(defaults.cookie,obj)}if(defaults.autoExpand==true){$("li."+defaults.classExpand+" > a").addClass(defaults.classActive)}resetAccordion();if(defaults.eventType=="hover"){var config={sensitivity:2,interval:defaults.hoverDelay,over:linkOver,timeout:defaults.hoverDelay,out:linkOut};$("li a",obj).hoverIntent(config);var configMenu={sensitivity:2,interval:1000,over:menuOver,timeout:1000,out:menuOut};$(obj).hoverIntent(configMenu);if(defaults.disableLink==true){$("li a",obj).click(function(e){if($(this).siblings("ul").length>0){e.preventDefault()}})}}else{$("li a",obj).click(function(e){$activeLi=$(this).parent("li");$parentsLi=$activeLi.parents("li");$parentsUl=$activeLi.parents("ul");if(defaults.disableLink==true){if($(this).siblings("ul").length>0){e.preventDefault()}}if(defaults.autoClose==true){autoCloseAccordion($parentsLi,$parentsUl)}if($("> ul",$activeLi).is(":visible")){$("ul",$activeLi).slideUp(defaults.speed);$("a",$activeLi).removeClass(defaults.classActive)}else{$(this).siblings("ul").slideToggle(defaults.speed);$("> a",$activeLi).addClass(defaults.classActive)}if(defaults.saveState==true){createCookie(defaults.cookie,obj)}})}function setUpAccordion(){$arrow='';var classParentLi=defaults.classParent+"-li";$("> ul",obj).show();$("li",obj).each(function(){if($("> ul",this).length>0){$(this).addClass(classParentLi);$("> a",this).addClass(defaults.classParent).append($arrow)}});$("> ul",obj).hide();if(defaults.showCount==true){$("li."+classParentLi,obj).each(function(){if(defaults.disableLink==true){var getCount=parseInt($("ul a:not(."+defaults.classParent+")",this).length)}else{var getCount=parseInt($("ul a",this).length)}$("> a",this).append(' ('+getCount+")")})}}function linkOver(){$activeLi=$(this).parent("li");$parentsLi=$activeLi.parents("li");$parentsUl=$activeLi.parents("ul");if(defaults.autoClose==true){autoCloseAccordion($parentsLi,$parentsUl)}if($("> ul",$activeLi).is(":visible")){$("ul",$activeLi).slideUp(defaults.speed);$("a",$activeLi).removeClass(defaults.classActive)}else{$(this).siblings("ul").slideToggle(defaults.speed);$("> a",$activeLi).addClass(defaults.classActive)}if(defaults.saveState==true){createCookie(defaults.cookie,obj)}}function linkOut(){}function menuOver(){}function menuOut(){if(defaults.menuClose==true){$("ul",obj).slideUp(defaults.speed);$("a",obj).removeClass(defaults.classActive);createCookie(defaults.cookie,obj)}}function autoCloseAccordion($parentsLi,$parentsUl){$("ul",obj).not($parentsUl).slideUp(defaults.speed);$("a",obj).removeClass(defaults.classActive);$("> a",$parentsLi).addClass(defaults.classActive)}function resetAccordion(){$("ul",obj).hide();$allActiveLi=$("a."+defaults.classActive,obj);$allActiveLi.siblings("ul").show()}});function checkCookie(cookieId,obj){var cookieVal=$.cookie(cookieId);if(cookieVal!=null){var activeArray=cookieVal.split(",");$.each(activeArray,function(index,value){var $cookieLi=$("li:eq("+value+")",obj);$("> a",$cookieLi).addClass(defaults.classActive);var $parentsLi=$cookieLi.parents("li");$("> a",$parentsLi).addClass(defaults.classActive)})}}function createCookie(cookieId,obj){var activeIndex=[];$("li a."+defaults.classActive,obj).each(function(i){var $arrayItem=$(this).parent("li");var itemIndex=$("li",obj).index($arrayItem);activeIndex.push(itemIndex)});$.cookie(cookieId,activeIndex,{path:"/"})}}})(jQuery); } /*-----------------custom-------------------------*/ /*================================================================*/ /* DESKTOP MENU /*================================================================*/ if(document.documentElement.clientWidth>849){ddsmoothmenu.init({mainmenuid:"main_menu",orientation:"h",contentsource:"markup",showhidedelay:{showdelay:300,hidedelay:100}})}; /*================================================================*/ /* SWITCH TO MULIT-LEVEL ACCORDION when mobile /*================================================================*/ if(document.documentElement.clientWidth<849){$(document).ready(function(){$(".accordmobile").dcAccordion({eventType:"click",saveState:false,autoClose:true,disableLink:true,speed:"fast",showCount:false,autoExpand:false,classExpand:"parent"})})}; /*================================================================*/ /* MOBILE NAV TRIGGER just click the trigger and show the #main_menu - works alone don't remove /*================================================================*/ $(document).ready(function(){$(".mobile_nav a").click(function(){$("#main_menu").slideToggle(100);$(this).toggleClass("active");return false})}); /*================================================================*/ /* IPAD MENU ONLY - make it into a toggle menu works alone don't remove /*================================================================*/ $(document).ready(function(){var deviceAgent=navigator.userAgent.toLowerCase();var agentID=deviceAgent.match(/(iphone|ipod|ipad)/);if(agentID){if(document.documentElement.clientWidth>849){$("#main_menu ul li.parent").click(function(event){$(this).children(".parent").hide();$("ul",this).toggle();$(this).toggleClass("foo");event.stopPropagation()})}}});