ribbonBG=new Image();ribbonBG.src="/media/ribbons/main_ribbon_bg.gif";ribbonLoadBG=new Image();ribbonLoadBG.src="/media/ribbons/loader.gif";var self;function Ribbon(g,e,f){self=this;this.baseURL="/System/Main_Navigation/";this.ribbonCont=g;this.mainNavEl=document.getElementById(e);this.parentEl=this.mainNavEl.parentNode;this.targetHeight=181;this.ribbonLayout;this.ribbonTimer;this.div=false;this.ribbonType;this.links=this.mainNavEl.getElementsByTagName("a");this.cacheArray=new Array();for(var h=0;h<this.links.length;h++){if(this.links[h].getAttribute("rel")){this.links[h].onmouseover=function(){if(el=document.getElementById("ribbonCont")){var a=document.getElementsByClassName("ribbonOn");if(a){a[0].className=a[0].className.replace(/ribbonOn/,"")}while(el.firstChild){el.removeChild(el.firstChild)}self.clearTimer();this.className+=" ribbonOn";var b=this.getAttribute("rel").split(".");self.ribbonType=b[1];self.getRibbon()}else{this.className+=" ribbonOn";var b=this.getAttribute("rel").split(".");self.ribbonType=b[1];self.initRibbon()}};this.links[h].onmouseout=function(){self.startTimer()}}}}Ribbon.prototype.initRibbon=function(){if(this.div!=false){this.deleteRibbon()}this.div=document.createElement("div");this.div.setAttribute("id","ribbonCont");this.topDiv=document.createElement("div");this.topDiv.setAttribute("id","ribbonTop");this.bottomDiv=document.createElement("div");this.bottomDiv.setAttribute("id","ribbonBottom");this.ribbonLoadImage=document.createElement("div");this.ribbonLoadImage.setAttribute("id","ribbonLoadAnimation");this.div.onmouseover=function(){ribbonObj.clearTimer()};this.div.onmouseout=function(){ribbonObj.startTimer()};this.div.appendChild(this.topDiv);this.div.appendChild(this.ribbonLoadImage);this.div.appendChild(this.bottomDiv);this.parentEl.insertBefore(this.div,this.mainNavEl.nextSibling);this.div.style.height=this.targetHeight/3+"px";if(this.ie6){this.hideSelect("hidden")}this.ribbonTimer=window.setTimeout("ribbonObj.growRibbon()",300)};Ribbon.prototype.getRibbon=function(){this.url=this.baseURL+this.ribbonType+".aspx";if(this.cacheArray[this.url]){this.showRibbonCache()}else{initRequest("GET",this.url,true,ribbonObj.showRibbon)}};Ribbon.prototype.showRibbon=function(){var d=this;if(ajax.readyState==4&&ajax.status==200){ribbonObj.cacheArray[ribbonObj.url]=ajax.responseText;ribbonObj.div.innerHTML=ajax.responseText;var c=document.getElementsByClassName("ribbonCont",ribbonObj.div.id)}};Ribbon.prototype.showRibbonCache=function(){this.div.innerHTML=this.cacheArray[this.url]};Ribbon.prototype.growRibbon=function(){if(this.ribbonTimer){clearTimeout(this.ribbonTimer)}if(this.div.style.display!="block"){this.div.style.display="block"}var b=this.div.offsetHeight;if(b<this.targetHeight){this.div.style.height=(b+20)+"px";this.ribbonTimer=window.setTimeout("ribbonObj.growRibbon()",15)}else{this.div.style.height=this.targetHeight+"px";this.div.style.background="url(/media/ribbons/main_ribbon_bg.gif) no-repeat top center";this.getRibbon()}};Ribbon.prototype.shrinkRibbon=function(){if(this.ribbonTimer){clearTimeout(this.ribbonTimer)}var b=this.div.offsetHeight;if(this.div.offsetHeight>0){this.div.style.height=(this.div.offsetHeight-10)+"px";this.ribbonTimer=window.setTimeout("ribbonObj.shrinkRibbon()",10)}else{this.deleteRibbon()}};Ribbon.prototype.deleteRibbon=function(){clearTimeout(this.ribbonTimer);clearTimeout(this.hideTimer);var b=document.getElementsByClassName("ribbonOn");if(b){b[0].className=b[0].className.replace("ribbonOn","")}if(this.div){this.parentEl.removeChild(this.div)}this.div=false;if(this.ie6){this.hideSelect("visible")}};Ribbon.prototype.startTimer=function(){this.hideTimer=window.setTimeout("ribbonObj.deleteRibbon()",200)};Ribbon.prototype.clearTimer=function(){clearTimeout(this.hideTimer)};Ribbon.prototype.hideSelect=function(c){for(var d=0;d<this.selectArray.length;d++){this.selectArray[d].style.visibility=c}};
