(function(a){function s(f){f=parseInt(f).toString(16);return f.length<2?"0"+f:f}function y(f){for(;f;){var c=a.css(f,"backgroundColor");if(c&&c!="transparent"&&c!="rgba(0, 0, 0, 0)"){if(c.indexOf("rgb")>=0){f=c.match(/\d+/g);return"#"+s(f[0])+s(f[1])+s(f[2])}return c}if(f.nodeName.toLowerCase()=="html")break;f=f.parentNode}return"#ffffff"}function z(f,c,e){switch(f){case "round":return Math.round(e*(1-Math.cos(Math.asin(c/e))));case "cool":return Math.round(e*(1+Math.cos(Math.asin(c/e))));case "sharp":return Math.round(e*
(1-Math.cos(Math.acos(c/e))));case "bite":return Math.round(e*Math.cos(Math.asin((e-c-1)/e)));case "slide":return Math.round(e*Math.atan2(c,e/c));case "jut":return Math.round(e*Math.atan2(e,e-c-1));case "curl":return Math.round(e*Math.atan(c));case "tear":return Math.round(e*Math.cos(c));case "wicked":return Math.round(e*Math.tan(c));case "long":return Math.round(e*Math.sqrt(c));case "sculpt":return Math.round(e*Math.log(e-c-1,e));case "dogfold":case "dog":return c&1?c+1:e;case "dog2":return c&2?
c+1:e;case "dog3":return c&3?c+1:e;case "fray":return c%2*e;case "notch":return e;case "bevelfold":case "bevel":return c+1}}var p=document.createElement("div").style,m=p.MozBorderRadius!==undefined,t=p.WebkitBorderRadius!==undefined,n=p.borderRadius!==undefined||p.BorderRadius!==undefined;p=document.documentMode||0;var A=a.browser.msie&&(a.browser.version<8&&!p||p<8),v=a.browser.msie&&function(){var f=document.createElement("div");try{f.style.setExpression("width","0+0");f.style.removeExpression("width")}catch(c){return false}return true}();
a.support=a.support||{};a.support.borderRadius=m||t||n;a.fn.corner=function(f){if(this.length==0){if(!a.isReady&&this.selector){var c=this.selector,e=this.context;a(function(){a(c,e).corner(f)})}return this}return this.each(function(){var i=a(this),d=[i.attr(a.fn.corner.defaults.metaAttr)||"",f||""].join(" ").toLowerCase(),u=/keep/.test(d),h=(d.match(/cc:(#[0-9a-f]+)/)||[])[1],j=(d.match(/sc:(#[0-9a-f]+)/)||[])[1],g=parseInt((d.match(/(\d+)px/)||[])[1])||10,w=(d.match(/round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/)||
["round"])[0],B=/dogfold|bevelfold/.test(d),x={T:0,B:1};d={TL:/top|tl|left/.test(d),TR:/top|tr|right/.test(d),BL:/bottom|bl|left/.test(d),BR:/bottom|br|right/.test(d)};var q,l,b,k,r,o;if(!d.TL&&!d.TR&&!d.BL&&!d.BR)d={TL:1,TR:1,BL:1,BR:1};if(a.fn.corner.defaults.useNative&&w=="round"&&(n||m||t)&&!h&&!j){if(d.TL)i.css(n?"border-top-left-radius":m?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",g+"px");if(d.TR)i.css(n?"border-top-right-radius":m?"-moz-border-radius-topright":"-webkit-border-top-right-radius",
g+"px");if(d.BL)i.css(n?"border-bottom-left-radius":m?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",g+"px");if(d.BR)i.css(n?"border-bottom-right-radius":m?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",g+"px")}else{i=document.createElement("div");a(i).css({overflow:"hidden",height:"1px",minHeight:"1px",fontSize:"1px",backgroundColor:j||"transparent",borderStyle:"solid"});j={T:parseInt(a.css(this,"paddingTop"))||0,R:parseInt(a.css(this,"paddingRight"))||
0,B:parseInt(a.css(this,"paddingBottom"))||0,L:parseInt(a.css(this,"paddingLeft"))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!u)this.style.border="none";i.style.borderColor=h||y(this.parentNode);u=a(this).outerHeight();for(q in x)if((h=x[q])&&(d.BL||d.BR)||!h&&(d.TL||d.TR)){i.style.borderStyle="none "+(d[q+"R"]?"solid":"none")+" none "+(d[q+"L"]?"solid":"none");l=document.createElement("div");a(l).addClass("jquery-corner");b=l.style;h?this.appendChild(l):this.insertBefore(l,this.firstChild);
if(h&&u!="auto"){if(a.css(this,"position")=="static")this.style.position="relative";b.position="absolute";b.bottom=b.left=b.padding=b.margin="0";if(v)b.setExpression("width","this.parentNode.offsetWidth");else b.width="100%"}else if(!h&&a.browser.msie){if(a.css(this,"position")=="static")this.style.position="relative";b.position="absolute";b.top=b.left=b.right=b.padding=b.margin="0";if(v){k=(parseInt(a.css(this,"borderLeftWidth"))||0)+(parseInt(a.css(this,"borderRightWidth"))||0);b.setExpression("width",
"this.parentNode.offsetWidth - "+k+'+ "px"')}else b.width="100%"}else{b.position="relative";b.margin=!h?"-"+j.T+"px -"+j.R+"px "+(j.T-g)+"px -"+j.L+"px":j.B-g+"px -"+j.R+"px -"+j.B+"px -"+j.L+"px"}for(b=0;b<g;b++){k=Math.max(0,z(w,b,g));r=i.cloneNode(false);r.style.borderWidth="0 "+(d[q+"R"]?k:0)+"px 0 "+(d[q+"L"]?k:0)+"px";h?l.appendChild(r):l.insertBefore(r,l.firstChild)}if(B&&a.support.boxModel)if(!(h&&A))for(o in d)if(d[o])if(!(h&&(o=="TL"||o=="TR")))if(!(!h&&(o=="BL"||o=="BR"))){b={position:"absolute",
border:"none",margin:0,padding:0,overflow:"hidden",backgroundColor:i.style.borderColor};k=a("<div/>").css(b).css({width:g+"px",height:"1px"});switch(o){case "TL":k.css({bottom:0,left:0});break;case "TR":k.css({bottom:0,right:0});break;case "BL":k.css({top:0,left:0});break;case "BR":k.css({top:0,right:0})}l.appendChild(k[0]);b=a("<div/>").css(b).css({top:0,bottom:0,width:"1px",height:g+"px"});switch(o){case "TL":b.css({left:g});break;case "TR":b.css({right:g});break;case "BL":b.css({left:g});break;
case "BR":b.css({right:g})}l.appendChild(b[0])}}}})};a.fn.uncorner=function(){if(n||m||t)this.css(n?"border-radius":m?"-moz-border-radius":"-webkit-border-radius",0);a("div.jquery-corner",this).remove();return this};a.fn.corner.defaults={useNative:true,metaAttr:"data-corner"}})(jQuery);
