 /****************************************************************
  *                                                              *
  *  CurvyCorners                                                *
  *  ------------                                                *
  *                                                              *
  *  This script generates rounded corners for your boxes.       *
  *                                                              *
  *  Version 2.1                                                 *
  *  Copyright (c) 2010 Cameron Cooke                            *
  *  Contributors: Tim Hutchison, CPK Smithies, Terry Rigel,     *
  *                Simó Albert.                                  *
  *                                                              *
  *  Website: http://www.curvycorners.net                        *
  *  SVN:     http://curvycorners.googlecode.com/                *
  *  Email:   cameron@curvycorners.net                           *
  *  Discuss: http://groups.google.com/group/curvycorners        *
  *                                                              *
  *  Please consult the SVN for a list of changes since the last *
  *  revision.                                                   *
  *                                                              *
  *  This library is free software; you can redistribute         *
  *  it and/or modify it under the terms of the GNU              *
  *  Lesser General Public License as published by the           *
  *  Free Software Foundation; either version 2.1 of the         *
  *  License, or (at your option) any later version.             *
  *                                                              *
  *  This library is distributed in the hope that it will        *
  *  be useful, but WITHOUT ANY WARRANTY; without even the       *
  *  implied warranty of MERCHANTABILITY or FITNESS FOR A        *
  *  PARTICULAR PURPOSE. See the GNU Lesser General Public       *
  *  License for more details.                                   *
  *                                                              *
  *  You should have received a copy of the GNU Lesser           *
  *  General Public License along with this library;             *
  *  Inc., 59 Temple Place, Suite 330, Boston,                   *
  *  MA 02111-1307 USA                                           *
  *                                                              *
  ****************************************************************/

function curvyObject(){var a;this.box=arguments[1];this.settings=arguments[0];this.topContainer=this.bottomContainer=this.shell=a=null;var b=this.box.clientWidth;if("canHaveChildren"in this.box&&!this.box.canHaveChildren||this.box.tagName==="TABLE")throw new Error(this.errmsg("You cannot apply corners to "+this.box.tagName+" elements.","Error"));if(!b&&curvyBrowser.isIE){this.box.style.zoom=1;b=this.box.clientWidth}if(!b&&curvyBrowser.get_style(this.box,"display")==="inline"){this.box.style.display="inline-block";curvyCorners.alert(this.errmsg("Converting inline element to inline-block","warning"));b=this.box.clientWidth}if(!b){if(!this.box.parentNode)throw this.newError("box has no parent!");for(a=this.box;;a=a.parentNode){if(!a||a.tagName==="BODY"){this.applyCorners=function(){};curvyCorners.alert(this.errmsg("zero-width box with no accountable parent","warning"));return}if(curvyBrowser.get_style(a,"display")==="none")break}var c=a.style.display;a.style.display="block";b=this.box.clientWidth}if(!b){curvyCorners.alert(this.errmsg("zero-width box, cannot display","error"));this.applyCorners=function(){};return}if(arguments[0]instanceof curvyCnrSpec)this.spec=arguments[0].cloneOn(this.box);else{this.spec=new curvyCnrSpec("");this.spec.setfrom(this.settings)}var d=curvyBrowser.get_style(this.box,"borderTopWidth");var e=curvyBrowser.get_style(this.box,"borderBottomWidth");var f=curvyBrowser.get_style(this.box,"borderLeftWidth");var g=curvyBrowser.get_style(this.box,"borderRightWidth");var h=curvyBrowser.get_style(this.box,"borderTopColor");var i=curvyBrowser.get_style(this.box,"borderBottomColor");var j=curvyBrowser.get_style(this.box,"borderLeftColor");var k=curvyBrowser.get_style(this.box,"borderRightColor");var l=curvyBrowser.get_style(this.box,"borderTopStyle");var m=curvyBrowser.get_style(this.box,"borderBottomStyle");var n=curvyBrowser.get_style(this.box,"borderLeftStyle");var o=curvyBrowser.get_style(this.box,"borderRightStyle");var p=curvyBrowser.get_style(this.box,"backgroundColor");var q=curvyBrowser.get_style(this.box,"backgroundImage");var r=curvyBrowser.get_style(this.box,"backgroundRepeat");var s,t;if(this.box.currentStyle&&this.box.currentStyle.backgroundPositionX){s=curvyBrowser.get_style(this.box,"backgroundPositionX");t=curvyBrowser.get_style(this.box,"backgroundPositionY")}else{s=curvyBrowser.get_style(this.box,"backgroundPosition");s=s.split(" ");t=s.length===2?s[1]:0;s=s[0]}var u=curvyBrowser.get_style(this.box,"position");var v=curvyBrowser.get_style(this.box,"paddingTop");var w=curvyBrowser.get_style(this.box,"paddingBottom");var x=curvyBrowser.get_style(this.box,"paddingLeft");var y=curvyBrowser.get_style(this.box,"paddingRight");var A=curvyBrowser.get_style(this.box,"border");var B=curvyBrowser.ieVer>7?curvyBrowser.get_style(this.box,"filter"):null;var C=this.spec.get("tR");var D=this.spec.get("bR");var E=function(a){if(typeof a==="number")return a;if(typeof a!=="string")throw new Error("unexpected styleToNPx type "+typeof a);var b=/^[-\d.]([a-z]+)$/.exec(a);if(b&&b[1]!="px")throw new Error("Unexpected unit "+b[1]);if(isNaN(a=parseInt(a)))a=0;return a};var F=function(a){return a<=0?"0":a+"px"};try{this.borderWidth=E(d);this.borderWidthB=E(e);this.borderWidthL=E(f);this.borderWidthR=E(g);this.boxColour=curvyObject.format_colour(p);this.topPadding=E(v);this.bottomPadding=E(w);this.leftPadding=E(x);this.rightPadding=E(y);this.boxWidth=b;this.boxHeight=this.box.clientHeight;this.borderColour=curvyObject.format_colour(h);this.borderColourB=curvyObject.format_colour(i);this.borderColourL=curvyObject.format_colour(j);this.borderColourR=curvyObject.format_colour(k);this.borderString=this.borderWidth+"px"+" "+l+" "+this.borderColour;this.borderStringB=this.borderWidthB+"px"+" "+m+" "+this.borderColourB;this.borderStringL=this.borderWidthL+"px"+" "+n+" "+this.borderColourL;this.borderStringR=this.borderWidthR+"px"+" "+o+" "+this.borderColourR;this.backgroundImage=q!="none"?q:"";this.backgroundRepeat=r}catch(G){throw this.newError(G.message)}var H=this.boxHeight;var I=b;if(curvyBrowser.isOp){s=E(s);t=E(t);if(s){var J=I+this.borderWidthL+this.borderWidthR;if(s>J)s=J;s=J/s*100+"%"}if(t){var J=H+this.borderWidth+this.borderWidthB;if(t>J)t=J;t=J/t*100+"%"}}if(curvyBrowser.quirksMode){}else{this.boxWidth-=this.leftPadding+this.rightPadding;this.boxHeight-=this.topPadding+this.bottomPadding}this.contentContainer=document.createElement("div");if(B)this.contentContainer.style.filter=B;while(this.box.firstChild)this.contentContainer.appendChild(this.box.removeChild(this.box.firstChild));if(u!="absolute")this.box.style.position="relative";this.box.style.padding="0";this.box.style.border=this.box.style.backgroundImage="none";this.box.style.backgroundColor="transparent";this.box.style.width=I+this.borderWidthL+this.borderWidthR+"px";this.box.style.height=H+this.borderWidth+this.borderWidthB+"px";var K=document.createElement("div");K.style.position="absolute";if(B)K.style.filter=B;if(curvyBrowser.quirksMode){K.style.width=I+this.borderWidthL+this.borderWidthR+"px"}else{K.style.width=I+"px"}K.style.height=F(H+this.borderWidth+this.borderWidthB-C-D);K.style.padding="0";K.style.top=C+"px";K.style.left="0";if(this.borderWidthL)K.style.borderLeft=this.borderStringL;if(this.borderWidth&&!C)K.style.borderTop=this.borderString;if(this.borderWidthR)K.style.borderRight=this.borderStringR;if(this.borderWidthB&&!D)K.style.borderBottom=this.borderStringB;K.style.backgroundColor=p;K.style.backgroundImage=this.backgroundImage;K.style.backgroundRepeat=this.backgroundRepeat;K.style.direction="ltr";this.shell=this.box.appendChild(K);b=curvyBrowser.get_style(this.shell,"width");if(b===""||b==="auto"||b.indexOf("%")!==-1)throw this.newError("Shell width is "+b);this.boxWidth=b!=""&&b!="auto"&&b.indexOf("%")==-1?parseInt(b):this.shell.clientWidth;this.applyCorners=function(){this.backgroundPosX=this.backgroundPosY=0;if(this.backgroundObject){var b=function(a,b,c){if(a===0)return 0;var d;if(a==="right"||a==="bottom")return c-b;if(a==="center")return(c-b)/2;if(a.indexOf("%")>0)return(c-b)*100/parseInt(a);return E(a)};this.backgroundPosX=b(s,this.backgroundObject.width,I);this.backgroundPosY=b(t,this.backgroundObject.height,H)}else if(this.backgroundImage){this.backgroundPosX=E(s);this.backgroundPosY=E(t)}if(C){d=document.createElement("div");d.style.width=this.boxWidth+"px";d.style.fontSize="1px";d.style.overflow="hidden";d.style.position="absolute";d.style.paddingLeft=this.borderWidth+"px";d.style.paddingRight=this.borderWidth+"px";d.style.height=C+"px";d.style.top=-C+"px";d.style.left=-this.borderWidthL+"px";this.topContainer=this.shell.appendChild(d)}if(D){var d=document.createElement("div");d.style.width=this.boxWidth+"px";d.style.fontSize="1px";d.style.overflow="hidden";d.style.position="absolute";d.style.paddingLeft=this.borderWidthB+"px";d.style.paddingRight=this.borderWidthB+"px";d.style.height=D+"px";d.style.bottom=-D+"px";d.style.left=-this.borderWidthL+"px";this.bottomContainer=this.shell.appendChild(d)}var e=this.spec.cornerNames();for(var f in e)if(!isNaN(f)){var g=e[f];var h=this.spec[g+"R"];var i,j,k,l;if(g=="tr"||g=="tl"){i=this.borderWidth;j=this.borderColour;l=this.borderWidth}else{i=this.borderWidthB;j=this.borderColourB;l=this.borderWidthB}k=h-l;var m=document.createElement("div");m.style.height=this.spec.get(g+"Ru");m.style.width=this.spec.get(g+"Ru");m.style.position="absolute";m.style.fontSize="1px";m.style.overflow="hidden";var n,o,p;var q=B?parseInt(/alpha\(opacity.(\d+)\)/.exec(B)[1]):100;for(n=0;n<h;++n){var r=n+1>=k?-1:Math.floor(Math.sqrt(Math.pow(k,2)-Math.pow(n+1,2)))-1;if(k!=h){var u=n>=k?-1:Math.ceil(Math.sqrt(Math.pow(k,2)-Math.pow(n,2)));var v=n+1>=h?-1:Math.floor(Math.sqrt(Math.pow(h,2)-Math.pow(n+1,2)))-1}var w=n>=h?-1:Math.ceil(Math.sqrt(Math.pow(h,2)-Math.pow(n,2)));if(r>-1)this.drawPixel(n,0,this.boxColour,q,r+1,m,true,h);if(k!=h){if(this.spec.antiAlias){for(o=r+1;o<u;++o){if(this.backgroundImage!=""){var x=curvyObject.pixelFraction(n,o,k)*100;this.drawPixel(n,o,j,q,1,m,x>=30,h)}else if(this.boxColour!=="transparent"){var y=curvyObject.BlendColour(this.boxColour,j,curvyObject.pixelFraction(n,o,k));this.drawPixel(n,o,y,q,1,m,false,h)}else this.drawPixel(n,o,j,q>>1,1,m,false,h)}if(v>=u){if(u==-1)u=0;this.drawPixel(n,u,j,q,v-u+1,m,false,0)}p=j;o=v}else{if(v>r){this.drawPixel(n,r+1,j,q,v-r,m,false,0)}}}else{p=this.boxColour;o=r}if(this.spec.antiAlias&&this.boxColour!=="transparent"){while(++o<w){this.drawPixel(n,o,p,curvyObject.pixelFraction(n,o,h)*q,1,m,l<=0,h)}}}for(var A=0,F=m.childNodes.length;A<F;++A){var G=m.childNodes[A];var J=parseInt(G.style.top);var K=parseInt(G.style.left);var L=parseInt(G.style.height);if(g=="tl"||g=="bl"){G.style.left=h-K-1+"px"}if(g=="tr"||g=="tl"){G.style.top=h-L-J+"px"}G.style.backgroundRepeat=this.backgroundRepeat;if(this.backgroundImage)switch(g){case"tr":G.style.backgroundPosition=this.backgroundPosX-this.borderWidthL+h-I-K+"px "+(this.backgroundPosY+L+J+this.borderWidth-h)+"px";break;case"tl":G.style.backgroundPosition=this.backgroundPosX-h+K+1+this.borderWidthL+"px "+(this.backgroundPosY-h+L+J+this.borderWidth)+"px";break;case"bl":G.style.backgroundPosition=this.backgroundPosX-h+K+1+this.borderWidthL+"px "+(this.backgroundPosY-H-this.borderWidth+(curvyBrowser.quirksMode?J:-J)+h)+"px";break;case"br":if(curvyBrowser.quirksMode){G.style.backgroundPosition=this.backgroundPosX-this.borderWidthL-I+h-K+"px "+(this.backgroundPosY-H-this.borderWidth+J+h)+"px"}else{G.style.backgroundPosition=this.backgroundPosX-this.borderWidthL-I+h-K+"px "+(this.backgroundPosY-H-this.borderWidth+h-J)+"px"}}}switch(g){case"tl":m.style.top=m.style.left="0";this.topContainer.appendChild(m);break;case"tr":m.style.top=m.style.right="0";this.topContainer.appendChild(m);break;case"bl":m.style.bottom=m.style.left="0";this.bottomContainer.appendChild(m);break;case"br":m.style.bottom=m.style.right="0";this.bottomContainer.appendChild(m)}}var M={t:this.spec.radiusdiff("t"),b:this.spec.radiusdiff("b")};for(z in M){if(typeof z==="function")continue;if(!this.spec.get(z+"R"))continue;if(M[z]){var N=this.spec[z+"lR"]<this.spec[z+"rR"]?z+"l":z+"r";var O=document.createElement("div");O.style.height=M[z]+"px";O.style.width=this.spec.get(N+"Ru");O.style.position="absolute";O.style.fontSize="1px";O.style.overflow="hidden";O.style.backgroundColor=this.boxColour;if(B)O.style.filter=B;O.style.backgroundImage=this.backgroundImage;O.style.backgroundRepeat=this.backgroundRepeat;switch(N){case"tl":O.style.bottom=O.style.left="0";O.style.borderLeft=this.borderStringL;O.style.backgroundPosition=this.backgroundPosX+"px "+(this.borderWidth+this.backgroundPosY-this.spec.tlR)+"px";this.topContainer.appendChild(O);break;case"tr":O.style.bottom=O.style.right="0";O.style.borderRight=this.borderStringR;O.style.backgroundPosition=this.backgroundPosX-this.boxWidth+this.spec.trR+"px "+(this.borderWidth+this.backgroundPosY-this.spec.trR)+"px";this.topContainer.appendChild(O);break;case"bl":O.style.top=O.style.left="0";O.style.borderLeft=this.borderStringL;O.style.backgroundPosition=this.backgroundPosX+"px "+(this.backgroundPosY-this.borderWidth-this.boxHeight+M[z]+this.spec.blR)+"px";this.bottomContainer.appendChild(O);break;case"br":O.style.top=O.style.right="0";O.style.borderRight=this.borderStringR;O.style.backgroundPosition=this.borderWidthL+this.backgroundPosX-this.boxWidth+this.spec.brR+"px "+(this.backgroundPosY-this.borderWidth-this.boxHeight+M[z]+this.spec.brR)+"px";this.bottomContainer.appendChild(O)}}var P=document.createElement("div");if(B)P.style.filter=B;P.style.position="relative";P.style.fontSize="1px";P.style.overflow="hidden";P.style.width=this.fillerWidth(z);P.style.backgroundColor=this.boxColour;P.style.backgroundImage=this.backgroundImage;P.style.backgroundRepeat=this.backgroundRepeat;switch(z){case"t":if(this.topContainer){if(curvyBrowser.quirksMode){P.style.height=100+C+"px"}else{P.style.height=100+C-this.borderWidth+"px"}P.style.marginLeft=this.spec.tlR?this.spec.tlR-this.borderWidthL+"px":"0";P.style.borderTop=this.borderString;if(this.backgroundImage){var Q=this.spec.tlR?this.borderWidthL+this.backgroundPosX-this.spec.tlR+"px ":this.backgroundPosX+"px ";P.style.backgroundPosition=Q+this.backgroundPosY+"px";this.shell.style.backgroundPosition=this.backgroundPosX+"px "+(this.backgroundPosY-C+this.borderWidthL)+"px"}this.topContainer.appendChild(P)}break;case"b":if(this.bottomContainer){if(curvyBrowser.quirksMode){P.style.height=D+"px"}else{P.style.height=D-this.borderWidthB+"px"}P.style.marginLeft=this.spec.blR?this.spec.blR-this.borderWidthL+"px":"0";P.style.borderBottom=this.borderStringB;if(this.backgroundImage){var Q=this.spec.blR?this.backgroundPosX+this.borderWidthL-this.spec.blR+"px ":this.backgroundPosX+"px ";P.style.backgroundPosition=Q+(this.backgroundPosY-H-this.borderWidth+D)+"px"}this.bottomContainer.appendChild(P)}}}this.contentContainer.style.position="absolute";this.contentContainer.className="autoPadDiv";this.contentContainer.style.left=this.borderWidthL+"px";this.contentContainer.style.paddingTop=this.topPadding+"px";this.contentContainer.style.top=this.borderWidth+"px";this.contentContainer.style.paddingLeft=this.leftPadding+"px";this.contentContainer.style.paddingRight=this.rightPadding+"px";z=I;if(!curvyBrowser.quirksMode)z-=this.leftPadding+this.rightPadding;this.contentContainer.style.width=z+"px";this.contentContainer.style.textAlign=curvyBrowser.get_style(this.box,"textAlign");this.box.style.textAlign="left";this.box.appendChild(this.contentContainer);if(a)a.style.display=c};if(this.backgroundImage){s=this.backgroundCheck(s);t=this.backgroundCheck(t);if(this.backgroundObject){this.backgroundObject.holdingElement=this;this.dispatch=this.applyCorners;this.applyCorners=function(){if(this.backgroundObject.complete)this.dispatch();else this.backgroundObject.onload=new Function("curvyObject.dispatch(this.holdingElement);")}}}}function curvyCorners(){var a,b,c,d,e;if(typeof arguments[0]!=="object")throw curvyCorners.newError("First parameter of curvyCorners() must be an object.");if(arguments[0]instanceof curvyCnrSpec){d=arguments[0];if(!d.selectorText&&typeof arguments[1]==="string")d.selectorText=arguments[1]}else{if(typeof arguments[1]!=="object"&&typeof arguments[1]!=="string")throw curvyCorners.newError("Second parameter of curvyCorners() must be an object or a class name.");b=arguments[1];if(typeof b!=="string")b="";if(b!==""&&b.charAt(0)!=="."&&"autoPad"in arguments[0])b="."+b;d=new curvyCnrSpec(b);d.setfrom(arguments[0])}if(d.selectorText){e=0;var f=d.selectorText.replace(/\s+$/,"").split(/,\s*/);c=new Array;for(a=0;a<f.length;++a){if((b=f[a].lastIndexOf("#"))!==-1)f[a]=f[a].substr(b);c=c.concat(curvyCorners.getElementsBySelector(f[a].split(/\s+/)))}}else{e=1;c=arguments}for(a=e,b=c.length;a<b;++a){var g=c[a];var h=false;if(!g.className)g.className="curvyIgnore";else{h=g.className.indexOf("curvyIgnore")!==-1;if(!h)g.className+=" curvyIgnore"}if(!h){if(g.className.indexOf("curvyRedraw")!==-1){if(typeof curvyCorners.redrawList==="undefined")curvyCorners.redrawList=new Array;curvyCorners.redrawList.push({node:g,spec:d,copy:g.cloneNode(false)})}var i=new curvyObject(d,g);i.applyCorners()}}}function operasheet(a){var b=document.styleSheets.item(a).ownerNode.text;b=b.replace(/\/\*(\n|\r|.)*?\*\//g,"");var c=new RegExp("^\\s*([\\w.#][-\\w.#, ]+)[\\n\\s]*\\{([^}]+border-((top|bottom)-(left|right)-)?radius[^}]*)\\}","mg");var d;this.rules=[];while((d=c.exec(b))!==null){var e=new RegExp("(..)border-((top|bottom)-(left|right)-)?radius:\\s*([\\d.]+)(in|em|px|ex|pt)","g");var f,g=new curvyCnrSpec(d[1]);while((f=e.exec(d[2]))!==null)if(f[1]!=="z-")g.setcorner(f[3],f[4],f[5],f[6]);this.rules.push(g)}}function curvyCnrSpec(a){this.selectorText=a;this.tlR=this.trR=this.blR=this.brR=0;this.tlu=this.tru=this.blu=this.bru="";this.antiAlias=true}function browserdetect(){var a=navigator.userAgent.toLowerCase();this.isIE=a.indexOf("msie")>-1;if(this.isIE){this.ieVer=/msie\s(\d\.\d)/.exec(a)[1];this.quirksMode=!document.compatMode||document.compatMode.indexOf("BackCompat")>-1;this.get_style=function(a,b){if(!(b in a.currentStyle))return"";var c=/^([\d.]+)(\w*)/.exec(a.currentStyle[b]);if(!c)return a.currentStyle[b];if(c[1]==0)return"0";if(c[2]&&c[2]!=="px"){var d=a.style.left;var e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=c[1]+c[2];c[0]=a.style.pixelLeft;a.style.left=d;a.runtimeStyle.left=e}return c[0]};this.supportsCorners=false}else{this.ieVer=this.quirksMode=0;this.get_style=function(a,b){b=b.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return document.defaultView.getComputedStyle(a,"").getPropertyValue(b)};this.isSafari=a.indexOf("safari")!=-1;this.isWebKit=a.indexOf("webkit")!=-1;this.isOp="opera"in window;if(this.isOp)this.supportsCorners=(this.isOp=window.opera.version())>=10.5;else{if(!this.isWebkit){if(!(this.isMoz=a.indexOf("firefox")!==-1)){for(var b=document.childNodes.length;--b>=0;)if("style"in document.childNodes[b]){this.isMoz="MozBorderRadius"in document.childNodes[b];break}}}this.supportsCorners=this.isWebKit||this.isMoz}}}var curvyBrowser=new browserdetect;if(curvyBrowser.isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}curvyCnrSpec.prototype.setcorner=function(a,b,c,d){if(!a){this.tlR=this.trR=this.blR=this.brR=parseInt(c);this.tlu=this.tru=this.blu=this.bru=d}else{propname=a.charAt(0)+b.charAt(0);this[propname+"R"]=parseInt(c);this[propname+"u"]=d}};curvyCnrSpec.prototype.get=function(a){if(/^(t|b)(l|r)(R|u)$/.test(a))return this[a];if(/^(t|b)(l|r)Ru$/.test(a)){var b=a.charAt(0)+a.charAt(1);return this[b+"R"]+this[b+"u"]}if(/^(t|b)Ru?$/.test(a)){var c=a.charAt(0);c+=this[c+"lR"]>this[c+"rR"]?"l":"r";var d=this[c+"R"];if(a.length===3&&a.charAt(2)==="u")d+=this[c="u"];return d}throw new Error("Don't recognize property "+a)};curvyCnrSpec.prototype.radiusdiff=function(a){if(a!=="t"&&a!=="b")throw new Error("Param must be 't' or 'b'");return Math.abs(this[a+"lR"]-this[a+"rR"])};curvyCnrSpec.prototype.setfrom=function(a){this.tlu=this.tru=this.blu=this.bru="px";if("tl"in a)this.tlR=a.tl.radius;if("tr"in a)this.trR=a.tr.radius;if("bl"in a)this.blR=a.bl.radius;if("br"in a)this.brR=a.br.radius;if("antiAlias"in a)this.antiAlias=a.antiAlias};curvyCnrSpec.prototype.cloneOn=function(a){var b=["tl","tr","bl","br"];var c=0;var d,e;for(d in b)if(!isNaN(d)){e=this[b[d]+"u"];if(e!==""&&e!=="px"){c=new curvyCnrSpec;break}}if(!c)c=this;else{var f,g,h=curvyBrowser.get_style(a,"left");for(d in b)if(!isNaN(d)){f=b[d];e=this[f+"u"];g=this[f+"R"];if(e!=="px"){var h=a.style.left;a.style.left=g+e;g=a.style.pixelLeft;a.style.left=h}c[f+"R"]=g;c[f+"u"]="px"}a.style.left=h}return c};curvyCnrSpec.prototype.radiusSum=function(a){if(a!=="t"&&a!=="b")throw new Error("Param must be 't' or 'b'");return this[a+"lR"]+this[a+"rR"]};curvyCnrSpec.prototype.radiusCount=function(a){var b=0;if(this[a+"lR"])++b;if(this[a+"rR"])++b;return b};curvyCnrSpec.prototype.cornerNames=function(){var a=[];if(this.tlR)a.push("tl");if(this.trR)a.push("tr");if(this.blR)a.push("bl");if(this.brR)a.push("br");return a};operasheet.contains_border_radius=function(a){return/border-((top|bottom)-(left|right)-)?radius/.test(document.styleSheets.item(a).ownerNode.text)};curvyCorners.prototype.applyCornersToAll=function(){throw curvyCorners.newError("This function is now redundant. Just call curvyCorners(). See documentation.")};curvyCorners.redraw=function(){if(curvyBrowser.supportsCorners)return;if(!curvyCorners.redrawList)throw curvyCorners.newError("curvyCorners.redraw() has nothing to redraw.");var a=curvyCorners.block_redraw;curvyCorners.block_redraw=true;for(var b in curvyCorners.redrawList){if(isNaN(b))continue;var c=curvyCorners.redrawList[b];if(!c.node.clientWidth)continue;var d=c.copy.cloneNode(false);for(var e=c.node.firstChild;e!=null;e=e.nextSibling)if(e.className==="autoPadDiv")break;if(!e){curvyCorners.alert("Couldn't find autoPad DIV");break}c.node.parentNode.replaceChild(d,c.node);var f=e.getElementsByTagName("script");for(var g=f.length-1;g>=0;--g)f[g].parentNode.removeChild(f[g]);while(e.firstChild)d.appendChild(e.removeChild(e.firstChild));c=new curvyObject(c.spec,c.node=d);c.applyCorners()}curvyCorners.block_redraw=a};curvyCorners.adjust=function(obj,prop,newval){if(!curvyBrowser.supportsCorners){if(!curvyCorners.redrawList)throw curvyCorners.newError("curvyCorners.adjust() has nothing to adjust.");var i,j=curvyCorners.redrawList.length;for(i=0;i<j;++i)if(curvyCorners.redrawList[i].node===obj)break;if(i===j)throw curvyCorners.newError("Object not redrawable");obj=curvyCorners.redrawList[i].copy}if(prop.indexOf(".")===-1)obj[prop]=newval;else eval("obj."+prop+"='"+newval+"'")};curvyCorners.handleWinResize=function(){if(!curvyCorners.block_redraw)curvyCorners.redraw()};curvyCorners.setWinResize=function(a){curvyCorners.block_redraw=!a};curvyCorners.newError=function(a){return new Error("curvyCorners Error:\n"+a)};curvyCorners.alert=function(a){if(typeof curvyCornersVerbose==="undefined"||curvyCornersVerbose)alert(a)};curvyObject.prototype.backgroundCheck=function(a){if(a==="top"||a==="left"||parseInt(a)===0)return 0;if(!/^[-\d.]+px$/.test(a)&&!this.backgroundObject){this.backgroundObject=new Image;var b=function(a){var b=/url\("?([^'"]+)"?\)/.exec(a);return b?b[1]:a};this.backgroundObject.src=b(this.backgroundImage)}return a};curvyObject.dispatch=function(a){if("dispatch"in a)a.dispatch();else throw a.newError("No dispatch function")};curvyObject.prototype.drawPixel=function(a,b,c,d,e,f,g,h){var i=document.createElement("div");i.style.height=e+"px";i.style.width="1px";i.style.position="absolute";i.style.fontSize="1px";i.style.overflow="hidden";var j=this.spec.get("tR");i.style.backgroundColor=c;if(g&&this.backgroundImage!=""){i.style.backgroundImage=this.backgroundImage;i.style.backgroundPosition="-"+(this.boxWidth-(h-a)+this.borderWidth)+"px -"+(this.boxHeight+j+b-this.borderWidth)+"px"}if(d!=100)curvyObject.setOpacity(i,d);i.style.top=b+"px";i.style.left=a+"px";f.appendChild(i)};curvyObject.prototype.fillerWidth=function(a){var b,c;b=curvyBrowser.quirksMode?0:this.spec.radiusCount(a)*this.borderWidthL;if((c=this.boxWidth-this.spec.radiusSum(a)+b)<0)throw this.newError("Radius exceeds box width");return c+"px"};curvyObject.prototype.errmsg=function(a,b){var c="\ntag: "+this.box.tagName;if(this.box.id)c+="\nid: "+this.box.id;if(this.box.className)c+="\nclass: "+this.box.className;var d;if((d=this.box.parentNode)===null)c+="\n(box has no parent)";else{c+="\nParent tag: "+d.tagName;if(d.id)c+="\nParent ID: "+d.id;if(d.className)c+="\nParent class: "+d.className}if(b===undefined)b="warning";return"curvyObject "+b+":\n"+a+c};curvyObject.prototype.newError=function(a){return new Error(this.errmsg(a,"exception"))};curvyObject.IntToHex=function(a){var b=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];return b[a>>>4]+""+b[a&15]};curvyObject.BlendColour=function(a,b,c){if(a==="transparent"||b==="transparent")throw this.newError("Cannot blend with transparent");if(a.charAt(0)!=="#"){a=curvyObject.format_colour(a)}if(b.charAt(0)!=="#"){b=curvyObject.format_colour(b)}var d=parseInt(a.substr(1,2),16);var e=parseInt(a.substr(3,2),16);var f=parseInt(a.substr(5,2),16);var g=parseInt(b.substr(1,2),16);var h=parseInt(b.substr(3,2),16);var i=parseInt(b.substr(5,2),16);if(c>1||c<0)c=1;var j=Math.round(d*c+g*(1-c));if(j>255)j=255;if(j<0)j=0;var k=Math.round(e*c+h*(1-c));if(k>255)k=255;if(k<0)k=0;var l=Math.round(f*c+i*(1-c));if(l>255)l=255;if(l<0)l=0;return"#"+curvyObject.IntToHex(j)+curvyObject.IntToHex(k)+curvyObject.IntToHex(l)};curvyObject.pixelFraction=function(a,b,c){var d;var e=c*c;var f=new Array(2);var g=new Array(2);var h=0;var i="";var j=Math.sqrt(e-Math.pow(a,2));if(j>=b&&j<b+1){i="Left";f[h]=0;g[h]=j-b;++h}j=Math.sqrt(e-Math.pow(b+1,2));if(j>=a&&j<a+1){i+="Top";f[h]=j-a;g[h]=1;++h}j=Math.sqrt(e-Math.pow(a+1,2));if(j>=b&&j<b+1){i+="Right";f[h]=1;g[h]=j-b;++h}j=Math.sqrt(e-Math.pow(b,2));if(j>=a&&j<a+1){i+="Bottom";f[h]=j-a;g[h]=0}switch(i){case"LeftRight":d=Math.min(g[0],g[1])+(Math.max(g[0],g[1])-Math.min(g[0],g[1]))/2;break;case"TopRight":d=1-(1-f[0])*(1-g[1])/2;break;case"TopBottom":d=Math.min(f[0],f[1])+(Math.max(f[0],f[1])-Math.min(f[0],f[1]))/2;break;case"LeftBottom":d=g[0]*f[1]/2;break;default:d=1}return d};curvyObject.rgb2Array=function(a){var b=a.substring(4,a.indexOf(")"));return b.split(", ")};curvyObject.rgb2Hex=function(a){try{var b=curvyObject.rgb2Array(a);var c=parseInt(b[0]);var d=parseInt(b[1]);var e=parseInt(b[2]);var f="#"+curvyObject.IntToHex(c)+curvyObject.IntToHex(d)+curvyObject.IntToHex(e)}catch(g){var h="getMessage"in g?g.getMessage():g.message;throw new Error("Error ("+h+") converting RGB value to Hex in rgb2Hex")}return f};curvyObject.setOpacity=function(a,b){b=b==100?99.999:b;if(curvyBrowser.isSafari&&a.tagName!="IFRAME"){var c=curvyObject.rgb2Array(a.style.backgroundColor);var d=parseInt(c[0]);var e=parseInt(c[1]);var f=parseInt(c[2]);a.style.backgroundColor="rgba("+d+", "+e+", "+f+", "+b/100+")"}else if(typeof a.style.opacity!=="undefined"){a.style.opacity=b/100}else if(typeof a.style.MozOpacity!=="undefined"){a.style.MozOpacity=b/100}else if(typeof a.style.filter!=="undefined"){a.style.filter="alpha(opacity="+b+")"}else if(typeof a.style.KHTMLOpacity!=="undefined"){a.style.KHTMLOpacity=b/100}};curvyCorners.addEvent=function(a,b,c,d){if(a.addEventListener){a.addEventListener(b,c,d);return true}if(a.attachEvent)return a.attachEvent("on"+b,c);a["on"+b]=c;return false};if(typeof addEvent==="undefined")addEvent=curvyCorners.addEvent;curvyObject.getComputedColour=function(a){var b=document.createElement("DIV");b.style.backgroundColor=a;document.body.appendChild(b);if(window.getComputedStyle){var c=document.defaultView.getComputedStyle(b,null).getPropertyValue("background-color");b.parentNode.removeChild(b);if(c.substr(0,3)==="rgb")c=curvyObject.rgb2Hex(c);return c}else{var d=document.body.createTextRange();d.moveToElementText(b);d.execCommand("ForeColor",false,a);var e=d.queryCommandValue("ForeColor");var f="rgb("+(e&255)+", "+((e&65280)>>8)+", "+((e&16711680)>>16)+")";b.parentNode.removeChild(b);d=null;return curvyObject.rgb2Hex(f)}};curvyObject.format_colour=function(a){if(a!=""&&a!="transparent"){if(a.substr(0,3)==="rgb"){a=curvyObject.rgb2Hex(a)}else if(a.charAt(0)!=="#"){a=curvyObject.getComputedColour(a)}else if(a.length===4){a="#"+a.charAt(1)+a.charAt(1)+a.charAt(2)+a.charAt(2)+a.charAt(3)+a.charAt(3)}}return a};curvyCorners.getElementsByClass=function(a,b){var c=new Array;if(b===undefined)b=document;a=a.split(".");var d="*";if(a.length===1){d=a[0];a=false}else{if(a[0])d=a[0];a=a[1]}var e,f,g;if(d.charAt(0)==="#"){f=document.getElementById(d.substr(1));if(f)c.push(f)}else{f=b.getElementsByTagName(d);g=f.length;if(a){var h=new RegExp("(^|\\s)"+a+"(\\s|$)");for(e=0;e<g;++e){if(h.test(f[e].className))c.push(f[e])}}else for(e=0;e<g;++e)c.push(f[e])}return c};curvyCorners.getElementsBySelector=function(a,b){var c;var d=a[0];if(b===undefined)b=document;if(d.indexOf("#")!==-1)c=[b.getElementById(d.substr(1))];else c=curvyCorners.getElementsByClass(d,b);if(a.length>1){var e=[];for(var f=c.length;--f>=0;)e=e.concat(curvyCorners.getElementsBySelector(a.slice(1),c[f]));c=e}return c};if(curvyBrowser.supportsCorners){var curvyCornersNoAutoScan=true;curvyCorners.init=function(){}}else{curvyCorners.scanStyles=function(){function a(a){if(!parseInt(a))return"px";var b=/^[\d.]+(\w+)$/.exec(a);return b[1]}var b,c,d;if(curvyBrowser.isIE){function e(b){var c=b.style;if(curvyBrowser.ieVer>6){var d=c["-moz-border-radius"]||0;var e=c["-moz-border-radius-topright"]||0;var f=c["-moz-border-radius-topleft"]||0;var g=c["-moz-border-radius-bottomright"]||0;var h=c["-moz-border-radius-bottomleft"]||0}else{var d=c["moz-border-radius"]||0;var e=c["moz-border-radius-topright"]||0;var f=c["moz-border-radius-topleft"]||0;var g=c["moz-border-radius-bottomright"]||0;var h=c["moz-border-radius-bottomleft"]||0}if(d){var i=d.split("/");i=i[0].split(/\s+/);if(i[i.length-1]==="")i.pop();switch(i.length){case 3:f=i[0];e=h=i[1];g=i[2];d=false;break;case 2:f=g=i[0];e=h=i[1];d=false;case 1:break;case 4:f=i[0];e=i[1];g=i[2];h=i[3];d=false;break;default:curvyCorners.alert("Illegal corners specification: "+d)}}if(d||f||e||g||h){var j=new curvyCnrSpec(b.selectorText);if(d)j.setcorner(null,null,parseInt(d),a(d));else{if(e)j.setcorner("t","r",parseInt(e),a(e));if(f)j.setcorner("t","l",parseInt(f),a(f));if(h)j.setcorner("b","l",parseInt(h),a(h));if(g)j.setcorner("b","r",parseInt(g),a(g))}curvyCorners(j)}}for(b=0;b<document.styleSheets.length;++b){try{if(document.styleSheets[b].imports){for(c=0;c<document.styleSheets[b].imports.length;++c)for(d=0;d<document.styleSheets[b].imports[c].rules.length;++d)e(document.styleSheets[b].imports[c].rules[d])}for(c=0;c<document.styleSheets[b].rules.length;++c)e(document.styleSheets[b].rules[c])}catch(f){if(typeof curvyCornersVerbose!=="undefined"&&curvyCornersVerbose)alert(f.message+" - ignored")}}}else if(curvyBrowser.isOp){for(b=0;b<document.styleSheets.length;++b){if(operasheet.contains_border_radius(b)){d=new operasheet(b);for(c in d.rules)if(!isNaN(c))curvyCorners(d.rules[c])}}}else curvyCorners.alert("Scanstyles does nothing in Webkit/Firefox/Opera")};curvyCorners.init=function(){if(arguments.callee.done)return;arguments.callee.done=true;if(curvyBrowser.isWebKit&&curvyCorners.init.timer){clearInterval(curvyCorners.init.timer);curvyCorners.init.timer=null}curvyCorners.scanStyles()}}if(typeof curvyCornersNoAutoScan==="undefined"||curvyCornersNoAutoScan===false){if(curvyBrowser.isOp)document.addEventListener("DOMContentLoaded",curvyCorners.init,false);else curvyCorners.addEvent(window,"load",curvyCorners.init,false)}
