jQuery.fn.corner=function(d){function k(a){a=parseInt(a).toString(16);return a.length<2?"0"+a:a}function o(a){for(;a&&a.nodeName.toLowerCase()!="html";a=a.parentNode){var f=jQuery.css(a,"backgroundColor");if(f.indexOf("rgb")>=0){rgb=f.match(/\d+/g);return"#"+k(rgb[0])+k(rgb[1])+k(rgb[2])}if(f&&f!="transparent")return f}return"#ffffff"}function p(a){switch(q){case"round":return Math.round(b*(1-Math.cos(Math.asin(a/b))));case"cool":return Math.round(b*(1+Math.cos(Math.asin(a/b))));case"sharp":return Math.round(b*(1-Math.cos(Math.acos(a/b))));case"bite":return Math.round(b*Math.cos(Math.asin((b-a-1)/b)));case"slide":return Math.round(b*Math.atan2(a,b/a));case"jut":return Math.round(b*Math.atan2(b,b-a-1));case"curl":return Math.round(b*Math.atan(a));case"tear":return Math.round(b*Math.cos(a));case"wicked":return Math.round(b*Math.tan(a));case"long":return Math.round(b*Math.sqrt(a));case"sculpt":return Math.round(b*Math.log(b-a-1,b));case"dog":return a&1?a+1:b;case"dog2":return a&2?a+1:b;case"dog3":return a&3?a+1:b;case"fray":return a%2*b;case"notch":return b;case"bevel":return a+1}}d=(d||"").toLowerCase();var r=/keep/.test(d),s=(d.match(/cc:(#[0-9a-f]+)/)||[])[1],t=(d.match(/sc:(#[0-9a-f]+)/)||[])[1],b=parseInt((d.match(/(\d+)px/)||[])[1])||10,u=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/,q=(d.match(u)||["round"])[0],m={T:0,B:1},e={TL:/top|tl/.test(d),TR:/top|tr/.test(d),BL:/bottom|bl/.test(d),BR:/bottom|br/.test(d)};if(!e.TL&&!e.TR&&!e.BL&&!e.BR)e={TL:1,TR:1,BL:1,BR:1};var g=document.createElement("div");g.style.overflow="hidden";g.style.height="1px";g.style.backgroundColor=t||"transparent";g.style.borderStyle="solid";return this.each(function(){var a={T:parseInt(jQuery.css(this,"paddingTop"))||0,R:parseInt(jQuery.css(this,"paddingRight"))||0,B:parseInt(jQuery.css(this,"paddingBottom"))||0,L:parseInt(jQuery.css(this,"paddingLeft"))||0};if(jQuery.browser.msie)this.style.zoom=1;if(!r)this.style.border="none";g.style.borderColor=s||o(this.parentNode);var f=jQuery.curCSS(this,"height");for(var i in m){var j=m[i];g.style.borderStyle="none "+(e[i+"R"]?"solid":"none")+" none "+(e[i+"L"]?"solid":"none");var h=document.createElement("div"),c=h.style;j?this.appendChild(h):this.insertBefore(h,this.firstChild);if(j&&f!="auto"){if(jQuery.css(this,"position")=="static")this.style.position="relative";c.position="absolute";c.bottom=c.left=c.padding=c.margin="0";if(jQuery.browser.msie)c.setExpression("width","this.parentNode.offsetWidth");else c.width="100%"}else c.margin=!j?"-"+a.T+"px -"+a.R+"px "+(a.T-b)+"px -"+a.L+"px":a.B-b+"px -"+a.R+"px -"+a.B+"px -"+a.L+"px";for(c=0;c<b;c++){var n=Math.max(0,p(c)),l=g.cloneNode(false);l.style.borderWidth="0 "+(e[i+"R"]?n:0)+"px 0 "+(e[i+"L"]?n:0)+"px";j?h.appendChild(l):h.insertBefore(l,h.firstChild)}}})};