var detect=navigator.userAgent.toLowerCase();var OS,browser,version,total,thestring;function getBrowserInfo(){if(checkIt("konqueror")){browser="Konqueror";OS="Linux"}else{if(checkIt("safari")){browser="Safari"}else{if(checkIt("omniweb")){browser="OmniWeb"}else{if(checkIt("opera")){browser="Opera"}else{if(checkIt("webtv")){browser="WebTV"}else{if(checkIt("icab")){browser="iCab"}else{if(checkIt("msie")){browser="Internet Explorer"}else{if(!checkIt("compatible")){browser="Netscape Navigator";version=detect.charAt(8)}else{browser="An unknown browser"}}}}}}}}if(!version){version=detect.charAt(place+thestring.length)}if(!OS){if(checkIt("linux")){OS="Linux"}else{if(checkIt("x11")){OS="Unix"}else{if(checkIt("mac")){OS="Mac"}else{if(checkIt("win")){OS="Windows"}else{OS="an unknown operating system"}}}}}}function findPos(a){var b=curtop=0;if(a.offsetParent){b=a.offsetLeft;curtop=a.offsetTop;while(a=a.offsetParent){b+=a.offsetLeft;curtop+=a.offsetTop}}return[b,curtop]}function checkIt(a){place=detect.indexOf(a)+1;thestring=a;return place}Event.observe(window,"load",initialize,false);Event.observe(window,"load",getBrowserInfo,false);Event.observe(window,"unload",Event.unloadCache,false);var lightbox=Class.create();lightbox.prototype={yPos:0,xPos:0,rel:null,color:null,offsetx:0,offsety:0,initialize:function(a){if(a!=null){this.content=a.href;Event.observe(a,"click",this.activate.bindAsEventListener(this),false);a.onclick=function(){return false}}},activate:function(b){if(!b){this.rel="op_bg_color";this.color=$("colordata1")}else{if(!b.target){b.target=b.srcElement}if(b.target.getAttribute("rel")!=""&&b.target.getAttribute("rel")!=undefined){this.rel=b.target.getAttribute("rel")}this.color=b.target}if($("lbContent")!=null){Element.remove($("lbContent"));this.displayLightbox("none")}this.clearRows();var a=findPos($("op_color_box"));this.offsetx=a[0]-25;this.offsety=a[1]+20;if(browser=="Internet Explorer"){this.getScroll();this.prepareIE("100%","hidden");this.setScroll(0,0);this.hideSelects("hidden")}$(this.rel+"_cell").style.backgroundColor="gray";$(this.rel+"_cell").style.border="solid thick gray";this.displayLightbox("block")},prepareIE:function(a,b){},hideSelects:function(a){selects=document.getElementsByTagName("select");for(i=0;i<selects.length;i++){selects[i].style.visibility=a}},getScroll:function(){if(self.pageYOffset){this.yPos=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop}else{if(document.body){this.yPos=document.body.scrollTop}}}},setScroll:function(a,b){window.scrollTo(a,b)},displayLightbox:function(a){if($("lightbox")){$("lightbox").style.display=a}if(a!="none"){this.loadInfo()}},loadInfo:function(){var a=new Ajax.Request(this.content,{method:"get",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},processInfo:function(a){info="<div id='lbContent'>"+a.responseText+"</div>";try{new Insertion.Before($("lbLoadMessage"),info);if(!$("lightbox")){addLightboxMarkup()}$("lightbox").className="done";$("lightbox").style.position="absolute";$("lightbox").style.top=this.offsety+"px";$("lightbox").style.left=this.offsetx+"px"}catch(b){}this.actions()},actions:function(){lbActions=document.getElementsByClassName("lbAction");for(i=0;i<lbActions.length;i++){Event.observe(lbActions[i],"click",this[lbActions[i].rel].bindAsEventListener(this),false);lbActions[i].onclick=function(){return false}}},insert:function(b){link=Event.element(b).parentNode;Element.remove($("lbContent"));var a=new Ajax.Request(link.href,{method:"post",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},deactivate:function(){Element.remove($("lbContent"));if(browser=="Internet Explorer"){this.setScroll(0,this.yPos);this.prepareIE("auto","auto");this.hideSelects("visible")}$(this.rel+"_cell").style.backgroundColor="#C5E283";this.displayLightbox("none")},clearRows:function(){$("op_bg_color_cell").style.backgroundColor="#C5E283";$("op_header_bg_color_cell").style.backgroundColor="#C5E283";$("op_header_text_color_cell").style.backgroundColor="#C5E283";$("op_nh1_color_cell").style.backgroundColor="#C5E283";$("op_nh2_color_cell").style.backgroundColor="#C5E283";$("op_text_color_cell").style.backgroundColor="#C5E283";$("op_link_color_cell").style.backgroundColor="#C5E283";$("op_bg_color_cell").style.border="solid thick #C5E283";$("op_header_bg_color_cell").style.border="solid thick #C5E283";$("op_header_text_color_cell").style.border="solid thick #C5E283";$("op_nh1_color_cell").style.border="solid thick #C5E283";$("op_nh2_color_cell").style.border="solid thick #C5E283";$("op_text_color_cell").style.border="solid thick #C5E283";$("op_link_color_cell").style.border="solid thick #C5E283"},swatch:function(b){if(!b){var b=window.event}if(!b.target){b.target=b.srcElement}if(this.rel){if(browser=="Internet Explorer"||browser=="Opera"){$(this.rel).value=b.target.style.backgroundColor}else{var a=b.target.style.backgroundColor.replace(/\(|\)|[a-z]/gi,"").split(",");$(this.rel).value="#"+RGBtoHex(a[0],a[1],a[2])}}this.color.style.backgroundColor=b.target.style.backgroundColor;if(browser=="Internet Explorer"){this.setScroll(0,this.yPos);this.prepareIE("auto","auto");this.hideSelects("visible")}updatePreview();$(this.rel+"_cell").style.backgroundColor="#FFFFFF"}};function initialize(){addLightboxMarkup();lbox=document.getElementsByClassName("lbOn");for(i=0;i<lbox.length;i++){valid=new lightbox(lbox[i])}}function addLightboxMarkup(){bod=document.getElementsByTagName("body")[0];overlay=document.createElement("div");overlay.id="overlay";lb=document.createElement("div");lb.id="lightbox";lb.className="loading";lb.innerHTML='<div id="lbLoadMessage"><p>Loading</p></div>';bod.appendChild(overlay);bod.appendChild(lb)};
