(function(a){var f,h;a.fn.Ribbon=function(j){function k(b){a(".menu li a:first").addClass("active");a(".menu li ul").hide();a(".menu li a:first").parent().children("ul:first").show();a(".menu li a:first").parent().children("ul:first").addClass("submenu");a(".menu li > a").click(function(){l(this)});a(".orbButton").click(function(){m(b.backStage)});a(".orb ul").hide();a(".orb ul ul").hide();a(".orb li ul li ul").show();a(".orb li li ul").each(function(){a(this).prepend('
'+ a(this).parent().children("a:first").text()+"
")});a(".orb li li a").each(function(){a(this).parent().children("ul").length>0&&a(this).addClass("arrow")});a(".orb .ribbon-backstage a").live("click",function(){a(".orb ul").fadeOut("fast")});a(".ribbon-list div").click(function(c){var e=a(this).parent().width(),g=c.pageX>a(this).offset().left&&c.pageXa(this).offset().top&&c.pageYa(".ribbon-list div ul:visible").parent().offset().left+a(".ribbon-list div ul:visible").parent().width(),g=c.pageYa(".ribbon-list div ul:visible").parent().offset().top+a(".ribbon-list div ul:visible").parent().height();if(e||g){a(".ribbon-list div ul:visible").each(function(){a(this).fadeOut("fast")});a(".ribbon-list div").css("background-image","")}})});a(".orb li li a").mouseover(function(){i(this)});a(".menu li > a").dblclick(function(){a("ul .submenu").animate({height:"hide"});a("body").animate({paddingTop:a(this).parent().parent().parent().parent().height()});h=true})}function n(){a(".menu li a").removeClass("active"); a(".menu ul").removeClass("submenu");a(".menu li ul").hide()}function l(b){a(".orb ul").fadeOut("fast");a(b).next().css("display");n();a(b).addClass("active");a(b).parent().children("ul:first").addClass("submenu");a(b).parent().children("ul:first").show();a("body").css("padding-top","120px");h=false}function i(b,c){if(!d.backStage)if((a(b).parent().children("ul").css("display")=="none"||a(b).parent().children("ul").length==0)&&a(b).parent().parent().parent().parent().hasClass("orb")){a(".orb li li ul").fadeOut("fast"); a(b).parent().children("ul").length>0&&a(b).parent().children("ul").fadeIn("fast")}if(d.backStage){if(a(b).parent().children("ul").length==0&&a("ul.ribbon-backstage .ribbon-backstage-firstLevel .ribbon-backstage-subMenu:first:hidden").length>0&&a(b).parent().parent().parent().parent().hasClass("orb")){a(".orb li li ul").fadeOut("fast");a(".orb li li > div").fadeOut("fast");a("ul.ribbon-backstage .ribbon-backstage-firstLevel:first .ribbon-backstage-subMenu:first").fadeIn("fast");a("ul.ribbon-backstage .ribbon-backstage-firstLevel:first div").fadeIn("fast")}if(a(b).parent().children("ul").css("display")== "none"&&a(b).parent().children("ul").length>0&&a(b).parent().parent().parent().parent().hasClass("orb")){a(".orb li li ul").fadeOut("fast");a(".orb li li > div").fadeOut("fast");a(b).parent().children("ul").fadeIn("fast");a(b).parent().children("div").fadeIn("fast")}if(c){a(".orb li li ul").hide();a(".orb li li > div").hide();a(b).parent().children("ul").fadeIn("fast");a(b).parent().children("div").fadeIn("fast")}}}function m(b){if(b){a("ul.ribbon-backstage .ribbon-backstage-firstLevel .ribbon-backstage-subMenu").height(a(window).height()* 0.9);a("ul.ribbon-backstage .ribbon-backstage-firstLevel div.ribbon-backstage-rightColumnWide").height(a(window).height()*0.9).width(a(window).width());a("ul.ribbon-backstage .ribbon-backstage-firstLevel div.ribbon-backstage-rightColumnSmall").parent().children("ul").width(a(window).width()).addClass("ribbon-backstage-leftColumnWide");a("ul.ribbon-backstage .ribbon-backstage-firstLevel div.ribbon-backstage-rightColumnSmall").height(a(window).height()*0.9).width("200px");a("ul.ribbon-backstage .ribbon-backstage-firstLevel div.ribbon-backstage-rightColumnSmall").css("left", a(window).width()-200).css("line-height","17px");a(".orb ul").animate({opacity:"toggle"},"fast");i(a(".orb li li a:first"),true)}else a(".orb ul").animate({opacity:"toggle"},"fast")}function o(b){b.altKey&&a('div[rel="accesskeyhelper"]').each(function(){a(this).css("top",a(this).parent().offset().top).css("left",a(this).parent().offset().left-20+a(this).parent().width());a(this).show()})}function p(){a('div[rel="accesskeyhelper"]').hide()}var d=a.extend({theme:"windows7",backStage:false},j||{});a(".ribbon a").each(function(){a(this).attr("accesskey")&& a(this).append('
'+a(this).attr("accesskey")+"
")});a("head").append('" />');f||k(d);a(document).keydown(function(b){o(b)}); a(document).keyup(function(b){p(b)});a(".ribbon").parents().click(function(b){var c=b.pageXa(".orb ul:first").offset().left+a(".orb ul:first").width();b=b.pageYa(".orb ul:first").offset().top+a(".orb ul:first").height();if((c||b)&&!d.backStage)a(".orb ul").fadeOut("fast")});if(f){a(".orb li:first ul:first img:first").remove();a(".orb li:first ul:first img:last").remove();a('.ribbon-list div img[src*="/arrow_down.png"]').remove()}if(!d.backStage){a(".orb li:first ul:first").append('');a(".orb li:first ul:first").prepend('')}a(".ribbon-list div").each(function(){a(this).children("ul").length>0&&a(this).append('')});if(navigator.appVersion.indexOf("MSIE 6.0")>-1||navigator.appVersion.indexOf("MSIE 7.0")> -1){a("ul.menu li li div").css("width","90px");a("ul.menu").css("width","500px");a("ul.menu").css("float","left");a("ul.menu .submenu li div.ribbon-list").css("width","100px");a("ul.menu .submenu li div.ribbon-list div").css("width","100px")}a("a[href="+window.location.hash+"]").click();if(d.backStage){a("ul.ribbon .orb > li > ul").addClass("ribbon-backstage");a("ul.ribbon-backstage").width("3000px");a("ul.ribbon-backstage").height(a(document).height());a("ul.ribbon-backstage > li").width("130px"); a("ul.ribbon-backstage > li > a").width("125px");a("ul.ribbon-backstage > li").addClass("ribbon-backstage-firstLevel");a("ul.ribbon-backstage .ribbon-backstage-firstLevel > ul").addClass("ribbon-backstage-subMenu");a("ul.ribbon-backstage .ribbon-backstage-firstLevel .ribbon-backstage-subMenu > div").addClass("ribbon-backstage-subMenu-header")}a(".ribbon-backstage-rightColumnWide").hide();a(".ribbon-backstage-rightColumnSmall").hide();f=true}})(jQuery);