/*!
 * 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
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl. 
 *           by default, all four corners are adorned. 
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (and yes, it must be pixels).
 *
 * @author Dave Methvin (http://methvin.com/jquery/jq-corner.html)
 * @author Mike Alsup   (http://jquery.malsup.com/corner/)
 */
;(function($){var x=navigator.userAgent;var y=$.browser.mozilla&&/gecko/i.test(x);var z=$.browser.safari&&/Safari\/[5-9]/.test(x);var A=$.browser.msie&&(function(){var a=document.createElement('div');try{a.style.setExpression('width','0+0');a.style.removeExpression('width')}catch(e){return false}return true})();function sz(a,p){return parseInt($.css(a,p))||0};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s};function gpc(a){for(;a&&a.nodeName.toLowerCase()!='html';a=a.parentNode){var v=$.css(a,'backgroundColor');if(v=='rgba(0, 0, 0, 0)')continue;if(v.indexOf('rgb')>=0){var b=v.match(/\d+/g);return'#'+hex2(b[0])+hex2(b[1])+hex2(b[2])}if(v&&v!='transparent')return v}return'#ffffff'};function getWidth(a,i,b){switch(a){case'round':return Math.round(b*(1-Math.cos(Math.asin(i/b))));case'cool':return Math.round(b*(1+Math.cos(Math.asin(i/b))));case'sharp':return Math.round(b*(1-Math.cos(Math.acos(i/b))));case'bite':return Math.round(b*(Math.cos(Math.asin((b-i-1)/b))));case'slide':return Math.round(b*(Math.atan2(i,b/i)));case'jut':return Math.round(b*(Math.atan2(b,(b-i-1))));case'curl':return Math.round(b*(Math.atan(i)));case'tear':return Math.round(b*(Math.cos(i)));case'wicked':return Math.round(b*(Math.tan(i)));case'long':return Math.round(b*(Math.sqrt(i)));case'sculpt':return Math.round(b*(Math.log((b-i-1),b)));case'dog':return(i&1)?(i+1):b;case'dog2':return(i&2)?(i+1):b;case'dog3':return(i&3)?(i+1):b;case'fray':return(i%2)*b;case'notch':return b;case'bevel':return i+1}};$.fn.corner=function(v){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).corner(v)})}return this}return this.each(function(a){var b=$(this);var o=[v||'',b.attr($.fn.corner.defaults.metaAttr)||''].join(' ').toLowerCase();var c=/keep/.test(o);var f=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var g=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var h=parseInt((o.match(/(\d+)px/)||[])[1])||10;var k=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var l=((o.match(k)||['round'])[0]);var m={T:0,B:1};var n={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};if(!n.TL&&!n.TR&&!n.BL&&!n.BR)n={TL:1,TR:1,BL:1,BR:1};if($.fn.corner.defaults.useNative&&l=='round'&&(y||z)&&!f&&!g){if(n.TL)b.css(y?'-moz-border-radius-topleft':'-webkit-border-top-left-radius',h+'px');if(n.TR)b.css(y?'-moz-border-radius-topright':'-webkit-border-top-right-radius',h+'px');if(n.BL)b.css(y?'-moz-border-radius-bottomleft':'-webkit-border-bottom-left-radius',h+'px');if(n.BR)b.css(y?'-moz-border-radius-bottomright':'-webkit-border-bottom-right-radius',h+'px');return}var p=document.createElement('div');p.style.overflow='hidden';p.style.height='1px';p.style.backgroundColor=g||'transparent';p.style.borderStyle='solid';var q={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!c)this.style.border='none';p.style.borderColor=f||gpc(this.parentNode);var r=$.curCSS(this,'height');for(var j in m){var s=m[j];if((s&&(n.BL||n.BR))||(!s&&(n.TL||n.TR))){p.style.borderStyle='none '+(n[j+'R']?'solid':'none')+' none '+(n[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var t=d.style;s?this.appendChild(d):this.insertBefore(d,this.firstChild);if(s&&r!='auto'){if($.css(this,'position')=='static')this.style.position='relative';t.position='absolute';t.bottom=t.left=t.padding=t.margin='0';if(A)t.setExpression('width','this.parentNode.offsetWidth');else t.width='100%'}else if(!s&&$.browser.msie){if($.css(this,'position')=='static')this.style.position='relative';t.position='absolute';t.top=t.left=t.right=t.padding=t.margin='0';if(A){var u=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');t.setExpression('width','this.parentNode.offsetWidth - '+u+'+ "px"')}else t.width='100%'}else{t.position='relative';t.margin=!s?'-'+q.T+'px -'+q.R+'px '+(q.T-h)+'px -'+q.L+'px':(q.B-h)+'px -'+q.R+'px -'+q.B+'px -'+q.L+'px'}for(var i=0;i<h;i++){var w=Math.max(0,getWidth(l,i,h));var e=p.cloneNode(false);e.style.borderWidth='0 '+(n[j+'R']?w:0)+'px 0 '+(n[j+'L']?w:0)+'px';s?d.appendChild(e):d.insertBefore(e,d.firstChild)}}}})};$.fn.uncorner=function(){if(y||z)this.css(y?'-moz-border-radius':'-webkit-border-radius',0);$('div.jquery-corner',this).remove();return this};$.fn.corner.defaults={useNative:true,metaAttr:'data-corner'}})(jQuery);

