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