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