/*! * SmartMenus jQuery Plugin - v0.9.7 - August 25, 2014 * http://www.smartmenus.org/ * * Copyright 2014 Vasil Dinkov, Vadikom Web Ltd. * http://vadikom.com * * Licensed MIT */ ( function( a ){var b=[],d=!!window.createPopup,e=false,f=false;function h( k ){var l=".smartmenus_mouse";if ( !f&&!k ){var m=true,j=null;a( document ).bind( g( [["mousemove",function( q ){var r={x:q.pageX,y:q.pageY,timeStamp:new Date().getTime()};if ( j ){var o=Math.abs( j.x-r.x ),n=Math.abs( j.y-r.y );if ( ( o>0||n>0 )&&o<=2&&n<=2&&r.timeStamp-j.timeStamp<=300 ){e=true;if ( m ){var p=a( q.target ).closest( "a" );if ( p.is( "a" ) ){a.each( b,function(){if ( a.contains( this.$root[0],p[0] ) ){this.itemEnter( {currentTarget:p[0]} );return false}} )}m=false}}}j=r}],[c()?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut",function( n ){if ( i( n.originalEvent ) ){e=false}}]],l ) );f=true}else{if ( f&&k ){a( document ).unbind( l );f=false}}}function i( j ){return !/^( 4|mouse )$/.test( j.pointerType )}function c(){return"ontouchstart" in window }function g( j,l ){if ( !l ){l=""}var k={};a.each( j,function( m,n ){k[n[0].split( " " ).join( l+" " )+l]=n[1]} );return k}a.SmartMenus=function( k,j ){this.$root=a( k );this.opts=j;this.rootId="";this.$subArrow=null;this.subMenus=[];this.activatedItems=[];this.visibleSubMenus=[];this.showTimeout=0;this.hideTimeout=0;this.scrollTimeout=0;this.clickActivated=false;this.zIndexInc=0;this.$firstLink=null;this.$firstSub=null;this.disabled=false;this.$disableOverlay=null;this.isTouchScrolling=false;this.init()};a.extend( a.SmartMenus,{hideAll:function(){a.each( b,function(){this.menuHideAll()} )},destroy:function(){while( b.length ){b[0].destroy()}h( true )},prototype:{init:function( l ){var j=this;if ( !l ){b.push( this );this.rootId=( new Date().getTime()+Math.random()+"" ).replace( /\D/g,"" );if ( this.$root.hasClass( "sm-rtl" ) ){this.opts.rightToLeftSubMenus=true}var p=".smartmenus";this.$root.data( "smartmenus",this ).attr( "data-smartmenus-id",this.rootId ).dataSM( "level",1 ).bind( g( [["mouseover focusin",a.proxy( this.rootOver,this )],["mouseout focusout",a.proxy( this.rootOut,this )]],p ) ).delegate( "a",g( [["mouseenter",a.proxy( this.itemEnter,this )],["mouseleave",a.proxy( this.itemLeave,this )],["mousedown",a.proxy( this.itemDown,this )],["focus",a.proxy( this.itemFocus,this )],["blur",a.proxy( this.itemBlur,this )],["click",a.proxy( this.itemClick,this )],["touchend",a.proxy( this.itemTouchEnd,this )]],p ) ); p+=this.rootId;if ( this.opts.hideOnClick ){a( document ).bind( g( [["touchstart",a.proxy( this.docTouchStart,this )],["touchmove",a.proxy( this.docTouchMove,this )],["touchend",a.proxy( this.docTouchEnd,this )],["click",a.proxy( this.docClick,this )]],p ) )}a( window ).bind( g( [["resize orientationchange",a.proxy( this.winResize,this )]],p ) );if ( this.opts.subIndicators ){this.$subArrow=a( "" ).addClass( "sub-arrow" );if ( this.opts.subIndicatorsText ){this.$subArrow.html( this.opts.subIndicatorsText )}}h()}this.$firstSub=this.$root.find( "ul" ).each( function(){j.menuInit( a( this ) )} ).eq( 0 );this.$firstLink=this.$root.find( "a" ).eq( 0 );if ( this.opts.markCurrentItem ){var n=/( index|default )\.[^#\?\/]*/i,k=/#.*/,o=window.location.href.replace( n,"" ),m=o.replace( k,"" );this.$root.find( "a" ).each( function(){var q=this.href.replace( n,"" ),r=a( this );if ( q==o||q==m ){r.addClass( "current" );if ( j.opts.markCurrentTree ){r.parent().parentsUntil( "[data-smartmenus-id]","li" ).children( "a" ).addClass( "current" )}}} )}},destroy:function(){this.menuHideAll(); var k=".smartmenus";this.$root.removeData( "smartmenus" ).removeAttr( "data-smartmenus-id" ).removeDataSM( "level" ).unbind( k ).undelegate( k );k+=this.rootId;a( document ).unbind( k );a( window ).unbind( k );if ( this.opts.subIndicators ){this.$subArrow=null}var j=this;a.each( this.subMenus,function(){if ( this.hasClass( "mega-menu" ) ){this.find( "ul" ).removeDataSM( "in-mega" )}if ( this.dataSM( "shown-before" ) ){if ( j.opts.subMenusMinWidth||j.opts.subMenusMaxWidth ){this.css( {width:"",minWidth:"",maxWidth:""} ).removeClass( "sm-nowrap" )}if ( this.dataSM( "scroll-arrows" ) ){this.dataSM( "scroll-arrows" ).remove()}this.css( {zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""} )}if ( j.opts.subIndicators ){this.dataSM( "parent-a" ).removeClass( "has-submenu" ).children( "span.sub-arrow" ).remove()}this.removeDataSM( "shown-before" ).removeDataSM( "ie-shim" ).removeDataSM( "scroll-arrows" ).removeDataSM( "parent-a" ).removeDataSM( "level" ).removeDataSM( "beforefirstshowfired" ).parent().removeDataSM( "sub" )} );if ( this.opts.markCurrentItem ){this.$root.find( "a.current" ).removeClass( "current" ) }this.$root=null;this.$firstLink=null;this.$firstSub=null;if ( this.$disableOverlay ){this.$disableOverlay.remove();this.$disableOverlay=null}b.splice( a.inArray( this,b ),1 )},disable:function( j ){if ( !this.disabled ){this.menuHideAll();if ( !j&&!this.opts.isPopup&&this.$root.is( ":visible" ) ){var k=this.$root.offset();this.$disableOverlay=a( '
' ).css( {position:"absolute",top:k.top,left:k.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex( true ),opacity:0} ).appendTo( document.body )}this.disabled=true}},docClick:function( j ){if ( this.isTouchScrolling ){this.isTouchScrolling=false;return}if ( this.visibleSubMenus.length&&!a.contains( this.$root[0],j.target )||a( j.target ).is( "a" ) ){this.menuHideAll()}},docTouchEnd:function( k ){if ( !this.lastTouch ){return}if ( this.visibleSubMenus.length&&( this.lastTouch.x2===undefined||this.lastTouch.x1==this.lastTouch.x2 )&&( this.lastTouch.y2===undefined||this.lastTouch.y1==this.lastTouch.y2 )&&( !this.lastTouch.target||!a.contains( this.$root[0],this.lastTouch.target ) ) ){if ( this.hideTimeout ){clearTimeout( this.hideTimeout ); this.hideTimeout=0}var j=this;this.hideTimeout=setTimeout( function(){j.menuHideAll()},350 )}this.lastTouch=null},docTouchMove:function( k ){if ( !this.lastTouch ){return}var j=k.originalEvent.touches[0];this.lastTouch.x2=j.pageX;this.lastTouch.y2=j.pageY},docTouchStart:function( k ){var j=k.originalEvent.touches[0];this.lastTouch={x1:j.pageX,y1:j.pageY,target:j.target}},enable:function(){if ( this.disabled ){if ( this.$disableOverlay ){this.$disableOverlay.remove();this.$disableOverlay=null}this.disabled=false}},getClosestMenu:function( k ){var j=a( k ).closest( "ul" );while( j.dataSM( "in-mega" ) ){j=j.parent().closest( "ul" )}return j[0]||null},getHeight:function( j ){return this.getOffset( j,true )},getOffset:function( l,j ){var k;if ( l.css( "display" )=="none" ){k={position:l[0].style.position,visibility:l[0].style.visibility};l.css( {position:"absolute",visibility:"hidden"} ).show()}var m=l[0].getBoundingClientRect&&l[0].getBoundingClientRect(),n=m&&( j?m.height||m.bottom-m.top:m.width||m.right-m.left );if ( !n&&n!==0 ){n=j?l[0].offsetHeight:l[0].offsetWidth }if ( k ){l.hide().css( k )}return n},getStartZIndex:function( j ){var k=parseInt( this[j?"$root":"$firstSub"].css( "z-index" ) );if ( !j&&isNaN( k ) ){k=parseInt( this.$root.css( "z-index" ) )}return !isNaN( k )?k:1},getTouchPoint:function( j ){return j.touches&&j.touches[0]||j.changedTouches&&j.changedTouches[0]||j},getViewport:function( j ){var k=j?"Height":"Width",m=document.documentElement["client"+k],l=window["inner"+k];if ( l ){m=Math.min( m,l )}return m},getViewportHeight:function(){return this.getViewport( true )},getViewportWidth:function(){return this.getViewport()},getWidth:function( j ){return this.getOffset( j )},handleEvents:function(){return !this.disabled&&this.isCSSOn()},handleItemEvents:function( j ){return this.handleEvents()&&!this.isLinkInMegaMenu( j )},isCollapsible:function(){return this.$firstSub.css( "position" )=="static"},isCSSOn:function(){return this.$firstLink.css( "display" )=="block"},isFixed:function(){var j=this.$root.css( "position" )=="fixed";if ( !j ){this.$root.parentsUntil( "body" ).each( function(){if ( a( this ).css( "position" )=="fixed" ){j=true; return false}} )}return j},isLinkInMegaMenu:function( j ){return !j.parent().parent().dataSM( "level" )},isTouchMode:function(){return !e||this.isCollapsible()},itemActivate:function( m ){var o=m.parent(),k=o.parent(),n=k.dataSM( "level" );if ( n>1&&( !this.activatedItems[n-2]||this.activatedItems[n-2][0]!=k.dataSM( "parent-a" )[0] ) ){var j=this;a( k.parentsUntil( "[data-smartmenus-id]","ul" ).get().reverse() ).add( k ).each( function(){j.itemActivate( a( this ).dataSM( "parent-a" ) )} )}if ( this.visibleSubMenus.length>n ){this.menuHideSubMenus( !this.activatedItems[n-1]||this.activatedItems[n-1][0]!=m[0]?n-1:n )}this.activatedItems[n-1]=m;this.visibleSubMenus[n-1]=k;if ( this.$root.triggerHandler( "activate.smapi",m[0] )===false ){return}var l=o.dataSM( "sub" );if ( l&&( this.isTouchMode()||( !this.opts.showOnClick||this.clickActivated ) ) ){this.menuShow( l )}},itemBlur:function( k ){var j=a( k.currentTarget );if ( !this.handleItemEvents( j ) ){return}this.$root.triggerHandler( "blur.smapi",j[0] )},itemClick:function( l ){if ( this.isTouchScrolling ){this.isTouchScrolling=false; l.stopPropagation();return false}var k=a( l.currentTarget );if ( !this.handleItemEvents( k ) ){return}k.removeDataSM( "mousedown" );if ( this.$root.triggerHandler( "click.smapi",k[0] )===false ){return false}var j=k.parent().dataSM( "sub" );if ( this.isTouchMode() ){if ( k.dataSM( "href" ) ){k.attr( "href",k.dataSM( "href" ) ).removeDataSM( "href" )}if ( j&&( !j.dataSM( "shown-before" )||!j.is( ":visible" ) ) ){this.itemActivate( k );if ( j.is( ":visible" ) ){return false}}}else{if ( this.opts.showOnClick&&k.parent().parent().dataSM( "level" )==1&&j ){this.clickActivated=true;this.menuShow( j );return false}}if ( k.hasClass( "disabled" ) ){return false}if ( this.$root.triggerHandler( "select.smapi",k[0] )===false ){return false}},itemDown:function( k ){var j=a( k.currentTarget );if ( !this.handleItemEvents( j ) ){return}j.dataSM( "mousedown",true )},itemEnter:function( l ){var k=a( l.currentTarget );if ( !this.handleItemEvents( k ) ){return}if ( !this.isTouchMode() ){if ( this.showTimeout ){clearTimeout( this.showTimeout );this.showTimeout=0}var j=this;this.showTimeout=setTimeout( function(){j.itemActivate( k ) },this.opts.showOnClick&&k.parent().parent().dataSM( "level" )==1?1:this.opts.showTimeout )}this.$root.triggerHandler( "mouseenter.smapi",k[0] )},itemFocus:function( k ){var j=a( k.currentTarget );if ( !this.handleItemEvents( j ) ){return}if ( ( !this.isTouchMode()||!j.dataSM( "mousedown" ) )&&( !this.activatedItems.length||this.activatedItems[this.activatedItems.length-1][0]!=j[0] ) ){this.itemActivate( j )}this.$root.triggerHandler( "focus.smapi",j[0] )},itemLeave:function( k ){var j=a( k.currentTarget );if ( !this.handleItemEvents( j ) ){return}if ( !this.isTouchMode() ){if ( j[0].blur ){j[0].blur()}if ( this.showTimeout ){clearTimeout( this.showTimeout );this.showTimeout=0}}j.removeDataSM( "mousedown" );this.$root.triggerHandler( "mouseleave.smapi",j[0] )},itemTouchEnd:function( l ){var k=a( l.currentTarget );if ( !this.handleItemEvents( k ) ){return}var j=k.parent().dataSM( "sub" );if ( k.attr( "href" ).charAt( 0 )!=="#"&&j&&( !j.dataSM( "shown-before" )||!j.is( ":visible" ) ) ){k.dataSM( "href",k.attr( "href" ) );k.attr( "href","#" )}},menuFixLayout:function( j ){if ( !j.dataSM( "shown-before" ) ){j.hide().dataSM( "shown-before",true ) }},menuHide:function( k ){if ( this.$root.triggerHandler( "beforehide.smapi",k[0] )===false ){return}k.stop( true,true );if ( k.is( ":visible" ) ){var j=function(){k.css( "z-index","" )};if ( this.isCollapsible() ){if ( this.opts.collapsibleHideFunction ){this.opts.collapsibleHideFunction.call( this,k,j )}else{k.hide( this.opts.collapsibleHideDuration,j )}}else{if ( this.opts.hideFunction ){this.opts.hideFunction.call( this,k,j )}else{k.hide( this.opts.hideDuration,j )}}if ( k.dataSM( "ie-shim" ) ){k.dataSM( "ie-shim" ).remove()}if ( k.dataSM( "scroll" ) ){this.menuScrollStop( k );k.css( {"touch-action":"","-ms-touch-action":""} ).unbind( ".smartmenus_scroll" ).removeDataSM( "scroll" ).dataSM( "scroll-arrows" ).hide()}k.dataSM( "parent-a" ).removeClass( "highlighted" );var l=k.dataSM( "level" );this.activatedItems.splice( l-1,1 );this.visibleSubMenus.splice( l-1,1 );this.$root.triggerHandler( "hide.smapi",k[0] )}},menuHideAll:function(){if ( this.showTimeout ){clearTimeout( this.showTimeout );this.showTimeout=0}this.menuHideSubMenus();if ( this.opts.isPopup ){this.$root.stop( true,true ); if ( this.$root.is( ":visible" ) ){if ( this.opts.hideFunction ){this.opts.hideFunction.call( this,this.$root )}else{this.$root.hide( this.opts.hideDuration )}if ( this.$root.dataSM( "ie-shim" ) ){this.$root.dataSM( "ie-shim" ).remove()}}}this.activatedItems=[];this.visibleSubMenus=[];this.clickActivated=false;this.zIndexInc=0},menuHideSubMenus:function( k ){if ( !k ){k=0}for( var j=this.visibleSubMenus.length-1;j>k;j-- ){this.menuHide( this.visibleSubMenus[j] )}},menuIframeShim:function( j ){if ( d&&this.opts.overlapControlsInIE&&!j.dataSM( "ie-shim" ) ){j.dataSM( "ie-shim",a( "" ).attr( {src:"javascript:0",tabindex:-9} ).css( {position:"absolute",top:"auto",left:"0",opacity:0,border:"0"} ) )}},menuInit:function( j ){if ( !j.dataSM( "in-mega" ) ){this.subMenus.push( j );if ( j.hasClass( "mega-menu" ) ){j.find( "ul" ).dataSM( "in-mega",true )}var l=2,k=j[0];while( ( k=k.parentNode.parentNode )!=this.$root[0] ){l++}j.dataSM( "parent-a",j.prevAll( "a" ).eq( -1 ) ).dataSM( "level",l ).parent().dataSM( "sub",j );if ( this.opts.subIndicators ){j.dataSM( "parent-a" ).addClass( "has-submenu" )[this.opts.subIndicatorsPos]( this.$subArrow.clone() ) }}},menuPosition:function( G ){var p=G.dataSM( "parent-a" ),A=G.parent().parent(),j=G.dataSM( "level" ),r=this.getWidth( G ),F=this.getHeight( G ),s=p.offset(),m=s.left,k=s.top,o=this.getWidth( p ),B=this.getHeight( p ),D=a( window ),t=D.scrollLeft(),q=D.scrollTop(),v=this.getViewportWidth(),H=this.getViewportHeight(),u=A.hasClass( "sm" )&&!A.hasClass( "sm-vertical" ),n=j==2?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,l=j==2?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY,z,w;if ( u ){z=this.opts.rightToLeftSubMenus?o-r-n:n;w=this.opts.bottomToTopSubMenus?-F-l:B+l}else{z=this.opts.rightToLeftSubMenus?n-r:o-n;w=this.opts.bottomToTopSubMenus?B-l-F:l}if ( this.opts.keepInViewport&&!this.isCollapsible() ){var J=m+z,I=k+w;if ( this.opts.rightToLeftSubMenus&&Jq+H+0.49||IH+0.49 ){var C=this;if ( !G.dataSM( "scroll-arrows" ) ){G.dataSM( "scroll-arrows",a( [a( '' )[0],a( '' )[0]] ).bind( {mouseenter:function(){G.dataSM( "scroll" ).up=a( this ).hasClass( "scroll-up" ); C.menuScroll( G )},mouseleave:function( x ){C.menuScrollStop( G );C.menuScrollOut( G,x )},"mousewheel DOMMouseScroll":function( x ){x.preventDefault()}} ).insertAfter( G ) )}var E=".smartmenus_scroll";G.dataSM( "scroll",{step:1,itemH:B,subH:F,arrowDownH:this.getHeight( G.dataSM( "scroll-arrows" ).eq( 1 ) )} ).bind( g( [["mouseover",function( x ){C.menuScrollOver( G,x )}],["mouseout",function( x ){C.menuScrollOut( G,x )}],["mousewheel DOMMouseScroll",function( x ){C.menuScrollMousewheel( G,x )}]],E ) ).dataSM( "scroll-arrows" ).css( {top:"auto",left:"0",marginLeft:z+( parseInt( G.css( "border-left-width" ) )||0 ),width:r-( parseInt( G.css( "border-left-width" ) )||0 )-( parseInt( G.css( "border-right-width" ) )||0 ),zIndex:G.css( "z-index" )} ).eq( u&&this.opts.bottomToTopSubMenus?0:1 ).show();if ( this.isFixed() ){G.css( {"touch-action":"none","-ms-touch-action":"none"} ).bind( g( [[c()?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp",function( x ){C.menuScrollTouch( G,x )}]],E ) )}}}G.css( {top:"auto",left:"0",marginLeft:z,marginTop:w-B} ); this.menuIframeShim( G );if ( G.dataSM( "ie-shim" ) ){G.dataSM( "ie-shim" ).css( {zIndex:G.css( "z-index" ),width:r,height:F,marginLeft:z,marginTop:w-B} )}},menuScroll:function( p,k,l ){var n=p.dataSM( "scroll" ),o=p.dataSM( "scroll-arrows" ),q=parseFloat( p.css( "margin-top" ) ),m=n.up?n.upEnd:n.downEnd,r;if ( !k&&n.velocity ){n.velocity*=0.9;r=n.velocity;if ( r<0.5 ){this.menuScrollStop( p );return}}else{r=l||( k||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor( n.step ) )}var j=p.dataSM( "level" );if ( this.visibleSubMenus.length>j ){this.menuHideSubMenus( j-1 )}var t=n.up&&m<=q||!n.up&&m>=q?q:( Math.abs( m-q )>r?q+( n.up?r:-r ):m );p.add( p.dataSM( "ie-shim" ) ).css( "margin-top",t );if ( e&&( n.up&&t>n.downEnd||!n.up&&t0;if ( k.dataSM( "scroll-arrows" ).eq( j?0:1 ).is( ":visible" ) ){k.dataSM( "scroll" ).up=j;this.menuScroll( k,true )}}l.preventDefault()},menuScrollOut:function( j,k ){if ( e ){if ( !/^scroll-( up|down )/.test( ( k.relatedTarget||"" ).className )&&( j[0]!=k.relatedTarget&&!a.contains( j[0],k.relatedTarget )||this.getClosestMenu( k.relatedTarget )!=j[0] ) ){j.dataSM( "scroll-arrows" ).css( "visibility","hidden" )}}},menuScrollOver:function( k,l ){if ( e ){if ( !/^scroll-( up|down )/.test( l.target.className )&&this.getClosestMenu( l.target )==k[0] ){this.menuScrollRefreshData( k );var j=k.dataSM( "scroll" );k.dataSM( "scroll-arrows" ).eq( 0 ).css( "margin-top",j.upEnd ).end().eq( 1 ).css( "margin-top",j.downEnd+j.subH-j.arrowDownH ).end().css( "visibility","visible" )}}},menuScrollRefreshData:function( k ){var j=k.dataSM( "scroll" ),m=a( window ),l=m.scrollTop()-k.dataSM( "parent-a" ).offset().top-j.itemH;a.extend( j,{upEnd:l,downEnd:l+this.getViewportHeight()-j.subH} )},menuScrollStop:function( j ){if ( this.scrollTimeout ){clearTimeout( this.scrollTimeout ); this.scrollTimeout=0;a.extend( j.dataSM( "scroll" ),{step:1,velocity:0} );return true}},menuScrollTouch:function( m,n ){n=n.originalEvent;if ( i( n ) ){var j=this.getTouchPoint( n );if ( this.getClosestMenu( j.target )==m[0] ){var l=m.dataSM( "scroll" );if ( /( start|down )$/i.test( n.type ) ){if ( this.menuScrollStop( m ) ){n.preventDefault();this.isTouchScrolling=true}else{this.isTouchScrolling=false}this.menuScrollRefreshData( m );a.extend( l,{touchY:j.pageY,touchTimestamp:n.timeStamp,velocity:0} )}else{if ( /move$/i.test( n.type ) ){var k=l.touchY;if ( k!==undefined&&k!=j.pageY ){this.isTouchScrolling=true;a.extend( l,{up:k 0 ){l.velocity*=0.5;this.menuScrollStop( m );this.menuScroll( m );n.preventDefault()}delete l.touchY}}}}}},menuShow:function( k ){if ( !k.dataSM( "beforefirstshowfired" ) ){k.dataSM( "beforefirstshowfired",true ); if ( this.$root.triggerHandler( "beforefirstshow.smapi",k[0] )===false ){return}}if ( this.$root.triggerHandler( "beforeshow.smapi",k[0] )===false ){return}this.menuFixLayout( k );k.stop( true,true );if ( !k.is( ":visible" ) ){k.css( "z-index",this.zIndexInc=( this.zIndexInc||this.getStartZIndex() )+1 );if ( this.opts.keepHighlighted||this.isCollapsible() ){k.dataSM( "parent-a" ).addClass( "highlighted" )}if ( this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth ){k.css( {width:"auto",minWidth:"",maxWidth:""} ).addClass( "sm-nowrap" );if ( this.opts.subMenusMinWidth ){k.css( "min-width",this.opts.subMenusMinWidth )}if ( this.opts.subMenusMaxWidth ){var l=this.getWidth( k );k.css( "max-width",this.opts.subMenusMaxWidth );if ( l>this.getWidth( k ) ){k.removeClass( "sm-nowrap" ).css( "width",this.opts.subMenusMaxWidth )}}}this.menuPosition( k );if ( k.dataSM( "ie-shim" ) ){k.dataSM( "ie-shim" ).insertBefore( k )}var j=function(){k.css( "overflow","" )};if ( this.isCollapsible() ){if ( this.opts.collapsibleShowFunction ){this.opts.collapsibleShowFunction.call( this,k,j ) }else{k.show( this.opts.collapsibleShowDuration,j )}}else{if ( this.opts.showFunction ){this.opts.showFunction.call( this,k,j )}else{k.show( this.opts.showDuration,j )}}this.visibleSubMenus[k.dataSM( "level" )-1]=k;this.$root.triggerHandler( "show.smapi",k[0] )}},popupHide:function( j ){if ( this.hideTimeout ){clearTimeout( this.hideTimeout );this.hideTimeout=0}var k=this;this.hideTimeout=setTimeout( function(){k.menuHideAll()},j?1:this.opts.hideTimeout )},popupShow:function( m,l ){if ( !this.opts.isPopup ){alert( 'SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.' );return}if ( this.hideTimeout ){clearTimeout( this.hideTimeout );this.hideTimeout=0}this.menuFixLayout( this.$root );this.$root.stop( true,true );if ( !this.$root.is( ":visible" ) ){this.$root.css( {left:m,top:l} );this.menuIframeShim( this.$root );if ( this.$root.dataSM( "ie-shim" ) ){this.$root.dataSM( "ie-shim" ).css( {zIndex:this.$root.css( "z-index" ),width:this.getWidth( this.$root ),height:this.getHeight( this.$root ),left:m,top:l} ).insertBefore( this.$root ) }var k=this,j=function(){k.$root.css( "overflow","" )};if ( this.opts.showFunction ){this.opts.showFunction.call( this,this.$root,j )}else{this.$root.show( this.opts.showDuration,j )}this.visibleSubMenus[0]=this.$root}},refresh:function(){this.menuHideAll();this.$root.find( "ul" ).each( function(){var j=a( this );if ( j.dataSM( "scroll-arrows" ) ){j.dataSM( "scroll-arrows" ).remove()}} ).removeDataSM( "in-mega" ).removeDataSM( "shown-before" ).removeDataSM( "ie-shim" ).removeDataSM( "scroll-arrows" ).removeDataSM( "parent-a" ).removeDataSM( "level" ).removeDataSM( "beforefirstshowfired" );this.$root.find( "a.has-submenu" ).removeClass( "has-submenu" ).parent().removeDataSM( "sub" );if ( this.opts.subIndicators ){this.$root.find( "span.sub-arrow" ).remove()}if ( this.opts.markCurrentItem ){this.$root.find( "a.current" ).removeClass( "current" )}this.subMenus=[];this.init( true )},rootOut:function( k ){if ( !this.handleEvents()||this.isTouchMode()||k.target==this.$root[0] ){return}if ( this.hideTimeout ){clearTimeout( this.hideTimeout );this.hideTimeout=0 }if ( !this.opts.showOnClick||!this.opts.hideOnClick ){var j=this;this.hideTimeout=setTimeout( function(){j.menuHideAll()},this.opts.hideTimeout )}},rootOver:function( j ){if ( !this.handleEvents()||this.isTouchMode()||j.target==this.$root[0] ){return}if ( this.hideTimeout ){clearTimeout( this.hideTimeout );this.hideTimeout=0}},winResize:function( j ){if ( !this.handleEvents() ){if ( this.$disableOverlay ){var k=this.$root.offset();this.$disableOverlay.css( {top:k.top,left:k.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()} )}return}if ( !this.isCollapsible()&&( !( "onorientationchange" in window )||j.type=="orientationchange" ) ){if ( this.activatedItems.length ){this.activatedItems[this.activatedItems.length-1][0].blur()}this.menuHideAll()}}}} );a.fn.dataSM=function( j,k ){if ( k ){return this.data( j+"_smartmenus",k )}return this.data( j+"_smartmenus" )};a.fn.removeDataSM=function( j ){return this.removeData( j+"_smartmenus" )};a.fn.smartmenus=function( k ){if ( typeof k=="string" ){var j=arguments,m=k;Array.prototype.shift.call( j ); return this.each( function(){var n=a( this ).data( "smartmenus" );if ( n&&n[m] ){n[m].apply( n,j )}} )}var l=a.extend( {},a.fn.smartmenus.defaults,k );return this.each( function(){new a.SmartMenus( this,l )} )};a.fn.smartmenus.defaults={isPopup:false,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:true,subIndicatorsPos:"prepend",subIndicatorsText:"+",scrollStep:50,scrollInterval:30,scrollAccelerate:true,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function( k,j ){k.fadeOut( 200,j )},collapsibleShowDuration:0,collapsibleShowFunction:function( k,j ){k.slideDown( 200,j )},collapsibleHideDuration:0,collapsibleHideFunction:function( k,j ){k.slideUp( 200,j )},showOnClick:false,hideOnClick:true,keepInViewport:true,keepHighlighted:true,markCurrentItem:false,markCurrentTree:true,rightToLeftSubMenus:false,bottomToTopSubMenus:false,overlapControlsInIE:true}} )( jQuery );