function Mix(a,b){var c,d,e,f,g,h=new Array(3);if(a.length==4)d=1;else d=2;if(b.length==4)e=1;else e=2;for(c=0;c<3;c++){f=parseInt(a.substr(1+d*c,d),16);if(d==1)f=16*f+f;g=parseInt(b.substr(1+e*c,e),16);if(e==1)g=16*g+g;h[c]=Math.floor((f*50+g*50)/100);h[c]=h[c].toString(16);if(h[c].length==1)h[c]="0"+h[c]}return"#"+h[0]+h[1]+h[2]}function rgb2hex(a){var b="",c,d,e;var f=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var d=f.exec(a);for(e=1;e<4;e++){c=parseInt(d[e]).toString(16);if(c.length==1)b+="0"+c;else b+=c}return"#"+b}function getStyleProp(a,b){if(a.currentStyle)return a.currentStyle[b];if(document.defaultView.getComputedStyle)return document.defaultView.getComputedStyle(a,"")[b];return null}function getPadding(a,b){var c=getStyleProp(a,"padding"+b);if(c==null||!c.find("px"))return 0;return parseInt(c)}function getBk(a){var b=getStyleProp(a,"backgroundColor");if(b==null||b=="transparent"||b.find("rgba(0, 0, 0, 0)"))return"transparent";if(b.find("rgb"))b=rgb2hex(b);return b}function getParentBk(a){var b=a.parentNode,c;while(b.tagName.toUpperCase()!="HTML"&&(c=getBk(b))=="transparent")b=b.parentNode;if(c=="transparent")c="#FFFFFF";return c}function getElementsBySelector(a){var b,c,d="",e="",f=a,g="",h,i,j,k,l=[],m=[],n;if(a.find("#")){if(a.find(" ")){l=a.split(" ");var o=l[0].split("#");if(o.length==1)return m;j=document.getElementById(o[1]);if(j){p=j.getElementsByTagName(l[1]);for(b=0;b<p.length;b++)m.push(p[b])}return m}else{l=a.split("#");f=l[0];d=l[1];if(d!=""){j=document.getElementById(d);if(j)m.push(j);return m}}}if(a.find(".")){l=a.split(".");f=l[0];e=l[1];if(e.find(" ")){l=e.split(" ");e=l[0];g=l[1]}}var p=document.getElementsByTagName(f);if(e==""){for(b=0;b<p.length;b++)m.push(p[b]);return m}for(b=0;b<p.length;b++){n=p[b].className.split(" ");for(c=0;c<n.length;c++){if(n[c]==e){if(g=="")m.push(p[b]);else{h=p[b].getElementsByTagName(g);for(i=0;i<h.length;i++)m.push(h[i])}}}}return m}function SameHeight(a,b){var c,d=a.split(","),e,f,g=[],h;for(c=0;c<d.length;c++){e=getElementsBySelector(d[c]);g=g.concat(e)}for(c=0;c<g.length;c++){if(g[c].offsetHeight>b)b=g[c].offsetHeight;g[c].style.height="auto"}for(c=0;c<g.length;c++){h=b-g[c].offsetHeight;if(h>0){e=CreateEl("b");e.className="niftyfill";e.style.height=h+"px";nc=g[c].lastChild;if(nc.className=="niftycorners")g[c].insertBefore(e,nc);else g[c].appendChild(e)}}}function FixIE(a){if(a.currentStyle!=null&&a.currentStyle.hasLayout!=null&&a.currentStyle.hasLayout==false)a.style.display="inline-block"}function CreateEl(a){return document.createElement(a)}function CreateStrip(a,b,c,d,e){var f=CreateEl("b");f.className=e+a;f.style.backgroundColor=c;f.style.borderColor=d;if(b=="left"){f.style.borderRightWidth="0";f.style.marginRight="0"}else if(b=="right"){f.style.borderLeftWidth="0";f.style.marginLeft="0"}return f}function AddBottom(a,b,c){var d=CreateEl("b"),e=4,f="",g,h,i="r",j,k;d.style.marginLeft="-"+getPadding(a,"Left")+"px";d.style.marginRight="-"+getPadding(a,"Right")+"px";if(c.find("alias")||(k=getBk(a))=="transparent"){k="transparent";j="transparent";f=getParentBk(a);i="t"}else{j=getParentBk(a);f=Mix(k,j)}d.style.background=j;d.className="niftycorners";g=getPadding(a,"Bottom");if(c.find("small")){d.style.marginTop=g-2+"px";i+="s";e=2}else if(c.find("big")){d.style.marginTop=g-10+"px";i+="b";e=8}else d.style.marginTop=g-5+"px";for(h=e;h>0;h--)d.appendChild(CreateStrip(h,b,k,f,i));a.style.paddingBottom=0;a.appendChild(d)}function AddTop(a,b,c){var d=CreateEl("b"),e=4,f="",g,h,i="r",j,k;d.style.marginLeft="-"+getPadding(a,"Left")+"px";d.style.marginRight="-"+getPadding(a,"Right")+"px";if(c.find("alias")||(k=getBk(a))=="transparent"){k="transparent";j="transparent";f=getParentBk(a);i="t"}else{j=getParentBk(a);f=Mix(k,j)}d.style.background=j;d.className="niftycorners";g=getPadding(a,"Top");if(c.find("small")){d.style.marginBottom=g-2+"px";i+="s";e=2}else if(c.find("big")){d.style.marginBottom=g-10+"px";i+="b";e=8}else d.style.marginBottom=g-5+"px";for(h=1;h<=e;h++)d.appendChild(CreateStrip(h,b,k,f,i));a.style.paddingTop="0";a.insertBefore(d,a.firstChild)}function Rounded(a,b){var c,d="",e="",f=new Array;if(b!=""){b=b.replace("left","tl bl");b=b.replace("right","tr br");b=b.replace("top","tr tl");b=b.replace("bottom","br bl");b=b.replace("transparent","alias");if(b.find("tl")){d="both";if(!b.find("tr"))d="left"}else if(b.find("tr"))d="right";if(b.find("bl")){e="both";if(!b.find("br"))e="left"}else if(b.find("br"))e="right"}if(d==""&&e==""&&!b.find("none")){d="both";e="both"}f=getElementsBySelector(a);for(c=0;c<f.length;c++){FixIE(f[c]);if(d!="")AddTop(f[c],d,b);if(e!="")AddBottom(f[c],e,b)}}function Nifty(a,b){if(niftyOk==false)return;if(niftyCss==false)AddCss();var c,d=a.split(","),e=0;if(b==null)b="";if(b.find("fixed-height"))e=getElementsBySelector(d[0])[0].offsetHeight;for(c=0;c<d.length;c++)Rounded(d[c],b);if(b.find("height"))SameHeight(a,e)}function AddCss(){niftyCss=true;var a=CreateEl("link");a.setAttribute("type","text/css");a.setAttribute("rel","stylesheet");a.setAttribute("href","/nifty/niftyCorners.css");a.setAttribute("media","screen");document.getElementsByTagName("head")[0].appendChild(a)}var niftyOk=document.getElementById&&document.createElement&&Array.prototype.push;var niftyCss=false;String.prototype.find=function(a){return this.indexOf(a)>=0?true:false};var oldonload=window.onload;if(typeof NiftyLoad!="function")NiftyLoad=function(){};if(typeof oldonload=="function")window.onload=function(){oldonload();AddCss();NiftyLoad()};else window.onload=function(){AddCss();NiftyLoad()}
