/*
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.11 (15-JUN-2010)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */
(function(C){var A=document.createElement("div").style,H=A.MozBorderRadius!==undefined,J=A.WebkitBorderRadius!==undefined,E=A.borderRadius!==undefined||A.BorderRadius!==undefined,D=document.documentMode||0,L=C.browser.msie&&((C.browser.version<8&&!D)||D<8),I=C.browser.msie&&(function(){var N=document.createElement("div");try{N.style.setExpression("width","0+0");N.style.removeExpression("width");}catch(M){return false;}return true;})();C.support=C.support||{};C.support.borderRadius=H||J||E;function G(M,N){return parseInt(C.css(M,N))||0;}function K(M){var M=parseInt(M).toString(16);return(M.length<2)?"0"+M:M;}function B(O){while(O){var M=C.css(O,"backgroundColor"),N;if(M&&M!="transparent"&&M!="rgba(0, 0, 0, 0)"){if(M.indexOf("rgb")>=0){N=M.match(/\d+/g);return"#"+K(N[0])+K(N[1])+K(N[2]);}return M;}if(O.nodeName.toLowerCase()=="html"){break;}O=O.parentNode;}return"#ffffff";}function F(O,M,N){switch(O){case"round":return Math.round(N*(1-Math.cos(Math.asin(M/N))));case"cool":return Math.round(N*(1+Math.cos(Math.asin(M/N))));case"sharp":return Math.round(N*(1-Math.cos(Math.acos(M/N))));case"bite":return Math.round(N*(Math.cos(Math.asin((N-M-1)/N))));case"slide":return Math.round(N*(Math.atan2(M,N/M)));case"jut":return Math.round(N*(Math.atan2(N,(N-M-1))));case"curl":return Math.round(N*(Math.atan(M)));case"tear":return Math.round(N*(Math.cos(M)));case"wicked":return Math.round(N*(Math.tan(M)));case"long":return Math.round(N*(Math.sqrt(M)));case"sculpt":return Math.round(N*(Math.log((N-M-1),N)));case"dogfold":case"dog":return(M&1)?(M+1):N;case"dog2":return(M&2)?(M+1):N;case"dog3":return(M&3)?(M+1):N;case"fray":return(M%2)*N;case"notch":return N;case"bevelfold":case"bevel":return M+1;}}C.fn.corner=function(M){if(this.length==0){if(!C.isReady&&this.selector){var N=this.selector,O=this.context;C(function(){C(N,O).corner(M);});}return this;}return this.each(function(V){var U=C(this),f=[U.attr(C.fn.corner.defaults.metaAttr)||"",M||""].join(" ").toLowerCase(),p=/keep/.test(f),b=((f.match(/cc:(#[0-9a-f]+)/)||[])[1]),P=((f.match(/sc:(#[0-9a-f]+)/)||[])[1]),k=parseInt((f.match(/(\d+)px/)||[])[1])||10,g=/round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/,R=((f.match(g)||["round"])[0]),S=/dogfold|bevelfold/.test(f),Q={T:0,B:1},Y={TL:/top|tl|left/.test(f),TR:/top|tr|right/.test(f),BL:/bottom|bl|left/.test(f),BR:/bottom|br|right/.test(f)},l,s,h,m,X,t,a,q,n,W,r,u,Z,T;if(!Y.TL&&!Y.TR&&!Y.BL&&!Y.BR){Y={TL:1,TR:1,BL:1,BR:1};}if(C.fn.corner.defaults.useNative&&R=="round"&&(E||H||J)&&!b&&!P){if(Y.TL){U.css(E?"border-top-left-radius":H?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",k+"px");}if(Y.TR){U.css(E?"border-top-right-radius":H?"-moz-border-radius-topright":"-webkit-border-top-right-radius",k+"px");}if(Y.BL){U.css(E?"border-bottom-left-radius":H?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",k+"px");}if(Y.BR){U.css(E?"border-bottom-right-radius":H?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",k+"px");}return ;}l=document.createElement("div");C(l).css({overflow:"hidden",height:"1px",minHeight:"1px",fontSize:"1px",backgroundColor:P||"transparent",borderStyle:"solid"});s={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(typeof this.style.zoom!=undefined){this.style.zoom=1;}if(!p){this.style.border="none";}l.style.borderColor=b||B(this.parentNode);h=C(this).outerHeight();for(m in Q){X=Q[m];if((X&&(Y.BL||Y.BR))||(!X&&(Y.TL||Y.TR))){l.style.borderStyle="none "+(Y[m+"R"]?"solid":"none")+" none "+(Y[m+"L"]?"solid":"none");t=document.createElement("div");C(t).addClass("jquery-corner");a=t.style;X?this.appendChild(t):this.insertBefore(t,this.firstChild);if(X&&h!="auto"){if(C.css(this,"position")=="static"){this.style.position="relative";}a.position="absolute";a.bottom=a.left=a.padding=a.margin="0";if(I){a.setExpression("width","this.parentNode.offsetWidth");}else{a.width="100%";}}else{if(!X&&C.browser.msie){if(C.css(this,"position")=="static"){this.style.position="relative";}a.position="absolute";a.top=a.left=a.right=a.padding=a.margin="0";if(I){q=G(this,"borderLeftWidth")+G(this,"borderRightWidth");a.setExpression("width","this.parentNode.offsetWidth - "+q+'+ "px"');}else{a.width="100%";}}else{a.position="relative";a.margin=!X?"-"+s.T+"px -"+s.R+"px "+(s.T-k)+"px -"+s.L+"px":(s.B-k)+"px -"+s.R+"px -"+s.B+"px -"+s.L+"px";}}for(n=0;n<k;n++){W=Math.max(0,F(R,n,k));r=l.cloneNode(false);r.style.borderWidth="0 "+(Y[m+"R"]?W:0)+"px 0 "+(Y[m+"L"]?W:0)+"px";X?t.appendChild(r):t.insertBefore(r,t.firstChild);}if(S&&C.support.boxModel){if(X&&L){continue;}for(u in Y){if(!Y[u]){continue;}if(X&&(u=="TL"||u=="TR")){continue;}if(!X&&(u=="BL"||u=="BR")){continue;}Z={position:"absolute",border:"none",margin:0,padding:0,overflow:"hidden",backgroundColor:l.style.borderColor};T=C("<div/>").css(Z).css({width:k+"px",height:"1px"});switch(u){case"TL":T.css({bottom:0,left:0});break;case"TR":T.css({bottom:0,right:0});break;case"BL":T.css({top:0,left:0});break;case"BR":T.css({top:0,right:0});break;}t.appendChild(T[0]);var v=C("<div/>").css(Z).css({top:0,bottom:0,width:"1px",height:k+"px"});switch(u){case"TL":v.css({left:k});break;case"TR":v.css({right:k});break;case"BL":v.css({left:k});break;case"BR":v.css({right:k});break;}t.appendChild(v[0]);}}}}});};C.fn.uncorner=function(){if(E||H||J){this.css(E?"border-radius":H?"-moz-border-radius":"-webkit-border-radius",0);}C("div.jquery-corner",this).remove();return this;};C.fn.corner.defaults={useNative:true,metaAttr:"data-corner"};})(jQuery);
