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

