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

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

/*
Set the specified div to have corners
*/
function initDivCorner(iDivName) {
	$('#' + iDivName).addClass('innerCornerDiv');
	$('#' + iDivName).parent().addClass('outerCornerDiv');
	
	if (navigator.userAgent.indexOf("MSIE") > -1) {
		$('#' + iDivName).corner("round 5px").parent().css('padding', '1px').corner("round 6px");
	} else {
		$('#' + iDivName).corner("round 8px").parent().css('padding', '1px').corner("round 10px");
	}
}