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