/*
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.03 (05-DEC-2009)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function(c){var a=navigator.userAgent;var f=c.browser.mozilla&&/gecko/i.test(a);var h=c.browser.safari&&/Safari\/[5-9]/.test(a);var g=c.browser.msie&&(function(){var k=document.createElement("div");try{k.style.setExpression("width","0+0");k.style.removeExpression("width")}catch(j){return false}return true})();function e(j,k){return parseInt(c.css(j,k))||0}function i(j){var j=parseInt(j).toString(16);return(j.length<2)?"0"+j:j}function b(l){for(;l&&l.nodeName.toLowerCase()!="html";l=l.parentNode){var j=c.css(l,"backgroundColor");if(j=="rgba(0, 0, 0, 0)"){continue}if(j.indexOf("rgb")>=0){var k=j.match(/\d+/g);return"#"+i(k[0])+i(k[1])+i(k[2])}if(j&&j!="transparent"){return j}}return"#ffffff"}function d(l,j,k){switch(l){case"round":return Math.round(k*(1-Math.cos(Math.asin(j/k))));case"cool":return Math.round(k*(1+Math.cos(Math.asin(j/k))));case"sharp":return Math.round(k*(1-Math.cos(Math.acos(j/k))));case"bite":return Math.round(k*(Math.cos(Math.asin((k-j-1)/k))));case"slide":return Math.round(k*(Math.atan2(j,k/j)));case"jut":return Math.round(k*(Math.atan2(k,(k-j-1))));case"curl":return Math.round(k*(Math.atan(j)));case"tear":return Math.round(k*(Math.cos(j)));case"wicked":return Math.round(k*(Math.tan(j)));case"long":return Math.round(k*(Math.sqrt(j)));case"sculpt":return Math.round(k*(Math.log((k-j-1),k)));case"dog":return(j&1)?(j+1):k;case"dog2":return(j&2)?(j+1):k;case"dog3":return(j&3)?(j+1):k;case"fray":return(j%2)*k;case"notch":return k;case"bevel":return j+1}}c.fn.corner=function(j){if(this.length==0){if(!c.isReady&&this.selector){var k=this.selector,l=this.context;c(function(){c(k,l).corner(j)})}return this}return this.each(function(r){var q=c(this);var y=[j||"",q.attr(c.fn.corner.defaults.metaAttr)||""].join(" ").toLowerCase();var F=/keep/.test(y);var x=((y.match(/cc:(#[0-9a-f]+)/)||[])[1]);var m=((y.match(/sc:(#[0-9a-f]+)/)||[])[1]);var B=parseInt((y.match(/(\d+)px/)||[])[1])||10;var z=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var p=((y.match(z)||["round"])[0]);var n={T:0,B:1};var u={TL:/top|tl|left/.test(y),TR:/top|tr|right/.test(y),BL:/bottom|bl|left/.test(y),BR:/bottom|br|right/.test(y)};if(!u.TL&&!u.TR&&!u.BL&&!u.BR){u={TL:1,TR:1,BL:1,BR:1}}if(c.fn.corner.defaults.useNative&&p=="round"&&(f||h)&&!x&&!m){if(u.TL){q.css(f?"-moz-border-radius-topleft":"-webkit-border-top-left-radius",B+"px")}if(u.TR){q.css(f?"-moz-border-radius-topright":"-webkit-border-top-right-radius",B+"px")}if(u.BL){q.css(f?"-moz-border-radius-bottomleft":"-webkit-border-bottom-left-radius",B+"px")}if(u.BR){q.css(f?"-moz-border-radius-bottomright":"-webkit-border-bottom-right-radius",B+"px")}return}var C=document.createElement("div");C.style.overflow="hidden";C.style.height="1px";C.style.backgroundColor=m||"transparent";C.style.borderStyle="solid";var I={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(!F){this.style.border="none"}C.style.borderColor=x||b(this.parentNode);var A=c.curCSS(this,"height");for(var D in n){var t=n[D];if((t&&(u.BL||u.BR))||(!t&&(u.TL||u.TR))){C.style.borderStyle="none "+(u[D+"R"]?"solid":"none")+" none "+(u[D+"L"]?"solid":"none");var J=document.createElement("div");c(J).addClass("jquery-corner");var v=J.style;t?this.appendChild(J):this.insertBefore(J,this.firstChild);if(t&&A!="auto"){if(c.css(this,"position")=="static"){this.style.position="relative"}v.position="absolute";v.bottom=v.left=v.padding=v.margin="0";if(g){v.setExpression("width","this.parentNode.offsetWidth")}else{v.width="100%"}}else{if(!t&&c.browser.msie){if(c.css(this,"position")=="static"){this.style.position="relative"}v.position="absolute";v.top=v.left=v.right=v.padding=v.margin="0";if(g){var G=e(this,"borderLeftWidth")+e(this,"borderRightWidth");v.setExpression("width","this.parentNode.offsetWidth - "+G+'+ "px"')}else{v.width="100%"}}else{v.position="relative";v.margin=!t?"-"+I.T+"px -"+I.R+"px "+(I.T-B)+"px -"+I.L+"px":(I.B-B)+"px -"+I.R+"px -"+I.B+"px -"+I.L+"px"}}for(var E=0;E<B;E++){var s=Math.max(0,d(p,E,B));var H=C.cloneNode(false);H.style.borderWidth="0 "+(u[D+"R"]?s:0)+"px 0 "+(u[D+"L"]?s:0)+"px";t?J.appendChild(H):J.insertBefore(H,J.firstChild)}}}})};c.fn.uncorner=function(){if(f||h){this.css(f?"-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);
