(function(b,a){b.fn.dnnActionMenu=function(c){var e=b.extend({},b.fn.dnnActionMenu.defaultOptions,c),d=this;d.each(function(){var i=b(this);function h(m,j,l){var k=m.children("."+e.borderClassName);if(k.length===0){k=b('<div class="'+e.borderClassName+'"></div>').prependTo(m).css({opacity:0})}m.attr("style","z-index:904;");if(l){m.find(e.menuActionSelector).fadeTo(e.fadeSpeed,j)}m.children("."+e.borderClassName).fadeTo(e.fadeSpeed,j)}function f(l,j,k){l.removeAttr("style");l.children("."+e.borderClassName).stop().fadeTo(e.fadeSpeed,0);if(k){l.find(e.menuActionSelector).stop().fadeTo(e.fadeSpeed,j)}}function g(l){var o=i.find(e.menuSelector).show(),m=o.outerHeight(),s=o.outerWidth(),j=b(a).height(),k=b(a).width(),t=l.offset().top,q=l.offset().left,u=isNaN(parseInt(b(document.body).css("margin-top")))?0:parseInt(b(document.body).css("margin-top")),n={left:false,right:false,top:false,bottom:false};n.top=((t-b(a).scrollTop()-u)-m)>0;n.bottom=((j-((t-b(a).scrollTop())+l.height()))-m)>0;n.left=(((q-b(a).scrollLeft())+l.width())-s)>0;n.right=((k-(q-b(a).scrollLeft()))-s)>0;var p={},r={};if(!n.bottom&&n.top){p.y="bottom";r.y="top"}else{p.y="top";r.y="bottom"}if(!n.right&&n.left){p.x="right";r.x="right"}else{p.x="left";r.x="left"}o.position({my:p.x+" "+p.y,at:r.x+" "+r.y,of:l,collision:"none"})}if(i.find(e.menuSelector).length>0){i.hoverIntent({sensitivity:e.hoverSensitivity,timeout:e.hoverTimeout,interval:e.hoverInterval,over:function(){h(b(this).data("intentExpressed",true),1,true)},out:function(){f(b(this).data("intentExpressed",false),e.defaultOpacity,true)}});i.hover(function(){h(b(this),e.defaultOpacity,false)},function(){var j=b(this);if(!j.data("intentExpressed")){f(j,0,false)}});i.find(e.menuActionSelector).css({opacity:e.defaultOpacity});i.find(e.menuWrapSelector).hoverIntent({sensitivity:e.hoverSensitivity,timeout:e.hoverTimeout,interval:e.hoverInterval,over:function(){g(b(this));var k=i.find(e.menuSelector);if(!b.support.cssFloat&&k.prev("iframe").length==0){var j=b('<iframe frameborder="0"></iframe>');k.before(j);j.css({position:"absolute",width:k.outerWidth()+"px",height:k.outerHeight()+"px",left:k.position().left+"px",top:k.position().top+"px",opacity:0})}k.fadeTo(e.fadeSpeed,1)},out:function(){if(!b.support.cssFloat){i.find(e.menuSelector).prev("iframe").remove()}i.find(e.menuSelector).stop().fadeTo(e.fadeSpeed,0).hide()}});i.find(e.menuSelector).children().css({opacity:1});i.find(e.menuWrapSelector).draggable({containment:i.children().eq(1),start:function(j,k){i.find(e.menuSelector).hide()},stop:function(j,k){g(b(this));i.find(e.menuSelector).show()}})}});return d};b.fn.dnnActionMenu.defaultOptions={menuWrapSelector:".dnnActionMenu",menuActionSelector:".dnnActionMenuTag",menuSelector:"ul.dnnActionMenuBody",defaultOpacity:0.3,fadeSpeed:"fast",borderClassName:"dnnActionMenuBorder",hoverSensitivity:2,hoverTimeout:200,hoverInterval:200};b(document).ready(function(){b(".DnnModule").dnnActionMenu()})})(jQuery,window);