//##################################################################################
//##################################################################################

		function changegraphic(img,ny) 
		{
			if (document.images)
			 document.images[img].src = ny;		
		}

//##################################################################################
//##################################################################################

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6 B=7(){6 1j="2.0.2ruzee";6 $23=/\\s*,\\s*/;6 B=7($9,$$a){6 $c=[];6 $1h=o.2q.1Q&&!$$a;6 $1k=($$a)?($$a.2g==1t)?$$a:[$$a]:[z];6 $$u=14($9).1w($23),i;m(i=0;i<$$u.p;i++){$9=1q($$u[i]);b(P&&$9.Z(0,3).1R("")==" *#"){$9=$9.Z(2);$$a=24([],$1k,$9[1])}1s $$a=$1k;6 j=0,$I,$x,$o,$M="";H(j<$9.p){$I=$9[j++];$x=$9[j++];$M+=$I+$x;$o="";b($9[j]=="("){H($9[j++]!=")"&&j<$9.p){$o+=$9[j]}$o=$o.Z(0,-1);$M+="("+$o+")"}$$a=($1h&&O[$M])?O[$M]:1u($$a,$I,$x,$o);b($1h)O[$M]=$$a}$c=$c.2i($$a)}1S B.2k;8 $c};B.1B=7(){8"7 B() {\\n  [1j "+1j+"]\\n}"};6 O={};B.1Q=R;B.2l=7($9){b($9){$9=1q($9).1R("");1S O[$9]}1s O={}};6 28={};6 1g=R;B.2m=7($J,$15){b(1g)1f("$15="+21($15));28[$J]=17 $15()};B.2n=7($F){8 $F?1f($F):l};6 u={};6 L={};6 t={c:/\\[([\\w-]+(\\|[\\w-]+)?)\\s*(\\W?=)?\\s*([^\\]]*)\\]/};6 E=[];u[" "]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=T($a[i],$k,$h);m(j=0;($5=$10[j]);j++){b(D($5)&&16($5,$h))$f.q($5)}}};u["#"]=7($f,$a,$v){6 $5,j;m(j=0;($5=$a[j]);j++)b($5.v==$v)$f.q($5)};u["."]=7($f,$a,$N){$N=17 1M("(^|\\\\s)"+$N+"(\\\\s|$)");6 $5,i;m(i=0;($5=$a[i]);i++)b($N.d($5.N))$f.q($5)};u[":"]=7($f,$a,$1V,$o){6 $d=L[$1V],$5,i;b($d)m(i=0;($5=$a[i]);i++)b($d($5,$o))$f.q($5)};L["2p"]=7($5){6 $z=X($5);b($z.1m)m(6 i=0;i<$z.1m.p;i++){b($z.1m[i]==$5)8 18}};L["2B"]=7($5){};6 D=7($5){8($5&&$5.1v==1&&$5.k!="!")?$5:1T};6 1d=7($5){H($5&&($5=$5.2s)&&!D($5))1W;8 $5};6 12=7($5){H($5&&($5=$5.2t)&&!D($5))1W;8 $5};6 1Z=7($5){8 D($5.1Y)||12($5.1Y)};6 2v=7($5){8 D($5.1X)||1d($5.1X)};6 U=7($5){6 $U=[];$5=1Z($5);H($5){$U.q($5);$5=12($5)}8 $U};6 P=18;6 1o=7($5){6 $z=X($5);8(2y $z.20=="2A")?/\\.26$/i.d($z.2C):2D($z.20=="2F 2G")};6 X=7($5){8 $5.2H||$5.z};6 T=7($5,$k){8($k=="*"&&$5.1l)?$5.1l:$5.T($k)};6 1b=7($5,$k,$h){b($k=="*")8 D($5);b(!16($5,$h))8 R;b(!1o($5))$k=$k.2J();8 $5.k==$k};6 16=7($5,$h){8!$h||($h=="*")||($5.2K==$h)};6 1J=7($5){8 $5.1K};7 24($f,$a,v){6 $c,i,j;m(i=0;i<$a.p;i++){b($c=$a[i].1l.2L(v)){b($c.v==v)$f.q($c);1s b($c.p!=1T){m(j=0;j<$c.p;j++){b($c[j].v==v)$f.q($c[j])}}}}8 $f};b(![].q)1t.29.q=7(){m(6 i=0;i<o.p;i++){l[l.p]=o[i]}8 l.p};6 $19=/\\|/;7 1u($$a,$I,$x,$o){b($19.d($x)){$x=$x.1w($19);$o=$x[0];$x=$x[1]}6 $f=[];b(u[$I]){u[$I]($f,$$a,$x,$o)}8 $f};6 $1y=/^[^\\s>+~]/;6 $$1z=/[\\s#.:>+~()@]|[^\\s#.:>+~()@]+/g;7 1q($9){b($1y.d($9))$9=" "+$9;8 $9.c($$1z)||[]};6 $1A=/\\s*([\\s>+~(),]|^|$)\\s*/g;6 $22=/([\\s>+~,]|[^(]\\+|^)([#.:@])/g;6 14=7($9){8 $9.C($1A,"$1").C($22,"$1*$2")};6 1p={1B:7(){8"\'"},c:/^(\'[^\']*\')|("[^"]*")$/,d:7($y){8 l.c.d($y)},1D:7($y){8 l.d($y)?$y:l+$y+l},1C:7($y){8 l.d($y)?$y.Z(1,-1):$y}};6 1U=7($1F){8 1p.1C($1F)};6 $1G=/([\\/()[\\]?{}|*+-])/g;7 1a($y){8 $y.C($1G,"\\\\$1")};u[">"]=7($f,$a,$k,$h){6 $5,i,j;m(i=0;i<$a.p;i++){6 $10=U($a[i]);m(j=0;($5=$10[j]);j++)b(1b($5,$k,$h))$f.q($5)}};u["+"]=7($f,$a,$k,$h){m(6 i=0;i<$a.p;i++){6 $5=12($a[i]);b($5&&1b($5,$k,$h))$f.q($5)}};u["@"]=7($f,$a,$1H){6 $d=E[$1H].d;6 $5,i;m(i=0;($5=$a[i]);i++)b($d($5))$f.q($5)};L["2c-2d"]=7($5){8!1d($5)};L["1e"]=7($5,$F){$F=17 1M("^"+$F,"i");H($5&&!$5.Q("1e"))$5=$5.2e;8 $5&&$F.d($5.Q("1e"))};t.1O=/\\\\:/g;t.1i="@";t.K={};t.C=7($c,$r,$h,$1N,$A){6 $13=l.1i+$c;b(!E[$13]){$r=l.1P($r,$1N||"",$A||"");E[$13]=$r;E.q($r)}8 E[$13].v};t.1L=7($9){$9=$9.C(l.1O,"|");6 $c;H($c=$9.c(l.c)){6 $C=l.C($c[0],$c[1],$c[2],$c[3],$c[4]);$9=$9.C(l.c,$C)}8 $9};t.1P=7($1n,$d,$A){6 $S={};$S.v=l.1i+E.p;$S.J=$1n;$d=l.K[$d];$d=$d?$d(l.Q($1n),1U($A)):R;$S.d=17 2r("e","8 "+$d);8 $S};t.Q=7($J){27($J.2u()){G"v":8"e.v";G"2z":8"e.N";G"m":8"e.2E";G"25":b(P){8"21((e.2I.c(/25=\\\\1r?([^\\\\s\\\\1r]*)\\\\1r?/)||[])[1]||\'\')"}}8"e.Q(\'"+$J.C($19,":")+"\')"};t.K[""]=7($r){8 $r};t.K["="]=7($r,$A){8 $r+"=="+1p.1D($A)};t.K["~="]=7($r,$A){8"/(^| )"+1a($A)+"( |$)/.d("+$r+")"};t.K["|="]=7($r,$A){8"/^"+1a($A)+"(-|$)/.d("+$r+")"};6 1I=14;14=7($9){8 1I(t.1L($9))};P=1f("R;/*@2f@b(@\\2h)P=18@2j@*/");b(!P){T=7($5,$k,$h){8 $h?$5.2o("*",$k):$5.T($k)};16=7($5,$h){8!$h||($h=="*")||($5.2w==$h)};1o=z.1x?7($5){8/26/i.d(X($5).1x)}:7($5){8 X($5).2a.k!="2b"};1J=7($5){8 $5.Y||$5.1K||1c($5)};7 1c($5){6 $Y="",$V,i;m(i=0;($V=$5.2x[i]);i++){27($V.1v){G 11:G 1:$Y+=1c($V);1E;G 3:$Y+=$V.2M;1E}}8 $Y}}1g=18;8 B}();',62,173,'|||||element|var|function|return|selector|from|if|match|test||results||namespace|||tagName|this|for||arguments|length|push|attribute||AttributeSelector|selectors|id||filter|string|document|value|cssQuery|replace|thisElement|attributeSelectors|code|case|while|token|name|tests|pseudoClasses|cacheSelector|className|cache|isMSIE|getAttribute|false|attributeSelector|getElementsByTagName|childElements|node||getDocument|textContent|slice|subset||nextElementSibling|key|parseSelector|script|compareNamespace|new|true|NAMESPACE|regEscape|compareTagName|_getTextContent|previousElementSibling|lang|eval|loaded|useCache|PREFIX|version|base|all|links|propertyName|isXML|Quote|_toStream|x22|else|Array|select|nodeType|split|contentType|STANDARD_SELECT|STREAM|WHITESPACE|toString|remove|add|break|text|ESCAPE|attributeSelectorID|_parseSelector|getTextContent|innerText|parse|RegExp|compare|NS_IE|create|caching|join|delete|null|getText|pseudoClass|continue|lastChild|firstChild|firstElementChild|mimeType|String|IMPLIED_ALL|COMMA|_msie_selectById|href|xml|switch|modules|prototype|documentElement|HTML|first|child|parentNode|cc_on|constructor|x5fwin32|concat|end|error|clearCache|addModule|valueOf|getElementsByTagNameNS|link|callee|Function|previousSibling|nextSibling|toLowerCase|lastElementChild|prefix|childNodes|typeof|class|unknown|visited|URL|Boolean|htmlFor|XML|Document|ownerDocument|outerHTML|toUpperCase|scopeName|item|nodeValue'.split('|'),0,{}))

//##################################################################################
//##################################################################################

function getParentByClassName(element, className)
{
    var parent = element;

    if (className)
    {
        while (parent && parent.className != className)
        {
            parent = parent.parentNode;
        }
    }

    return parent;
}

function getFirstChildByClassRegex(element, tagName, classRegex, stopClassRegex)
{
    var match;
    var child = element.firstChild;

    while (child != null && (!child.className || !child.className.match(stopClassRegex)))
    {
        if (child.tagName && child.tagName == tagName && child.className && child.className.match(classRegex))
        {
            match = child;
            break;
        }
        else
        {
            match = getFirstChildByClassRegex(child, tagName, classRegex, stopClassRegex);

            if (match)
            {
                break;
            }
        }

        child = child.nextSibling;
    }

    return match;
}

function addEventToElement(target, eventType, func, useCapture)
{
    var result = false;

    if (target.addEventListener)
    {
        target.addEventListener(eventType, func, useCapture);
        result = true;
    }
    else if (target.attachEvent)
    {
        result = target.attachEvent("on" + eventType, func);
    }
    else
    {
        alert("Handler could not be attached");
    }

    return result;
}

function addEventToElements(targets, eventType, func, useCapture)
{
    var result = true;

    for (var i = 0; i < targets.length; i++)
    {
        result &= addEventToElement(targets[i], eventType, func, useCapture);
    }

    return result;
}

function removeEventFromElement(target, eventType, func, useCapture)
{
    var result = false;

    if (target.removeEventListener)
    {
        target.removeEventListener(eventType, func, useCapture);
        result = true;
    }
    else if (target.detachEvent)
    {
        result = target.detachEvent("on" + eventType, func);
    }
    else
    {
        alert("Handler could not be removed");
    }

    return result;
}

function removeEventFromElements(targets, eventType, func, useCapture)
{
    var result = true;

    for (var i = 0; i < targets.length; i++)
    {
        result &= removeEventFromElement(targets[i], eventType, func, useCapture);
    }

    return result;
}

function getEvent(event)
{
    if (!event)
    {
        var event = window.event;
    }

    return event;
}

function getEventSource(event)
{
    if (event.srcElement)
    {
        var source = event.srcElement;
    }
    else if (event.currentTarget)
    {
        var source = event.currentTarget;
    }
    else
    {
        alert("Event source not found!");
    }

    return source;
}

//##################################################################################
//##################################################################################

/**
 * RuzeeBorders 0.11
 * (c) 2006 Steffen Rusitschka <steffen@rusitschka.de>
 *
 * RuzeeBorders is freely distributable under the terms of an MIT-style license.
 * For details, see http://www.ruzee.com/
 */

var RUZEE=window.RUZEE||{};
RUZEE.userAgent=navigator.userAgent.toLowerCase();
RUZEE.isIE=typeof window.RUZEE.isIE != 'undefined'
  ?window.RUZEE.isIE
  :RUZEE.userAgent.indexOf('msie')>=0
    && RUZEE.userAgent.indexOf('opera')==-1;
RUZEE.isStrict=typeof window.RUZEE.isStrict != 'undefined'
  ?window.RUZEE.isStrict
  :(document.compatMode?document.compatMode!='BackCompat':RUZEE.userAgent.indexOf('safari')==-1?false:true);

RUZEE.Borders={

  /**
   * Set to false to not draw the borders automatically on
   * domload when RUZEE.Events are available.
   */
  autoRender:true,

  /** Add mapping rules to be executed on render(). */
  add:function(mappings){
    for(rule in mappings){
      var rules=rule.split(',');
      for(var i=0; i<rules.length; ++i){
        var r=rules[i].replace(/^\s+|\s+$/,'');
        var ms=RUZEE.Borders.mappings[r]||{};
        for (m in mappings[rule]) ms[m]=mappings[rule][m];
        RUZEE.Borders.mappings[r]=ms;
      }
    }
  },

  /**
   * Render all added mapping rules into the DOM 
   * If RUZEE.Events is not available, this method MUST be called in the 
   * window.onload method (or with a similar technique)!
   */
  render:function(){
//     var t=new Date().getTime();
    var jobs=[];
    for(rule in RUZEE.Borders.mappings){
      jobs.push({
        e:RUZEE.Borders.cssQuery(rule),
        b:new RUZEE.Borders.Border(RUZEE.Borders.mappings[rule])
      });
    }
    RUZEE.Borders.mappings={};
    for (var i=0; i<jobs.length; ++i){
      jobs[i].b.calc(jobs[i].e);
    }
//     var t2=new Date().getTime();
    RUZEE.Borders.renderCalcs();
/*    var t3=new Date().getTime();
    alert("calc: " + (t2-t) + "ms, render: " + (t3-t2) + "ms");*/
  },

  /** The Border class constructor */
  Border:function(d){
    var rad=d.cornerRadius||8;
    this.shadowShift=0;
    this.setEdges(d.edges||'lrtb');
    this.height=d.height||0;
    var b=null;
    switch(d.borderType){
    case 'simple':
      this.cornerRadius=this.shadowRadius=this.shadowPadding=rad;
      this.coShadowS='000';
      break;
    case 'shadow':
      var sw=d.shadowWidth||8;
      this.cornerRadius=rad;
      this.shadowRadius=rad+sw*2;
      this.shadowPadding=rad+sw;
      this.shadowShift=Math.round(sw/2);
      this.coShadowS=d.shadowColor||'000';
      break;
    case 'fade':
      this.cornerRadius=this.shadowPadding=1;
      this.shadowRadius=rad;
      this.coShadowS='.fade';
      break;
    case 'glow':
      this.cornerRadius=this.shadowPadding=rad;
      this.shadowRadius=rad+(d.glowWidth||rad);
      this.coShadowS=d.glowColor||'fff';
      break;
    default:
      alert('Unknown borderType: '+d.borderType);
    }
  },

  // ---- internal fields and methods ----

  /** the mappings: 'CSS rule' -> Border */
  mappings:{},

  /** The corner cache */
  cache:{},

  /** The completed calulations to render */
  calcs:[],

  /** if Dean Edward's cssQuery is available, use it */
  cssQuery:function(s){
    var c=s.charAt(0);
    if(c=='#'&&!(/\s/.test(s))) return [ document.getElementById(s.substr(1)) ];
    if(window.cssQuery) return window.cssQuery(s);

    alert("Don't know what to do with '"+s+"' Did you forget to include cssquery?");
    return [];
  },

  /** Add a completed calculation */
  addCalc:function(calc){
    RUZEE.Borders.calcs.push(calc);
  },

  renderCalcs:function(){
    for(var i=0; i<RUZEE.Borders.calcs.length; ++i){
      RUZEE.Borders.calcs[i]();
    }
    RUZEE.Borders.calcs=[];
  }
};

/** The Border class */
RUZEE.Borders.Border.prototype={

  /** Set the background image for element e to position x,y */
  setBgImg:function(e,x,y){
    if(!this.imgBgInURL) return;
    e.style.backgroundImage=this.imgBgInURL;
    x=-x;y=-y;
    e.style.backgroundPosition=x+'px '+y+'px';
    if(this.imgBgInRepeat) e.style.backgroundRepeat=this.imgBgInRepeat;
  },

  /** Create a DIV with width w, height h, background color bg, overflow o */
  crDiv:function(w,h,bg,o){
    var d=RUZEE.isXHTML
      ?document.createElementNS('http://www.w3.org/1999/xhtml','div')
      :document.createElement('div');
    d.style.padding=d.style.margin='0px';
    d.style.display='block';
    d.style.border='none';
    d.style.width=w?w:'auto';
    if(h) { d.style.height=h; d.style.fontSize=h; }
    if(!bg) bg='transparent';
    d.style.background=bg;
    if(o) d.style.overflow=o;
    return d;
  },

  /** Create wrapper DIV around element c */
  addLR:function(c,co,w,h,bgx,bgy){
    var e=this.crDiv(null,h,co);
    if(typeof bgx!='undefined') this.setBgImg(e,bgx,bgy);
    if(!w) w='1px';
    c.style.margin='0px '+(this.isR?w:'0px')+' 0px '+(this.isL?w:'0px');
    e.appendChild(c);
    return e;
  },

  /** Create the top (top==true) or bottom (top==false) of the border */
  crTB:function(top){
    var ca=RUZEE.Borders.cache[this.cacheID+'.'+top];
    if(ca){
      if(top){
        this.psT=ca.ps;
        this.inSh=ca.inSh;
      }else{
        this.psB=ca.ps;
      }
      return ca.el.cloneNode(true);
    }
    var sh=top?-this.shadowShift:this.shadowShift;
    var cxc=this.shadowPadding-this.cornerRadius-1;
    var cxb=cxc;
    var cxe=cxc+this.cornerRadius;
    var exb=0;
    var exe=cxc-1;
    var syc=this.cornerRadius-this.shadowPadding+sh+1;
    var yb,ye;
    if(top){
      if(!this.isT){
        this.psT=0;
        return;
      }
      yb=syc+this.shadowRadius-1;
      ye=syc-1;
      yi=-1;
      this.inSh=syc-1;
      this.psT=yb-ye;
    }else{
      if(!this.isB) {
        this.psB=0;
        return;
      }
      yb=syc<0?syc:0;
      ye=syc+this.shadowRadius;
      yi=1;
      this.psB=ye-yb;
    }
    var cwb=this.wBorder;
    if(cwb==0) cwb=1;

    var e=this.crDiv(null, Math.abs(yb-ye)+'px',null,'hidden');
    for(var y=yb; y!=ye; y+=yi){
      var co;
      if(y<=this.cornerRadius-cwb){
        co=this.coBgIn;
      }else if(y<=this.cornerRadius){
        co=this.coBorder;
      }else if(y-syc<0){
        co=this.coShadow;
      }else{
        co=rzBlend(this.coShadow,this.coBgOut,(y-syc)/this.shadowRadius);
      }
      var line=this.crDiv(null,'1px',rzC2S(co),'hidden');
      var fstLine=line;
      var xbg=null;
      for(var x=0; x<this.shadowRadius; ++x){
        var isIn=false, setBgImg=false;
        var sd, out=0;
        if(y<syc){
          sd=x;
        }else{
          sd=Math.sqrt(Math.sqr(x)+Math.sqr(y-syc));
        }
        if(this.shadowRadius>this.cornerRadius && sd<=this.shadowRadius){
          co=rzBlend(this.coShadow, this.coBgOut, sd/this.shadowRadius);
        }else{
          co=this.coBgOut;
          out++;
        }
        if(y<=this.cornerRadius){
          if(x>=exb && x<=exe){
            if(y>this.cornerRadius-cwb){
              co=this.coBorder;
            }else{
              isIn=true;
            }
          }else if(x>=cxb && x<=cxe){
            var cd=Math.sqrt(Math.sqr(x-cxc)+Math.sqr(y))-this.cornerRadius;
            if(y<0){
              if(x-cxc>this.cornerRadius-this.wBorder){
                co=this.coBorder;
              }else{ 
                isIn=true;
              }
            }else if(cd<-cwb){
              isIn=true;
            }else if(cd<-cwb+1){
              // first on border! do bgimg
              if(top&&this.imgBgInURL){
                setBgImg=true;
              }else
                co=rzBlend(this.coBgIn,this.coBorder,cd+cwb);
            }else if(cd<0){
              co=this.coBorder;
            }else if(cd<=1){
              co=rzBlend(this.coBorder,co,cd);
            }else{
              out++;
            }
          }
        }else{
          out++;
        }
        if(!isIn&&line==fstLine&&y<=this.cornerRadius-cwb&&top){
          this.setBgImg(fstLine,this.shadowRadius-x,yb-y);
        }
        if(out>1){
          line=this.addLR(line,'transparent',(this.shadowRadius-x)+'px');
          x=this.shadowRadius; // done
        }else{
          if(!isIn){
            // fix a strange IE bug where the 12ths recursion seems to get lost...
            if(RUZEE.isIE&&x==this.shadowRadius-12) line=this.addLR(line);
            line=this.addLR(line,rzC2S(co));
          }
          if(setBgImg) this.setBgImg(line,this.shadowRadius-x,yb-y+1);
        }
      }
      e.appendChild(line);
    }
    var ce={ el:e, ps:top?this.psT:this.psB };
    if(top) ce.inSh=this.inSh;
    RUZEE.Borders.cache[this.cacheID+'.'+top]=ce;
    return e;
  },

  /** Create the left and right of the border */
  crLR:function(e){
    var coBgInS=rzC2S(this.coBgIn);
    var coBS=rzC2S(this.coBorder);
    if(this.wBorder>0) e=this.addLR(e,coBS,this.wBorder+'px');
    for(var x=this.shadowPadding; x<this.shadowRadius; ++x){
      coS=rzC2S(rzBlend(this.coShadow,this.coBgOut,x/this.shadowRadius));
      e=this.addLR(e,coS);
    }
    return e;
  },

  setEdges:function(ed){
    ed=ed?ed.toLowerCase():'lrtb';
    this.isL=ed.indexOf('l')>=0;
    this.isR=ed.indexOf('r')>=0;
    this.isT=ed.indexOf('t')>=0;
    this.isB=ed.indexOf('b')>=0;
  },

  /** Calculate the border around e */
  calc:function(e){
    RUZEE.isXHTML=typeof window.RUZEE.isXHTML != 'undefined'
      ?window.RUZEE.isXHTML
      :(/html\:/.test(document.getElementsByTagName('body')[0].nodeName));

    if(!e) return;
    if(e.constructor==Array){
      for(var i=0; i<e.length; ++i) this.calc(e[i]);
      return;
    }
    this.inSh=0;

    // Get the bg image
    this.imgBgInURL=rzGetStyle(e,'background-image',false,null);
    if(this.imgBgInURL&&this.imgBgInURL=='none') this.imgBgInURL=null;
    if(this.imgBgInURL){
      this.imgBgInRepeat=rzGetStyle(e,'background-repeat',false,null);
    }
    this.coBgIn=rzS2C(rzGetStyle(e,'background-color'),'#ffffff');
    this.coBgOut=rzS2C(rzGetStyle(e.parentNode,'background-color'),'#ffffff');
    var borderCSS='border-'+(this.isT?'top-':'bottom-');
    var bs=rzGetStyle(e,borderCSS+'style',false,'none');
    if(bs && bs!='' && bs!='none' && bs!='hidden'){
      this.coBorder=rzS2C(rzGetStyle(e,borderCSS+'color',false,'black'));
      this.wBorder=rzPX2I(rzGetStyle(e,borderCSS+'width',false,'1px'));
    }else{
      this.coBorder=this.coBgIn;
      this.wBorder=0;
    }
    this.coShadow=this.coShadowS=='.fade'?this.coBorder:rzS2C(this.coShadowS);

    this.cacheID=
      rzC2S(this.coBgIn)+'.'+rzC2S(this.coBgOut)+'.'+
      rzC2S(this.coBorder)+'.'+rzC2S(this.coShadow)+'.'+
      this.wBorder+'.'+this.isL+this.isR+this.isT+this.isB+'.'+
      this.cornerRadius+'.'+this.shadowRadius+'.'+
      this.shadowPadding+'.'+this.shadowShift+'.'+
      this.imgBgInURL+'.'+this.imgBgInRepeat;

    var wr=this.crDiv();
    var cwr=this.crDiv();

    this.psT=0;
    this.psB=0;
    if(this.isT) wr.appendChild(this.crTB(true));
    wr.appendChild(this.crLR(cwr));
    if(this.isB) wr.appendChild(this.crTB(false));
    var psLR=this.shadowRadius-this.shadowPadding+this.wBorder;
    var psL=this.isL?psLR:0;
    var psR=this.isR?psLR:0;
    var isTB=this.isT&&this.isB;
    if(!isTB)this.inSh=0;
    var psT=isTB?Math.floor((this.psT+this.psB+this.inSh)/2):this.psT+Math.floor(this.inSh/2);
    var psB=this.psB+this.psT+this.inSh-psT;

    var cwrbg=cwr;
    // lift the inner div up if necessary
    if(this.inSh!=0){
      var up1=this.crDiv(); cwr.appendChild(up1);
      var up2=this.crDiv(); up1.appendChild(up2);
      cwr.style.position=up1.style.position='relative';
      up1.style.top=up2.style.marginBottom=this.inSh+'px';
      if(RUZEE.isIE) cwr.style.height='1%';
      cwrbg=up1; cwr=up2;
    }

    this.setBgImg(cwrbg,psL,this.psT+this.inSh);
    cwrbg.style.backgroundColor=rzC2S(this.coBgIn);

    if(RUZEE.isIE){
      e.style.height=cwr.style.height='1%'; // fix IE 3px jog when floated
    }else{
      // work around for other browsers for sebs problem
      var end=this.crDiv(null,'1px');
      end.style.marginBottom='-1px';
      e.appendChild(end);
      cwr.appendChild(end.cloneNode(true));
    }
    if(this.height>0) cwr.style.height=(RUZEE.isStrict?this.height:(this.height-this.psB-this.psT))+'px';

    var funcs=[
      rzUpdatePad(e,wr,cwr,'top',psT),
      rzUpdatePad(e,wr,cwr,'bottom',psB),
      rzUpdatePad(e,wr,cwr,'left',psL),
      rzUpdatePad(e,wr,cwr,'right',psR)];

    RUZEE.Borders.addCalc(function(){
      for(var i=0; i<funcs.length; ++i) funcs[i]();
      e.style.background='transparent';
      e.style.backgroundImage='none';
      e.appendChild(wr);
      while (e.childNodes.length>1){
        cwr.appendChild(e.removeChild(e.childNodes[0]));
      }
    });
  },

  /** Render the border around e */
  render:function(e){
    this.calc(e);
    RUZEE.Borders.renderCalcs();
  },

  // DEPRECATED STUFF - WILL BE REMOVED IN ONE OF THE NEXT RELEASES!
  draw:function(e,edges){
    this.setEdges(edges?edges.toLowerCase():'lrtb');
    if(typeof e=='string'){
      if(e.charAt(0)!='.') e='#'+e;
      e=RUZEE.Borders.cssQuery(e);
    }
    this.render(e);
  }
}; // of Border prototype

// add an event handler for render() if RUZEE.Events are available
if(RUZEE.Events){
  RUZEE.Events.add(window,'domload',function(){
    if(RUZEE.Borders.autoRender){
      RUZEE.Borders.render();
    }
  });
}

// internal tools

Math.sqr=function(x){
  return x*x;
};

function rzCC(s){
  for(var exp=/-([a-z])/; exp.test(s); s=s.replace(exp,RegExp.$1.toUpperCase()));
  return s;
};

function rzGetStyle(e,a,transOk,d){
  if(e==null) return d;
  if(typeof e=='string') e=document.getElementById(e);
  var v=null;
  if(document.defaultView){
    var cs=document.defaultView.getComputedStyle(e,null);
    if (!cs && window.getComputedStyle) cs=window.getComputedStyle(e,null);
    if(cs){
      v=cs.getPropertyValue(a);
      if(!v && cs.getPropertyCSSValue){
        v=cs.getPropertyCSSValue(a);
        if(v) v=v.getStringValue();
      }
    }
  }

  if(!v && e.currentStyle){
    v=e.currentStyle[rzCC(a)];
    if (!v) v=e.currentStyle[a];
  }

  if(!v && e.style) v=e.style[rzCC(a)];
  // KHTML bug fix: transparent is #000000 - if you want black, use #010101 in your CSS.
  // Safari work around: transparent is 'rgba(0, 0, 0, 0)'
  if(!transOk && v && (v.toLowerCase()=='transparent' || v=='#000000' || v=='rgba(0, 0, 0, 0)')) v=null;
  return v?v:d?d:e==document.body?d:rzGetStyle(e.parentNode,a);
};

function rzPX2I(px){
  if(!px) return 0;
  var p=/\s*(\d\d*)px/.exec(px);
  if(p) return parseInt(p[1]);
  return 0;
};

  /** Update the padding of s depending of the setting of d and subtract subPx */
function rzUpdatePad(org,newo,newi,l,subPx,isSet){
  var padL='padding-'+l; var padCC=rzCC(padL);
  var marL='margin-'+l; var marCC=rzCC(marL);
  var borL='border-'+l+'-width'; var borCC=rzCC(borL);

  var pad=rzGetStyle(org,padL);
  var bor=rzGetStyle(org,borL);
  var r=rzPX2I(pad)+rzPX2I(bor);
  var v=r-subPx;
  v=(v<0?0:v)+'px';

  if(RUZEE.isStrict){
    newo.style[marCC]=(-r)+'px';
    newi.style[padCC]=v;
    return function(){
      org.style[borCC]='0px';
      org.style[padCC]=r+'px';
    };
  }else{
    newi.style[padCC]=v;
    return function(){
      org.style[borCC]=org.style[padCC]='0px';
    };
  }
};

function rzS2C(s,d){
    if (!s) return d?rzS2C(d):[0,0,0,0];
    if (s.charAt(0)=='#') s=s.substr(1,6);
    s=s.replace(/ /g,'').toLowerCase();
    // The CSS 2.1 colors
    var COLORS = {
         aqua:'00ffff', black:'000000', blue:'0000ff', fuchsia:'ff00ff',
         gray:'808080', green:'008000', lime:'00ff00', maroon:'800000',
         navy:'000080', olive:'808000', orange:'ffa500', purple:'800080',
         red:'ff0000', silver:'c0c0c0', teal:'008080', white:'ffffff',
         yellow:'ffff00'
    };
    for (var key in COLORS) if (s==key) s=COLORS[key];

    var p=/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(s);
    if(p) return [parseInt(p[1]),parseInt(p[2]),parseInt(p[3]),parseInt(p[4])];
    var p=/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/.exec(s);
    if(p) return [parseInt(p[1]),parseInt(p[2]),parseInt(p[3]),255];
    p=/^(\w{2})(\w{2})(\w{2})$/.exec(s);
    if(p) return [parseInt(p[1],16),parseInt(p[2],16),parseInt(p[3],16),255];
    p=/^(\w{1})(\w{1})(\w{1})$/.exec(s);
    if(p) return [parseInt(p[1]+p[1],16),parseInt(p[2]+p[2],16),parseInt(p[3]+p[3],16),255];
    return d?rzS2C(d):[0,0,0,0];
};

function rzC2S(c){
  if(typeof c=='string') return c;
  r='0'+c[0].toString(16);
  g='0'+c[1].toString(16);
  b='0'+c[2].toString(16);
  return '#'
    +r.substring(r.length-2)
    +g.substring(g.length-2)
    +b.substring(b.length-2);
};

function rzBlend(a,b,w){
  return Array(
    Math.round(a[0]+(b[0]-a[0])*w),
    Math.round(a[1]+(b[1]-a[1])*w),
    Math.round(a[2]+(b[2]-a[2])*w),
    Math.round(a[3]+(b[3]-a[3])*w));
};

// DEPRECATED STUFF - WILL BE REMOVED IN ONE OF THE NEXT RELEASES!
function rzCrSimpleBorder(rad){
  return new RUZEE.Borders.Border({ borderType:'simple', cornerRadius:rad });
};

function rzCrShadowBorder(rad,smar,coShadowS){
  return new RUZEE.Borders.Border({
    borderType:'shadow', cornerRadius:rad, shadowWidth:smar, shadowColor:coShadowS });
};

function rzCrFadeBorder(rad){
  return new RUZEE.Borders.Border({ borderType:'fade', cornerRadius:rad });
};

function rzCrGlowBorder(rad,gmar,coGlowS){
  return new RUZEE.Borders.Border({ borderType:'glow', cornerRadius:rad, glowWidth:gmar, glowColor:coGlowS });
};

function rzGetElementsByClass(c,n,t) {
  return RUZEE.getElementsByClass(c,t);
};

//##################################################################################
//##################################################################################

if (!window.console){
    console = {
    }
    console.log = function(){
    }
}

//All .box-grey get a 4 px rounded corner.
RUZEE.Borders.add({'.box-grey': { borderType:'simple', cornerRadius:4 }})
RUZEE.Borders.add({'.box-grey-tight': { borderType:'simple', cornerRadius:4 }})
RUZEE.Borders.add({'.box-grey-background': { borderType:'simple', cornerRadius:4 }})
RUZEE.Borders.add({'.box-grey-bg': { borderType:'simple', cornerRadius:4 }})
RUZEE.Borders.add({'.box-headline': { borderType:'simple', cornerRadius:4 }})
RUZEE.Borders.add({'.box-splash': { borderType:'simple', cornerRadius:4 }})
window.onload = function (){
	RUZEE.Borders.render();
	
	var autoLabels = cssQuery("[class~=\"autoLabel\"]");
	for (var i=0;i<autoLabels.length;i++) {
		enableAutoLabel(autoLabels[i])
	}
	
	var aElVeil = cssQuery("[class~=\"veil\"]");
	for (var i = 0;i<aElVeil.length;i++) {
		applyVeil(aElVeil[i])
	}
	
	//a[class~="external"]
	var aAExt = cssQuery("a[class~=\"external\"]");
	for (var i = 0;i<aAExt.length;i++) {
		setExternal(aAExt[i])
	}
	var aAPop = cssQuery("a[class~=\"popup\"]");
	for (var i = 0;i<aAPop.length;i++) {
		setPopup(aAPop[i])
	}
	
	var aImgHvr = cssQuery("img[class~=\"hover\"]");
	for (var i = 0;i<aImgHvr.length;i++) {
		setHover(aImgHvr[i])
	}
	
	var shop = $("shopContainer");
	if (shop && typeof(Catalog)!="undefined"){
		cat.wireIn();
	}
	
	elStepNav = $("stepNav");
	if (elStepNav && buildStepNav){
		stepNav = new StepNav(elStepNav);
		buildStepNav();
	}
	
	var aSubmit = cssQuery("input[type=\"submit\"],input[type=\"image\"][class=\"button\"]");
	for (var i = 0;i<aSubmit.length;i++) {
		secureSubmit(aSubmit[i])
	}
}


$ = function(id) {
	if (typeof(id)!="string") return id;
	return document.getElementById(id);
} 


Enum = function(items){
	if (typeof(console)!="undefined") console.log(arguments)
	for (var i=0;i<arguments.length;i++){
		this[arguments[i]] = new EnumItem(arguments[i]);
	}
}

EnumItem = function(label){
	this.label = label;
} 
EnumItem.prototype = {
	label:null
}

function secureSubmit(el){
	el.onclick = function(){
		if (this._clicked) return false;
		this._clicked = true;	
	}
}

function setExternal(el){
	el.target = "_blank";
}

function setPopup(el){
	el.target = "_blank";
	var curr=null;
	if (el.onclick) {
		curr = el.onclick;
	}
	
	el.onclick = function (){
		if (curr) curr();
		window.open(el.href,"","width=320,height=590,top=50,left=50,toolbar=no, menubar=no, scrollbars=no, resizable=auto,location=no, directories=no, status=yes");
		return false;
	}
}

function setHover(el){
	var on = el.src.replace(/(\.gif|\.jpg)/i,"_on$1");
	var off = el.src;
	el.parentNode.onmouseover = 	function (){
		hover(el,on);
	}
	
	el.parentNode.onmouseout = 	function (){
		hover(el,off);
	}
}

function hover(el,src){
	if (el.src!=src) el.src = src;
}

function enableListPicker(itemQuery, listQuery, maxItems, emptyItem){
	var cb;
	var aElCb = cssQuery(itemQuery);
	var list =  cssQuery(listQuery)[0];
	if (aElCb.length==0 || !list) return;
	
	list.maxItems = maxItems;
	var lis = list.getElementsByTagName("li");
	var elLi;
	elLi = document.createElement("li");
	elLi.innerHTML = emptyItem;
	
	if (emptyItem && lis.length<maxItems) {
		list.appendChild(elLi.cloneNode(true));
	}
	
	for (var i = 0;i<aElCb.length;i++) {
		cb = aElCb[i];
		if (cb.parentNode.id=="") cb.parentNode.id = "item"+i;
		cb.onclick = function(){
			if (this.checked) {
				var ok = addPickToList(this.parentNode,list);
				if (!ok){
					this.checked = false;
				}
			} else {
				var rem = cssQuery("#sel_"+this.parentNode.id)[0]
				if (rem){
					list.removeChild(rem);
					if (emptyItem) list.appendChild(elLi.cloneNode(true));
				}
			}
			
			 
		}
	}
}

function addPickToList(pick, list){
	var lis = list.getElementsByTagName("li");
	//alert(list.maxItems +"&&"+ lis.length)
	var rep = null;
	if (list.maxItems && lis.length>=list.maxItems){
		for (var i in lis){
			if (lis[i].id=="") {
				rep = lis[i];
				break;
			}
		}
		if (!rep) return false;
	}
	
	var item = pick.cloneNode(true);
	item.id = "sel_"+item.id;
	var cb = item.getElementsByTagName("input");
	for (var i = cb.length-1;i>=0;i--){
		cb[i].parentNode.removeChild(cb[i]);
	}
	if (rep) {
		list.insertBefore(item,rep);
		rep.parentNode.removeChild(rep);
	} else list.appendChild(item);
	
	return true;
}

/*
 * enable toggle allows an item that has the onclick event to toggle any number of other elements.
 * 
 * @param {Object} handle - the elements that has the onclick
 * @param {Object} toggleText - text or image path that toggles. if there is an image inside the handle, image path is assumed 
 * @param {Object} targets - items that are toggled
 * @param {Object} toggled - true if the item should be hidden from the start
 */
var stepNav;
function enableToggle(handle,toggleText,targets,toggled){
	var tag = cssQuery(handle)[0];
	tag._toggleText = toggleText;
	tag._toggled = false;
	tag._targets = targets;
	var t = [],a;
	for (var i=0;i<targets.length;i++){
		a = cssQuery(targets[i]);
		t = t.concat(a);
	}
	tag._elTargets = t;
	var img = cssQuery(handle+" img")[0];
	if (img){
		tag._img = img;
	}
	tag.onclick = function(){
		toggleHandle.apply(this)
		return false;
	}
	if (toggled) toggleHandle.apply(tag);
}

function toggleHandle(){
	var targets = this._targets;
	var elT = this._elTargets;
	var toggled = this._toggled;
	var toggleText = this._toggleText;
	var img = this._img;
	var t,disp;
	
	if (toggled) {
		disp = "";
		this._toggled = false;
	} else {
		disp = "none";
		this._toggled = true;
	}
	
	if (img) {
		this._toggleText = img.src;
		img.src = toggleText;
	} else if (toggleText) {
		this._toggleText = this.innerHTML;
		this.innerHTML = toggleText;
	}
		
	for (var i=0;i<elT.length;i++){
		elT[i].style.display = disp;
	}
}

function enableFauxRadio(queries){
	var fr = new FauxRadio()
	var cbs; 
	for (var i=0;i<queries.length;i++){
		cbs = cssQuery(queries[i]);
		for (var c=0;c<cbs.length;c++){
			fr.addCheckbox(cbs[c]);
		}
	}
}

FauxRadio = function(){
	this.cbs = [];	
}

FauxRadio.prototype = {
	addCheckbox:
		function(cb){
			this.cbs.push(cb);
			var _this = this;
			if (cb.onclick) cb.FauxRadioCl = cb.onclick;
			cb.onclick = function(){
				if (this.FauxRadioCl) this.FauxRadioCl();
				_this.click(this)
			} 
		},
	click:
		function(cb){
			if (!cb.checked) return true;
			for (var i=0;i<this.cbs.length;i++){
				if (this.cbs[i].checked && this.cbs[i]!=cb) this.cbs[i].checked = false;
			}
			return true;
		},
	cbs:null
}


enableAutoLabel = function(elLabel){
	var el = $(elLabel.attributes["for"].value);
	var label = elLabel.innerHTML; //doesn't strip tags, make sure no html inside labels?
	el._autoLabel = label;
	
	var blur = function() {
		if (this.value == "" && this._autoLabel){
			this.value=this._autoLabel;
		}
	}
	blur.apply(el);
	
	var focus = function() {
		if (this.value.toLowerCase()==this._autoLabel.toLowerCase()){
			this.value="";
		}
	} 
	
	el.onfocus = focus;
	el.onblur = blur;
	blur.apply(el);
}


applyVeil = function(el){
	elParent = el.parentNode;
	elCDiv = document.createElement("div");
	do {
		elCDiv.appendChild(elParent.childNodes[0]);
	} while (elParent.childNodes.length>0);
	elParent.appendChild(elCDiv);
	el.style.width = elCDiv.offsetWidth+"px";
	el.style.height = elCDiv.offsetHeight+"px";		
}

function filterSelect(oSource,oTarget,optionalSelectedValue){

	if (oSource == null || oSource.selectedIndex<0) return false;
	id = oSource[oSource.selectedIndex].value
	if (id.indexOf(":")>-1) id = id.split(":")[1];
	options = oTarget.getElementsByTagName("option");
	optionsCache = oTarget._optionsCache.getElementsByTagName("option");

	var count = 0;
	var changed = false;
	//move from original to cache
	for (var i=0;i<options.length;i++){
		if (options[i].value.indexOf(":")>-1){
			if (options[i].value.indexOf(id+":")!=0){
				options[i].selected = false;
				oTarget._optionsCache.appendChild(options[i])
				changed = true;
				i--;
			}
		}
	}
	//move from cache to original
	for (var i=0;i<optionsCache.length;i++){
		if (optionsCache[i].value.indexOf(id+":")==0){
			oTarget.appendChild(optionsCache[i]);
			changed = true;
			i--;	
		}
	}
	
	count = oTarget.getElementsByTagName("option").length;
	if (count>2 && oTarget.parentNode.style.display=="none"){
		oTarget.parentNode.style.display = "";
	} else if (count<=2 && oTarget.parentNode.style.display!="none"){
		oTarget.parentNode.style.display = "none";
	}
	if (optionalSelectedValue)
	{
		for (var i=0;i<oTarget.length;i++)
			if (oTarget[i].value==optionalSelectedValue)
				oTarget.selectedIndex = i;
	}
	else if (changed) 
		oTarget.options[0].selected = true;
		
	if (oTarget.onchange) oTarget.onchange();
}

function registerFilterSelect(sourceId,targetId){
	var source = $(sourceId);
	var target = $(targetId);
	target._optionsCache = target.cloneNode(false);
	target._optionsCache.id = target.id+"OptionsCache";

	var fn;

	if (source.onkeyup && source.onkeyup!='')
		fn = function(){
			filterSelect(source,target);
			optionToggle(this);
		}
	else
		fn = function(){
			filterSelect(source,target);
		}
	
	source.onchange = fn;
	source.onkeyup = fn;
	filterSelect(source,target,target[target.selectedIndex].value);
	//fn();
}


function optionToggle(elSelect){
	if (!elSelect.id)
		return;

    var elOption = elSelect[elSelect.selectedIndex]
	var elHandle = $(elOption.id+"-HANDLE");
	if (elHandle==elSelect._currentHandle) return;
	if (elSelect._currentHandle){
	     console.log("toggle current: ",elSelect._currentHandle)
	     toggleHandle.apply(elSelect._currentHandle)
	     elSelect._currentHandle = null;
	}
	if (elHandle){
	    console.log("toggle new: ",elHandle)
	    elSelect._currentHandle = elHandle;
        toggleHandle.apply(elHandle);
	}
}

function registerOptionToggle(optionId,targets){
    var handleDiv = $("optionToggleHandleDiv");
    if (!handleDiv) {
        handleDiv = document.createElement("div");
        handleDiv.id = "optionToggleHandleDiv";
        handleDiv.style.display = "none";
        $(optionId).parentNode.parentNode.appendChild(handleDiv);
        
    }

    var elHandle = document.createElement("div");
    elHandle.id = optionId+"-HANDLE";
    handleDiv.appendChild(elHandle);
	enableToggle("#"+optionId+"-HANDLE",null,targets,true)

	var source = $(optionId);
	if (!source.parentNode.onkeyup){
	    var fn = function(){
		    optionToggle(this);
	    }
	    source.parentNode.onkeyup = fn;
	    source.parentNode.onchange = fn;
	}
}

//##################################################################################
//##################################################################################

