// http://code.google.com/p/curvycorners/
// GPL license
// Version 2.1
function browserdetect(){var b=navigator.userAgent.toLowerCase();this.isIE=b.indexOf("msie")>-1;if(this.isIE){this.ieVer=/msie\s(\d\.\d)/.exec(b)[1];this.quirksMode=!document.compatMode||document.compatMode.indexOf("BackCompat")>-1;this.get_style=function(f,h){if(!(h in f.currentStyle)){return""}var d=/^([\d.]+)(\w*)/.exec(f.currentStyle[h]);if(!d){return f.currentStyle[h]}if(d[1]==0){return"0"}if(d[2]&&d[2]!=="px"){var c=f.style.left;var g=f.runtimeStyle.left;f.runtimeStyle.left=f.currentStyle.left;f.style.left=d[1]+d[2];d[0]=f.style.pixelLeft;f.style.left=c;f.runtimeStyle.left=g}return d[0]};this.supportsCorners=false}else{this.ieVer=this.quirksMode=0;this.get_style=function(c,d){d=d.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return document.defaultView.getComputedStyle(c,"").getPropertyValue(d)};this.isSafari=b.indexOf("safari")!=-1;this.isWebKit=b.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=b.indexOf("firefox")!==-1)){for(var a=document.childNodes.length;--a>=0;){if("style" in document.childNodes[a]){this.isMoz="MozBorderRadius" in document.childNodes[a];break}}}}this.supportsCorners=this.isWebKit||this.isMoz}}}var curvyBrowser=new browserdetect;if(curvyBrowser.isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}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}curvyCnrSpec.prototype.setcorner=function(b,c,a,d){if(!b){this.tlR=this.trR=this.blR=this.brR=parseInt(a);this.tlu=this.tru=this.blu=this.bru=d}else{propname=b.charAt(0)+c.charAt(0);this[propname+"R"]=parseInt(a);this[propname+"u"]=d}};curvyCnrSpec.prototype.get=function(d){if(/^(t|b)(l|r)(R|u)$/.test(d)){return this[d]}if(/^(t|b)(l|r)Ru$/.test(d)){var c=d.charAt(0)+d.charAt(1);return this[c+"R"]+this[c+"u"]}if(/^(t|b)Ru?$/.test(d)){var b=d.charAt(0);b+=this[b+"lR"]>this[b+"rR"]?"l":"r";var a=this[b+"R"];if(d.length===3&&d.charAt(2)==="u"){a+=this[b="u"]}return a}throw new Error("Don't recognize property "+d)};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(h){var f=["tl","tr","bl","br"];var j=0;var c,a;for(c in f){if(!isNaN(c)){a=this[f[c]+"u"];if(a!==""&&a!=="px"){j=new curvyCnrSpec;break}}}if(!j){j=this}else{var b,d,g=curvyBrowser.get_style(h,"left");for(c in f){if(!isNaN(c)){b=f[c];a=this[b+"u"];d=this[b+"R"];if(a!=="px"){var g=h.style.left;h.style.left=d+a;d=h.style.pixelLeft;h.style.left=g}j[b+"R"]=d;j[b+"u"]="px"}}h.style.left=g}return j};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};function operasheet(c){var a=document.styleSheets.item(c).ownerNode.text;a=a.replace(/\/\*(\n|\r|.)*?\*\//g,"");var d=new RegExp("^\\s*([\\w.#][-\\w.#, ]+)[\\n\\s]*\\{([^}]+border-((top|bottom)-(left|right)-)?radius[^}]*)\\}","mg");var h;this.rules=[];while((h=d.exec(a))!==null){var g=new RegExp("(..)border-((top|bottom)-(left|right)-)?radius:\\s*([\\d.]+)(in|em|px|ex|pt)","g");var f,b=new curvyCnrSpec(h[1]);while((f=g.exec(h[2]))!==null){if(f[1]!=="z-"){b.setcorner(f[3],f[4],f[5],f[6])}}this.rules.push(b)}}operasheet.contains_border_radius=function(a){return/border-((top|bottom)-(left|right)-)?radius/.test(document.styleSheets.item(a).ownerNode.text)};function curvyCorners(){var g,c,d,b,l;if(typeof arguments[0]!=="object"){throw curvyCorners.newError("First parameter of curvyCorners() must be an object.")}if(arguments[0] instanceof curvyCnrSpec){b=arguments[0];if(!b.selectorText&&typeof arguments[1]==="string"){b.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.")}c=arguments[1];if(typeof c!=="string"){c=""}if(c!==""&&c.charAt(0)!=="."&&"autoPad" in arguments[0]){c="."+c}b=new curvyCnrSpec(c);b.setfrom(arguments[0])}if(b.selectorText){l=0;var h=b.selectorText.replace(/\s+$/,"").split(/,\s*/);d=new Array;for(g=0;g<h.length;++g){if((c=h[g].lastIndexOf("#"))!==-1){h[g]=h[g].substr(c)}d=d.concat(curvyCorners.getElementsBySelector(h[g].split(/\s+/)))}}else{l=1;d=arguments}for(g=l,c=d.length;g<c;++g){var k=d[g];var a=false;if(!k.className){k.className="curvyIgnore"}else{a=k.className.indexOf("curvyIgnore")!==-1;if(!a){k.className+=" curvyIgnore"}}if(!a){if(k.className.indexOf("curvyRedraw")!==-1){if(typeof curvyCorners.redrawList==="undefined"){curvyCorners.redrawList=new Array}curvyCorners.redrawList.push({node:k,spec:b,copy:k.cloneNode(false)})}var f=new curvyObject(b,k);f.applyCorners()}}}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 h=curvyCorners.block_redraw;curvyCorners.block_redraw=true;for(var c in curvyCorners.redrawList){if(isNaN(c)){continue}var g=curvyCorners.redrawList[c];if(!g.node.clientWidth){continue}var d=g.copy.cloneNode(false);for(var f=g.node.firstChild;f!=null;f=f.nextSibling){if(f.className==="autoPadDiv"){break}}if(!f){curvyCorners.alert("Couldn't find autoPad DIV");break}g.node.parentNode.replaceChild(d,g.node);var a=f.getElementsByTagName("script");for(var b=a.length-1;b>=0;--b){a[b].parentNode.removeChild(a[b])}while(f.firstChild){d.appendChild(f.removeChild(f.firstChild))}g=new curvyObject(g.spec,g.node=d);g.applyCorners()}curvyCorners.block_redraw=h};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)}};function curvyObject(){var A;this.box=arguments[1];this.settings=arguments[0];this.topContainer=this.bottomContainer=this.shell=A=null;var w=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(!w&&curvyBrowser.isIE){this.box.style.zoom=1;w=this.box.clientWidth}if(!w&&curvyBrowser.get_style(this.box,"display")==="inline"){this.box.style.display="inline-block";curvyCorners.alert(this.errmsg("Converting inline element to inline-block","warning"));w=this.box.clientWidth}if(!w){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 s=A.style.display;A.style.display="block";w=this.box.clientWidth}if(!w){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 I=curvyBrowser.get_style(this.box,"borderBottomWidth");var D=curvyBrowser.get_style(this.box,"borderLeftWidth");var x=curvyBrowser.get_style(this.box,"borderRightWidth");var b=curvyBrowser.get_style(this.box,"borderTopColor");var a=curvyBrowser.get_style(this.box,"borderBottomColor");var J=curvyBrowser.get_style(this.box,"borderLeftColor");var F=curvyBrowser.get_style(this.box,"borderRightColor");var K=curvyBrowser.get_style(this.box,"borderTopStyle");var m=curvyBrowser.get_style(this.box,"borderBottomStyle");var k=curvyBrowser.get_style(this.box,"borderLeftStyle");var f=curvyBrowser.get_style(this.box,"borderRightStyle");var c=curvyBrowser.get_style(this.box,"backgroundColor");var u=curvyBrowser.get_style(this.box,"backgroundImage");var E=curvyBrowser.get_style(this.box,"backgroundRepeat");var q,p;if(this.box.currentStyle&&this.box.currentStyle.backgroundPositionX){q=curvyBrowser.get_style(this.box,"backgroundPositionX");p=curvyBrowser.get_style(this.box,"backgroundPositionY")}else{q=curvyBrowser.get_style(this.box,"backgroundPosition");q=q.split(" ");p=q.length===2?q[1]:0;q=q[0]}var i=curvyBrowser.get_style(this.box,"position");var M=curvyBrowser.get_style(this.box,"paddingTop");var H=curvyBrowser.get_style(this.box,"paddingBottom");var r=curvyBrowser.get_style(this.box,"paddingLeft");var G=curvyBrowser.get_style(this.box,"paddingRight");var l=curvyBrowser.get_style(this.box,"border");var v=curvyBrowser.ieVer>7?curvyBrowser.get_style(this.box,"filter"):null;var h=this.spec.get("tR");var n=this.spec.get("bR");var o=function(N){if(typeof N==="number"){return N}if(typeof N!=="string"){throw new Error("unexpected styleToNPx type "+typeof N)}var t=/^[-\d.]([a-z]+)$/.exec(N);if(t&&t[1]!="px"){throw new Error("Unexpected unit "+t[1])}if(isNaN(N=parseInt(N))){N=0}return N};var y=function(t){return t<=0?"0":t+"px"};try{this.borderWidth=o(d);this.borderWidthB=o(I);this.borderWidthL=o(D);this.borderWidthR=o(x);this.boxColour=curvyObject.format_colour(c);this.topPadding=o(M);this.bottomPadding=o(H);this.leftPadding=o(r);this.rightPadding=o(G);this.boxWidth=w;this.boxHeight=this.box.clientHeight;this.borderColour=curvyObject.format_colour(b);this.borderColourB=curvyObject.format_colour(a);this.borderColourL=curvyObject.format_colour(J);this.borderColourR=curvyObject.format_colour(F);this.borderString=this.borderWidth+"px "+K+" "+this.borderColour;this.borderStringB=this.borderWidthB+"px "+m+" "+this.borderColourB;this.borderStringL=this.borderWidthL+"px "+k+" "+this.borderColourL;this.borderStringR=this.borderWidthR+"px "+f+" "+this.borderColourR;this.backgroundImage=((u!="none")?u:"");this.backgroundRepeat=E}catch(L){throw this.newError(L.message)}var C=this.boxHeight;var g=w;if(curvyBrowser.isOp){q=o(q);p=o(p);if(q){var B=g+this.borderWidthL+this.borderWidthR;if(q>B){q=B}q=(B/q*100)+"%"}if(p){var B=C+this.borderWidth+this.borderWidthB;if(p>B){p=B}p=(B/p*100)+"%"}}if(curvyBrowser.quirksMode){}else{this.boxWidth-=this.leftPadding+this.rightPadding;this.boxHeight-=this.topPadding+this.bottomPadding}this.contentContainer=document.createElement("div");if(v){this.contentContainer.style.filter=v}while(this.box.firstChild){this.contentContainer.appendChild(this.box.removeChild(this.box.firstChild))}if(i!="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=(g+this.borderWidthL+this.borderWidthR)+"px";this.box.style.height=(C+this.borderWidth+this.borderWidthB)+"px";var j=document.createElement("div");j.style.position="absolute";if(v){j.style.filter=v}if(curvyBrowser.quirksMode){j.style.width=(g+this.borderWidthL+this.borderWidthR)+"px"}else{j.style.width=g+"px"}j.style.height=y(C+this.borderWidth+this.borderWidthB-h-n);j.style.padding="0";j.style.top=h+"px";j.style.left="0";if(this.borderWidthL){j.style.borderLeft=this.borderStringL}if(this.borderWidth&&!h){j.style.borderTop=this.borderString}if(this.borderWidthR){j.style.borderRight=this.borderStringR}if(this.borderWidthB&&!n){j.style.borderBottom=this.borderStringB}j.style.backgroundColor=c;j.style.backgroundImage=this.backgroundImage;j.style.backgroundRepeat=this.backgroundRepeat;j.style.direction="ltr";this.shell=this.box.appendChild(j);w=curvyBrowser.get_style(this.shell,"width");if(w===""||w==="auto"||w.indexOf("%")!==-1){throw this.newError("Shell width is "+w)}this.boxWidth=(w!=""&&w!="auto"&&w.indexOf("%")==-1)?parseInt(w):this.shell.clientWidth;this.applyCorners=function(){this.backgroundPosX=this.backgroundPosY=0;if(this.backgroundObject){var ac=function(aw,t,av){if(aw===0){return 0}var au;if(aw==="right"||aw==="bottom"){return av-t}if(aw==="center"){return(av-t)/2}if(aw.indexOf("%")>0){return(av-t)*100/parseInt(aw)}return o(aw)};this.backgroundPosX=ac(q,this.backgroundObject.width,g);this.backgroundPosY=ac(p,this.backgroundObject.height,C)}else{if(this.backgroundImage){this.backgroundPosX=o(q);this.backgroundPosY=o(p)}}if(h){ab=document.createElement("div");ab.style.width=this.boxWidth+"px";ab.style.fontSize="1px";ab.style.overflow="hidden";ab.style.position="absolute";ab.style.paddingLeft=this.borderWidth+"px";ab.style.paddingRight=this.borderWidth+"px";ab.style.height=h+"px";ab.style.top=-h+"px";ab.style.left=-this.borderWidthL+"px";this.topContainer=this.shell.appendChild(ab)}if(n){var ab=document.createElement("div");ab.style.width=this.boxWidth+"px";ab.style.fontSize="1px";ab.style.overflow="hidden";ab.style.position="absolute";ab.style.paddingLeft=this.borderWidthB+"px";ab.style.paddingRight=this.borderWidthB+"px";ab.style.height=n+"px";ab.style.bottom=-n+"px";ab.style.left=-this.borderWidthL+"px";this.bottomContainer=this.shell.appendChild(ab)}var al=this.spec.cornerNames();for(var ap in al){if(!isNaN(ap)){var ah=al[ap];var ai=this.spec[ah+"R"];var aj,am,R,ak;if(ah=="tr"||ah=="tl"){aj=this.borderWidth;am=this.borderColour;ak=this.borderWidth}else{aj=this.borderWidthB;am=this.borderColourB;ak=this.borderWidthB}R=ai-ak;var aa=document.createElement("div");aa.style.height=this.spec.get(ah+"Ru");aa.style.width=this.spec.get(ah+"Ru");aa.style.position="absolute";aa.style.fontSize="1px";aa.style.overflow="hidden";var Y,X,W;var U=v?parseInt(/alpha\(opacity.(\d+)\)/.exec(v)[1]):100;for(Y=0;Y<ai;++Y){var T=(Y+1>=R)?-1:Math.floor(Math.sqrt(Math.pow(R,2)-Math.pow(Y+1,2)))-1;if(R!=ai){var Q=(Y>=R)?-1:Math.ceil(Math.sqrt(Math.pow(R,2)-Math.pow(Y,2)));var O=(Y+1>=ai)?-1:Math.floor(Math.sqrt(Math.pow(ai,2)-Math.pow((Y+1),2)))-1}var N=(Y>=ai)?-1:Math.ceil(Math.sqrt(Math.pow(ai,2)-Math.pow(Y,2)));if(T>-1){this.drawPixel(Y,0,this.boxColour,U,(T+1),aa,true,ai)}if(R!=ai){if(this.spec.antiAlias){for(X=T+1;X<Q;++X){if(this.backgroundImage!=""){var P=curvyObject.pixelFraction(Y,X,R)*100;this.drawPixel(Y,X,am,U,1,aa,P>=30,ai)}else{if(this.boxColour!=="transparent"){var ag=curvyObject.BlendColour(this.boxColour,am,curvyObject.pixelFraction(Y,X,R));this.drawPixel(Y,X,ag,U,1,aa,false,ai)}else{this.drawPixel(Y,X,am,U>>1,1,aa,false,ai)}}}if(O>=Q){if(Q==-1){Q=0}this.drawPixel(Y,Q,am,U,(O-Q+1),aa,false,0)}W=am;X=O}else{if(O>T){this.drawPixel(Y,(T+1),am,U,(O-T),aa,false,0)}}}else{W=this.boxColour;X=T}if(this.spec.antiAlias&&this.boxColour!=="transparent"){while(++X<N){this.drawPixel(Y,X,W,(curvyObject.pixelFraction(Y,X,ai)*U),1,aa,ak<=0,ai)}}}for(var ae=0,ao=aa.childNodes.length;ae<ao;++ae){var Z=aa.childNodes[ae];var an=parseInt(Z.style.top);var ar=parseInt(Z.style.left);var at=parseInt(Z.style.height);if(ah=="tl"||ah=="bl"){Z.style.left=(ai-ar-1)+"px"}if(ah=="tr"||ah=="tl"){Z.style.top=(ai-at-an)+"px"}Z.style.backgroundRepeat=this.backgroundRepeat;if(this.backgroundImage){switch(ah){case"tr":Z.style.backgroundPosition=(this.backgroundPosX-this.borderWidthL+ai-g-ar)+"px "+(this.backgroundPosY+at+an+this.borderWidth-ai)+"px";break;case"tl":Z.style.backgroundPosition=(this.backgroundPosX-ai+ar+1+this.borderWidthL)+"px "+(this.backgroundPosY-ai+at+an+this.borderWidth)+"px";break;case"bl":Z.style.backgroundPosition=(this.backgroundPosX-ai+ar+1+this.borderWidthL)+"px "+(this.backgroundPosY-C-this.borderWidth+(curvyBrowser.quirksMode?an:-an)+ai)+"px";break;case"br":if(curvyBrowser.quirksMode){Z.style.backgroundPosition=(this.backgroundPosX-this.borderWidthL-g+ai-ar)+"px "+(this.backgroundPosY-C-this.borderWidth+an+ai)+"px"}else{Z.style.backgroundPosition=(this.backgroundPosX-this.borderWidthL-g+ai-ar)+"px "+(this.backgroundPosY-C-this.borderWidth+ai-an)+"px"}}}}switch(ah){case"tl":aa.style.top=aa.style.left="0";this.topContainer.appendChild(aa);break;case"tr":aa.style.top=aa.style.right="0";this.topContainer.appendChild(aa);break;case"bl":aa.style.bottom=aa.style.left="0";this.bottomContainer.appendChild(aa);break;case"br":aa.style.bottom=aa.style.right="0";this.bottomContainer.appendChild(aa)}}}var ad={t:this.spec.radiusdiff("t"),b:this.spec.radiusdiff("b")};for(z in ad){if(typeof z==="function"){continue}if(!this.spec.get(z+"R")){continue}if(ad[z]){var aq=(this.spec[z+"lR"]<this.spec[z+"rR"])?z+"l":z+"r";var S=document.createElement("div");S.style.height=ad[z]+"px";S.style.width=this.spec.get(aq+"Ru");S.style.position="absolute";S.style.fontSize="1px";S.style.overflow="hidden";S.style.backgroundColor=this.boxColour;if(v){S.style.filter=v}S.style.backgroundImage=this.backgroundImage;S.style.backgroundRepeat=this.backgroundRepeat;switch(aq){case"tl":S.style.bottom=S.style.left="0";S.style.borderLeft=this.borderStringL;S.style.backgroundPosition=this.backgroundPosX+"px "+(this.borderWidth+this.backgroundPosY-this.spec.tlR)+"px";this.topContainer.appendChild(S);break;case"tr":S.style.bottom=S.style.right="0";S.style.borderRight=this.borderStringR;S.style.backgroundPosition=(this.backgroundPosX-this.boxWidth+this.spec.trR)+"px "+(this.borderWidth+this.backgroundPosY-this.spec.trR)+"px";this.topContainer.appendChild(S);break;case"bl":S.style.top=S.style.left="0";S.style.borderLeft=this.borderStringL;S.style.backgroundPosition=this.backgroundPosX+"px "+(this.backgroundPosY-this.borderWidth-this.boxHeight+ad[z]+this.spec.blR)+"px";this.bottomContainer.appendChild(S);break;case"br":S.style.top=S.style.right="0";S.style.borderRight=this.borderStringR;S.style.backgroundPosition=(this.borderWidthL+this.backgroundPosX-this.boxWidth+this.spec.brR)+"px "+(this.backgroundPosY-this.borderWidth-this.boxHeight+ad[z]+this.spec.brR)+"px";this.bottomContainer.appendChild(S)}}var V=document.createElement("div");if(v){V.style.filter=v}V.style.position="relative";V.style.fontSize="1px";V.style.overflow="hidden";V.style.width=this.fillerWidth(z);V.style.backgroundColor=this.boxColour;V.style.backgroundImage=this.backgroundImage;V.style.backgroundRepeat=this.backgroundRepeat;switch(z){case"t":if(this.topContainer){if(curvyBrowser.quirksMode){V.style.height=100+h+"px"}else{V.style.height=100+h-this.borderWidth+"px"}V.style.marginLeft=this.spec.tlR?(this.spec.tlR-this.borderWidthL)+"px":"0";V.style.borderTop=this.borderString;if(this.backgroundImage){var af=this.spec.tlR?(this.borderWidthL+this.backgroundPosX-this.spec.tlR)+"px ":this.backgroundPosX+"px ";V.style.backgroundPosition=af+this.backgroundPosY+"px";this.shell.style.backgroundPosition=this.backgroundPosX+"px "+(this.backgroundPosY-h+this.borderWidthL)+"px"}this.topContainer.appendChild(V)}break;case"b":if(this.bottomContainer){if(curvyBrowser.quirksMode){V.style.height=n+"px"}else{V.style.height=n-this.borderWidthB+"px"}V.style.marginLeft=this.spec.blR?(this.spec.blR-this.borderWidthL)+"px":"0";V.style.borderBottom=this.borderStringB;if(this.backgroundImage){var af=this.spec.blR?(this.backgroundPosX+this.borderWidthL-this.spec.blR)+"px ":this.backgroundPosX+"px ";V.style.backgroundPosition=af+(this.backgroundPosY-C-this.borderWidth+n)+"px"}this.bottomContainer.appendChild(V)}}}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=g;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=s}};if(this.backgroundImage){q=this.backgroundCheck(q);p=this.backgroundCheck(p);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);")}}}}}curvyObject.prototype.backgroundCheck=function(b){if(b==="top"||b==="left"||parseInt(b)===0){return 0}if(!(/^[-\d.]+px$/.test(b))&&!this.backgroundObject){this.backgroundObject=new Image;var a=function(d){var c=/url\("?([^'"]+)"?\)/.exec(d);return(c?c[1]:d)};this.backgroundObject.src=a(this.backgroundImage)}return b};curvyObject.dispatch=function(a){if("dispatch" in a){a.dispatch()}else{throw a.newError("No dispatch function")}};curvyObject.prototype.drawPixel=function(k,h,a,g,i,j,c,f){var b=document.createElement("div");b.style.height=i+"px";b.style.width="1px";b.style.position="absolute";b.style.fontSize="1px";b.style.overflow="hidden";var d=this.spec.get("tR");b.style.backgroundColor=a;if(c&&this.backgroundImage!=""){b.style.backgroundImage=this.backgroundImage;b.style.backgroundPosition="-"+(this.boxWidth-(f-k)+this.borderWidth)+"px -"+((this.boxHeight+d+h)-this.borderWidth)+"px"}if(g!=100){curvyObject.setOpacity(b,g)}b.style.top=h+"px";b.style.left=k+"px";j.appendChild(b)};curvyObject.prototype.fillerWidth=function(b){var a,c;a=curvyBrowser.quirksMode?0:this.spec.radiusCount(b)*this.borderWidthL;if((c=this.boxWidth-this.spec.radiusSum(b)+a)<0){throw this.newError("Radius exceeds box width")}return c+"px"};curvyObject.prototype.errmsg=function(c,d){var b="\ntag: "+this.box.tagName;if(this.box.id){b+="\nid: "+this.box.id}if(this.box.className){b+="\nclass: "+this.box.className}var a;if((a=this.box.parentNode)===null){b+="\n(box has no parent)"}else{b+="\nParent tag: "+a.tagName;if(a.id){b+="\nParent ID: "+a.id}if(a.className){b+="\nParent class: "+a.className}}if(d===undefined){d="warning"}return"curvyObject "+d+":\n"+c+b};curvyObject.prototype.newError=function(a){return new Error(this.errmsg(a,"exception"))};curvyObject.IntToHex=function(b){var a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];return a[b>>>4]+""+a[b&15]};curvyObject.BlendColour=function(m,k,h){if(m==="transparent"||k==="transparent"){throw this.newError("Cannot blend with transparent")}if(m.charAt(0)!=="#"){m=curvyObject.format_colour(m)}if(k.charAt(0)!=="#"){k=curvyObject.format_colour(k)}var d=parseInt(m.substr(1,2),16);var l=parseInt(m.substr(3,2),16);var g=parseInt(m.substr(5,2),16);var c=parseInt(k.substr(1,2),16);var j=parseInt(k.substr(3,2),16);var f=parseInt(k.substr(5,2),16);if(h>1||h<0){h=1}var i=Math.round((d*h)+(c*(1-h)));if(i>255){i=255}if(i<0){i=0}var b=Math.round((l*h)+(j*(1-h)));if(b>255){b=255}if(b<0){b=0}var a=Math.round((g*h)+(f*(1-h)));if(a>255){a=255}if(a<0){a=0}return"#"+curvyObject.IntToHex(i)+curvyObject.IntToHex(b)+curvyObject.IntToHex(a)};curvyObject.pixelFraction=function(i,h,a){var k;var f=a*a;var b=new Array(2);var g=new Array(2);var j=0;var c="";var d=Math.sqrt(f-Math.pow(i,2));if(d>=h&&d<(h+1)){c="Left";b[j]=0;g[j]=d-h;++j}d=Math.sqrt(f-Math.pow(h+1,2));if(d>=i&&d<(i+1)){c+="Top";b[j]=d-i;g[j]=1;++j}d=Math.sqrt(f-Math.pow(i+1,2));if(d>=h&&d<(h+1)){c+="Right";b[j]=1;g[j]=d-h;++j}d=Math.sqrt(f-Math.pow(h,2));if(d>=i&&d<(i+1)){c+="Bottom";b[j]=d-i;g[j]=0}switch(c){case"LeftRight":k=Math.min(g[0],g[1])+((Math.max(g[0],g[1])-Math.min(g[0],g[1]))/2);break;case"TopRight":k=1-(((1-b[0])*(1-g[1]))/2);break;case"TopBottom":k=Math.min(b[0],b[1])+((Math.max(b[0],b[1])-Math.min(b[0],b[1]))/2);break;case"LeftBottom":k=g[0]*b[1]/2;break;default:k=1}return k};curvyObject.rgb2Array=function(a){var b=a.substring(4,a.indexOf(")"));return b.split(", ")};curvyObject.rgb2Hex=function(b){try{var c=curvyObject.rgb2Array(b);var h=parseInt(c[0]);var f=parseInt(c[1]);var a=parseInt(c[2]);var d="#"+curvyObject.IntToHex(h)+curvyObject.IntToHex(f)+curvyObject.IntToHex(a)}catch(g){var i="getMessage" in g?g.getMessage():g.message;throw new Error("Error ("+i+") converting RGB value to Hex in rgb2Hex")}return d};curvyObject.setOpacity=function(g,c){c=(c==100)?99.999:c;if(curvyBrowser.isSafari&&g.tagName!="IFRAME"){var b=curvyObject.rgb2Array(g.style.backgroundColor);var f=parseInt(b[0]);var d=parseInt(b[1]);var a=parseInt(b[2]);g.style.backgroundColor="rgba("+f+", "+d+", "+a+", "+c/100+")"}else{if(typeof g.style.opacity!=="undefined"){g.style.opacity=c/100}else{if(typeof g.style.MozOpacity!=="undefined"){g.style.MozOpacity=c/100}else{if(typeof g.style.filter!=="undefined"){g.style.filter="alpha(opacity="+c+")"}else{if(typeof g.style.KHTMLOpacity!=="undefined"){g.style.KHTMLOpacity=c/100}}}}}};curvyCorners.addEvent=function(d,c,b,a){if(d.addEventListener){d.addEventListener(c,b,a);return true}if(d.attachEvent){return d.attachEvent("on"+c,b)}d["on"+c]=b;return false};if(typeof addEvent==="undefined"){addEvent=curvyCorners.addEvent}curvyObject.getComputedColour=function(g){var h=document.createElement("DIV");h.style.backgroundColor=g;document.body.appendChild(h);if(window.getComputedStyle){var f=document.defaultView.getComputedStyle(h,null).getPropertyValue("background-color");h.parentNode.removeChild(h);if(f.substr(0,3)==="rgb"){f=curvyObject.rgb2Hex(f)}return f}else{var a=document.body.createTextRange();a.moveToElementText(h);a.execCommand("ForeColor",false,g);var b=a.queryCommandValue("ForeColor");var c="rgb("+(b&255)+", "+((b&65280)>>8)+", "+((b&16711680)>>16)+")";h.parentNode.removeChild(h);a=null;return curvyObject.rgb2Hex(c)}};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(j,g){var f=new Array;if(g===undefined){g=document}j=j.split(".");var a="*";if(j.length===1){a=j[0];j=false}else{if(j[0]){a=j[0]}j=j[1]}var d,c,b;if(a.charAt(0)==="#"){c=document.getElementById(a.substr(1));if(c){f.push(c)}}else{c=g.getElementsByTagName(a);b=c.length;if(j){var h=new RegExp("(^|\\s)"+j+"(\\s|$)");for(d=0;d<b;++d){if(h.test(c[d].className)){f.push(c[d])}}}else{for(d=0;d<b;++d){f.push(c[d])}}}return f};curvyCorners.getElementsBySelector=function(d,f){var b;var g=d[0];if(f===undefined){f=document}if(g.indexOf("#")!==-1){b=[f.getElementById(g.substr(1))]}else{b=curvyCorners.getElementsByClass(g,f)}if(d.length>1){var a=[];for(var c=b.length;--c>=0;){a=a.concat(curvyCorners.getElementsBySelector(d.slice(1),b[c]))}b=a}return b};if(curvyBrowser.supportsCorners){var curvyCornersNoAutoScan=true;curvyCorners.init=function(){}}else{curvyCorners.scanStyles=function(){function b(h){if(!parseInt(h)){return"px"}var i=/^[\d.]+(\w+)$/.exec(h);return i[1]}var f,d,c;if(curvyBrowser.isIE){function a(o){var j=o.style;if(curvyBrowser.ieVer>6){var h=j["-moz-border-radius"]||0;var i=j["-moz-border-radius-topright"]||0;var m=j["-moz-border-radius-topleft"]||0;var l=j["-moz-border-radius-bottomright"]||0;var n=j["-moz-border-radius-bottomleft"]||0}else{var h=j["moz-border-radius"]||0;var i=j["moz-border-radius-topright"]||0;var m=j["moz-border-radius-topleft"]||0;var l=j["moz-border-radius-bottomright"]||0;var n=j["moz-border-radius-bottomleft"]||0}if(h){var p=h.split("/");p=p[0].split(/\s+/);if(p[p.length-1]===""){p.pop()}switch(p.length){case 3:m=p[0];i=n=p[1];l=p[2];h=false;break;case 2:m=l=p[0];i=n=p[1];h=false;case 1:break;case 4:m=p[0];i=p[1];l=p[2];n=p[3];h=false;break;default:curvyCorners.alert("Illegal corners specification: "+h)}}if(h||m||i||l||n){var k=new curvyCnrSpec(o.selectorText);if(h){k.setcorner(null,null,parseInt(h),b(h))}else{if(i){k.setcorner("t","r",parseInt(i),b(i))}if(m){k.setcorner("t","l",parseInt(m),b(m))}if(n){k.setcorner("b","l",parseInt(n),b(n))}if(l){k.setcorner("b","r",parseInt(l),b(l))}}curvyCorners(k)}}for(f=0;f<document.styleSheets.length;++f){try{if(document.styleSheets[f].imports){for(d=0;d<document.styleSheets[f].imports.length;++d){for(c=0;c<document.styleSheets[f].imports[d].rules.length;++c){a(document.styleSheets[f].imports[d].rules[c])}}}for(d=0;d<document.styleSheets[f].rules.length;++d){a(document.styleSheets[f].rules[d])}}catch(g){if(typeof curvyCornersVerbose!=="undefined"&&curvyCornersVerbose){alert(g.message+" - ignored")}}}}else{if(curvyBrowser.isOp){for(f=0;f<document.styleSheets.length;++f){if(operasheet.contains_border_radius(f)){c=new operasheet(f);for(d in c.rules){if(!isNaN(d)){curvyCorners(c.rules[d])}}}}}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)}};
