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