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