﻿(function(a){a.fn.dnnControlPanel=function(c){var d=a.extend({},a.fn.dnnControlPanel.defaultOptions,c),b=this;return b.each(function(){var f=a(this);f.wrap(function(){return d.wrappingHtml});a('[id$="CommonTasksPanel"]').detach().appendTo("#dnnCommonTasks .megaborder");a('[id$="CurrentPagePanel"]').detach().appendTo("#dnnCurrentPage .megaborder");a('[id$="AdminPanel"]').detach().appendTo("#dnnOtherTools .megaborder");var j=a("#dnnCPWrap");if(j.hasClass("Pinned")){j.parent().css({paddingBottom:"0"})}else{a(document.body).css({marginTop:j.outerHeight()})}a.fn.dnnControlPanel.show=function(){f.parents(d.controlPanelWrapper).slideDown()};a.fn.dnnControlPanel.hide=function(){f.parents(d.controlPanelWrapper).slideUp()};var l=false,f=a(this);function i(){l=true}function h(){g();a(this).parent().find(d.menuBorderSelector).stop().fadeTo("fast",1).show()}function g(){f.find(d.menuBorderSelector).stop().fadeTo("fast",0,function(){a(this).hide()})}var e={sensitivity:2,interval:200,over:h,timeout:100,out:function(){return null}};var k={sensitivity:2,interval:1,over:function(){return},timeout:300,out:function(){if(l){g()}}};f.find(d.menuBorderSelector).css({opacity:"0"});f.find(d.menuBorderSelector).find(d.primaryActionSelector).css({opacity:1});f.find(d.menuItemSelector).mouseenter(i);a(document).dblclick(function(){if(!l){g()}});f.dblclick(function(m){m.stopPropagation()});a(document).keyup(function(m){if(m.keyCode==27){g()}});f.find(d.menuItemActionSelector).hoverIntent(e);f.find(d.menuItemSelector).hoverIntent(k);f.find(d.enableAutohideOnFocusSelector).focus(function(){l=true});f.find(d.persistOnMouseoverSelector).live("mouseover",function(){l=false});f.find(d.persistOnFocusSelector).live("focus",function(){l=false})})};a.fn.dnnControlPanel.defaultOptions={wrappingHtml:'<div id="dnnCPWrap"><div id="dnnCPWrapLeft"><div id="dnnCPWrapRight"></div></div></div>',persistOnFocusSelector:"select, input",persistOnMouseoverSelector:".rcbSlide li",enableAutohideOnFocusSelector:".dnnadminmega .megaborder",menuItemActionSelector:".dnnadminmega > li > a",menuItemSelector:".dnnadminmega > li",menuBorderSelector:".megaborder",primaryActionSelector:".dnnPrimaryAction",controlPanelWrapper:"#dnnCPWrap"};a(document).ready(function(){a(".dnnControlPanel").dnnControlPanel()})})(jQuery);
