/**
 *  Dynarch RollBar, rollbar-1.0
 *  Copyright Dynarch.com, 2004-2007.  All Rights Reserved.
 *  www.dynarch.com/products/rollbar
 *
 *  THIS NOTICE MUST REMAIN INTACT!
 *
 *           LICENSEE: Sapere Audemus Ltd
 *        License key: 4892edc4462bc8bde7fa14d1af2c44f2
 *      Purchase date: Wed Jul 25 06:56:18 2007 GMT
 *       License type: single-site
 *
 *  For details on this license please visit
 *  the product homepage at the URL above.
 */
(function(){var D,P,UA=navigator.userAgent,is_gecko=/gecko/i.test(UA),is_opera=/opera/i.test(UA),is_ie=/msie/i.test(UA)&&!is_opera&&!(/mac_powerpc/i.test(UA)),is_ie5=is_ie&&/msie 5\.[^5]/i.test(UA),is_mac_ie=/msie.*mac/i.test(UA),is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent),IE_LEFT=is_ie?"marginLeft":"left",CNN_DISABLED="dynarch-nav-disabled",CNR_DISABLED="dynarch-right-disabled",CNL_DISABLED="dynarch-left-disabled";Interval={_currentId:0,_cached:{},_timers:{},set:function(action,speed){var o,id=++Interval._currentId;if(Interval._cached[speed]){o=Interval._cached[speed];o.actions[id]=action;++o.length;Interval._timers[id]=o;return id;}else{o={speed:speed,actions:{},length:1,timerID:setInterval(function(){var a=o.actions;for(var i in a)a[i]();},speed)};o.actions[id]=action;Interval._cached[speed]=o;Interval._timers[id]=o;}return id;},clear:function(id){var o=Interval._timers[id];--o.length;if(o.length==0){delete Interval._cached[o.speed];clearInterval(o.timerID);}else{delete o.actions[id];}delete Interval._timers[id];}};function Animation(length,speed,pos1,pos2){this.length=length;this.speed=Math.round(1000/speed);this.pos1=pos1;this.pos2=pos2;this.diff=pos2-pos1;this.percent=0;this.timerID=null;this.accel=false;};Animation.prototype={clearTimer:function(){(this.timerID)&&Interval.clear(this.timerID);this.timerID=null;},start:function(){if(typeof this.step=="undefined"||this.step<0||this.step>=this.length)this.restart();else{var self=this;this.clearTimer();this.timerID=Interval.set(function(){self.update();},this.speed);}},restart:function(){this.onStart();this.pos=this.pos1;this.step=0;this.diff=this.pos2-this.pos1;this.rad_step=Math.PI/(2*this.length);this.rad_pos=0;this.start();},update:function(){if(this.step<this.length&&this.step>=0){var f=this.accel?(1-Math.cos(this.rad_pos)):Math.sin(this.rad_pos);this.delta=Math.round(f*this.diff);this.pos=this.pos1+this.delta;this.percent=100*(this.pos-this.pos1)/this.diff;this.onUpdate();++this.step;this.rad_pos+=this.rad_step;}else{this.delta=this.pos2-this.pos;this.pos=this.pos2;this.percent=100;this.onUpdate();this.stop(true);}},stop:function(call){this.clearTimer();call&&this.onStop();},comp:function(start,stop){return start+(stop-start)*this.percent/100;},onStart:function(){},onStop:function(){},onUpdate:function(){}};function noop(){};function DC(el,c){if(el){var a=el.className.split(" "),i=a.length;while(--i>=0)if(a[i]==c)a.splice(i,1);el.className=a.join(" ");}};function AC(el,ac,dc){if(el){if(dc)DC(el,dc);DC(el,ac);el.className+=" "+ac;}};function CE(tagName,parent,cn){var el=document.createElement(tagName);if(cn)el.className=cn;if(parent)parent.appendChild(el);return el;};function CT(parent,cn){var T1=CE("table",parent,cn),T2=CE("tbody",T1);T1.border=T1.cellSpacing=T1.cellPadding=0;return[T1,T2];};function lookupLabel(div){var l=div.firstChild,k,i,tmp;while(l&&l.nodeType!=1)l=l.nextSibling;if(l&&/^label$/i.test(l.tagName)){div._LABEL=l;k=l.getAttribute("accesskey",false);l.parentNode.removeChild(l);if(k){div.setAttribute("accesskey",k);function f(l){for(i=l.firstChild;i;i=i.nextSibling){if(i.nodeType==3){tmp=CE("span");tmp.innerHTML=i.data.replace(new RegExp("("+k+")","i"),"<u>$1</u>");while(tmp.firstChild)l.insertBefore(tmp.firstChild,i);l.removeChild(i);throw "finished";}else if(i.nodeType==1)f(i);}};try{f(l);}catch(k){};}}};function NOOP(){return false;};function DynarchRB(rbel,config){if(typeof config=="undefined")config={};function PD(N,V){if(typeof config[N]=="undefined")config[N]=V;};PD("fixedHeight",false);PD("start",-1);PD("tabs",false);PD("changeLocation",false);PD("hideButtons",false);PD("animation",[20,40]);PD("tabColors",null);PD("noInit",false);var self=this,tmp=D.defaultHooks,tr,td,el,width,height;this._hooks={onchangestart:tmp.onChangeStart.slice(0),onchangeend:tmp.onChangeEnd.slice(0),onanimation:tmp.onAnimation.slice(0),oninit:tmp.onInit.slice(0)};this.config=config;if(typeof rbel=="string")rbel=document.getElementById(rbel);this.element=CE("div",null,"dynarch-rollbar");this.container=CE("div",this.element,"dynarch-rollbar-container");rbel.parentNode.insertBefore(this.element,rbel.nextSibling);this.id=rbel.id;this.center=CE("div",this.container,"dynarch-roll-center");(this.leftBtn=CE("a",this.container,"dynarch-roll-nav dynarch-roll-left")).href="#";(this.rightBtn=CE("a",this.container,"dynarch-roll-nav dynarch-roll-right")).href="#";this.leftBtn.innerHTML=this.rightBtn.innerHTML="<br>";if(this.config.hideButtons)this.leftBtn.style.display=this.rightBtn.style.display="none";this.sections=[];this.sections.current=0;this.center.innerHTML="<div>www.dynarch.com</div>";width=this.center.offsetWidth-this.leftBtn.offsetWidth-this.rightBtn.offsetWidth;this.center.removeChild(this.center.firstChild);this.center.style.left=this.leftBtn.offsetWidth+"px";this.center.style.width=width+"px";tmp=CT(this.center,"dynarch-inner-table");tr=CE("tr",tmp[1]);this.innerTable=tmp=tmp[0];tmp.style[IE_LEFT]="0px";if(!is_ie)tmp.style.position="relative";else this.rightBtn.style.left=this.leftBtn.offsetWidth+width;height=0;for(tmp=rbel.firstChild;tmp;){el=tmp.nextSibling;if(tmp.nodeType==1&&/^div$/i.test(tmp.tagName)){tmp.INDEX=this.sections.length;this.sections.push(tmp);(td=CE("td",tr)).appendChild(tmp);td.className="dynarch-inner-td";if(tmp.className)AC(td,tmp.className);tmp.WIDTH=width>td.offsetWidth?width:td.offsetWidth;tmp.style.width=tmp.WIDTH+"px";tmp._TITLE=tmp.title||"";tmp.removeAttribute("title",false);lookupLabel(tmp);}tmp=el;}rbel.parentNode.removeChild(rbel);height=this.innerTable.offsetHeight;this.refresh();this.element.style.display="none";this.element.style.display="block";this.leftBtn.onclick=function(){if(typeof this.blur=="function")this.blur();self.prev();return false;};this.rightBtn.onclick=function(){if(typeof this.blur=="function")this.blur();self.next();return false;};this.leftBtn.onmousedown=this.rightBtn.onmousedown=NOOP;if(is_ie){this.leftBtn.ondblclick=this.leftBtn.onclick;this.rightBtn.ondblclick=this.rightBtn.onclick;}if(config.fixedHeight)for(tmp=this.sections.length;--tmp>=0;)this.sections[tmp].style.height=height+"px";if(config.tabs)this.createTabs(config.tabs);if(!config.noInit)this.init();};window.DynarchRB=D=DynarchRB;D.defaultHooks={onChangeStart:[],onChangeEnd:[],onAnimation:[],onInit:[]};P=D.prototype;D.preloadImages=function(filter){if(is_ie){var ai=[],hi={},i;function f(s,p){var i,t,pp=s.href;if(filter&&s.readOnly&&!filter.test(p+pp))return;if(pp)p+=pp.replace(/(\x2f?)[^\x2f]+$/,"$1");for(i=s.rules.length;--i>=0;){t=s.rules(i).style.backgroundImage;if(/url\((.*?)\)/.test(t)){t=p+RegExp.$1;if(!hi[t]){ai.push(t);hi[t]=1;}}}for(i=s.imports.length;--i>=0;)f(s.imports(i),p);};for(i=document.styleSheets.length;--i>=0;)f(document.styleSheets[i],"");document.write("<div style='display:none'>");for(i=ai.length;--i>=0;)document.write("<img src='"+ai[i]+"' />");document.write("</div>");}};P.refresh=function(){this.leftBtn.style.height=this.rightBtn.style.height=this.innerTable.offsetHeight+"px";};P.init=function(){var c=this.config;this._callHooks("onInit");if(c.start==-1){tmp=new RegExp("#"+this.id+"-pane-([0-9]+)");if(tmp.test(window.location))c.start=parseInt(RegExp.$1,10);else c.start=0;}this.showSection(c.start,true);};P.showSection=function(index,fast){var tpos=0,i,a=this.anim,sc=this.sections,cfa=this.config.animation,prev=sc.current,s=this.innerTable.style,div=sc[index],cpos=parseInt(s[IE_LEFT]),self=this;this.center.scrollLeft=0;tpos=-sc[index].parentNode.offsetLeft;if(!cfa)fast=true;if(!fast){if(a){a.restarting=true;a.stop(true);a.restarting=false;}this.anim=a=new Animation(cfa[0],cfa[1],cpos,tpos);a.onStart=function(){self._callHooks("onChangeStart",prev,index);};a.onUpdate=function(){s[IE_LEFT]=this.pos+"px";self._callHooks("onAnimation",prev,index,this);};a.onStop=function(){self.anim=null;self._callHooks("onChangeEnd",prev,index,this.restarting);};a.restart();}else{this._callHooks("onChangeStart",prev,index);this._callHooks("onChangeEnd",prev,index);s[IE_LEFT]=tpos+"px";}sc.current=index;if(index){DC(this.leftBtn,CNL_DISABLED);DC(this.leftBtn,CNN_DISABLED);}else{AC(this.leftBtn,CNN_DISABLED);AC(this.leftBtn,CNL_DISABLED);}if(index<sc.length-1){DC(this.rightBtn,CNN_DISABLED);DC(this.rightBtn,CNR_DISABLED);}else{AC(this.rightBtn,CNR_DISABLED);AC(this.rightBtn,CNN_DISABLED);}if(this.config.changeLocation)window.location="#"+this.id+"-pane-"+index;};P.prev=function(){var c=this.sections.current;if(c>0)this.showSection(c-1);};P.next=function(){var s=this.sections,c=s.current;if(c<s.length-1)this.showSection(c+1);};P._callHooks=function(event,A,B,C,D,E,F){var a=this._hooks[event.toLowerCase()],i,aa=[];if(a){for(i=1;i<arguments.length;++i)aa.push(arguments[i]);this.event=event;for(i=0;i<a.length;++i)a[i].apply(this,aa);this.event=null;}else alert("No such event: "+event);};P.addEventListener=function(event,handler){var a=this._hooks[event.toLowerCase()];if(a){a.push(handler);}else alert("No such event: "+event);};P.createTabs=function(pos,labels){var i,sc=this.sections,div,tmp,self=this,k,a,label,tr,td,span,tabbar=this.tabBar=CE("div",null,"dynarch-roll-tabs dynarch-roll-tabs-"+pos);if(typeof labels=="undefined")labels=[];this.tabs=[];tr=CE("tr",CT(tabbar)[1]);for(i=0;i<sc.length;++i){div=sc[i];td=CE("td",tr);if(div.className)AC(td,div.className);tmp=CE("a",td,"dynarch-roll-tab");label=labels[i]||div._LABEL||div._TITLE||("Pane "+i);div._LABEL=null;if(i==sc.current)AC(tmp,"dynarch-tab-current");this.tabs.push(tmp);tmp.INDEX=i;tmp.onclick=function(){if(typeof this.blur=="function")this.blur();if(self.sections.current==this.INDEX&&(is_ie||!self.anim))return false;self.showSection(this.INDEX);if(self.config.changeLocation)return true;return false;};tmp.onmousedown=NOOP;k=div.getAttribute("accesskey",1);if(k){div.removeAttribute("accesskey",false);tmp.accessKey=k;if(is_ie)tmp.onfocus=tmp.onclick;if(typeof label=="string")label=label.replace(new RegExp("("+k+")","i"),"<u>$1</u>");}tmp.href="#"+this.id+"-pane-"+i;span=CE("span",tmp);if(typeof label=="string")span.innerHTML=label;else while(tmp=label.firstChild)span.appendChild(tmp);span.className="dynarch-tab-span";}if(pos=="bottom")pos=this.element.nextSibling;else pos=this.element;this.element.parentNode.insertBefore(tabbar,pos);this.addEventListener("onChangeStart",function(prev,curr){var t1=self.tabs[prev],t2=self.tabs[curr];DC(t1,"dynarch-tab-pending");if(!self.config.tabColors){DC(t1,"dynarch-tab-current");AC(t2,"dynarch-tab-pending");}});this.addEventListener("onChangeEnd",function(prev,curr){var t1=self.tabs[prev],t2=self.tabs[curr],i;DC(t1,"dynarch-tab-current");AC(t2,"dynarch-tab-current","dynarch-tab-pending");if(self.config.tabColors){t1=t1.style;t2=t2.style;for(i in self.config.tabColors){t1[i]="";t2[i]="";}}});if(this.config.tabColors)this.addEventListener("onAnimation",function(prev,curr,a){var tc=self.config.tabColors,i,ta,ti,R=Math.round,t1=self.tabs[prev].style,t2=self.tabs[curr].style;for(i in tc){ti=tc[i][0];ta=tc[i][1];if(typeof ta=="object"){t1[i]="rgb("+(R(a.comp(ta[0],ti[0]))+","+R(a.comp(ta[1],ti[1]))+","+R(a.comp(ta[2],ti[2]))+")");t2[i]="rgb("+(R(a.comp(ti[0],ta[0]))+","+R(a.comp(ti[1],ta[1]))+","+R(a.comp(ti[2],ta[2]))+")");}else{t1[i]=R(a.comp(ta,ti))+"px";t2[i]=R(a.comp(ti,ta))+"px";}}});};D.setup=function(rbel,config){return new DynarchRB(rbel,config);};})();