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