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

