jQuery.fn.corners=function(p){var k="rounded_by_jQuery_corners",n=h(p),d=false;try{d=document.body.style.WebkitBorderRadius!==undefined;var f=navigator.userAgent.indexOf("Chrome");if(f>=0)d=false}catch(i){}var e=false;try{e=document.body.style.MozBorderRadius!==undefined;var f=navigator.userAgent.indexOf("Firefox");if(f>=0&&parseInt(navigator.userAgent.substring(f+8))<3)e=false}catch(i){}return this.each(function(l,a){$e=jQuery(a);if($e.hasClass(k))return;$e.addClass(k);var f=/{(.*)}/.exec(a.className),b=f?h(f[1],n):n,j=a.nodeName.toLowerCase();if(j=="input")a=x(a);if(d&&b.webkit)u(a,b);else if(e&&b.mozilla&&b.sizex==b.sizey)w(a,b);else{var g=c(a.parentNode),i=c(a);switch(j){case "a":case "input":B(a,b,g,i);break;default:A(a,b,g,i)}}});function u(d,a){var b=""+a.sizex+"px "+a.sizey+"px",c=jQuery(d);a.tl&&c.css("WebkitBorderTopLeftRadius",b);a.tr&&c.css("WebkitBorderTopRightRadius",b);a.bl&&c.css("WebkitBorderBottomLeftRadius",b);a.br&&c.css("WebkitBorderBottomRightRadius",b)}function w(d,a){var b=""+a.sizex+"px",c=jQuery(d);a.tl&&c.css("-moz-border-radius-topleft",b);a.tr&&c.css("-moz-border-radius-topright",b);a.bl&&c.css("-moz-border-radius-bottomleft",b);a.br&&c.css("-moz-border-radius-bottomright",b)}function B(e,c,n,g){var f=a("table"),d=a("tbody");f.appendChild(d);var m=a("tr"),i=a("td","top");m.appendChild(i);var k=a("tr"),o=l(e,c,a("td"));k.appendChild(o);var j=a("tr"),h=a("td","bottom");j.appendChild(h);if(c.tl||c.tr){d.appendChild(m);b(i,c,n,g,true)}d.appendChild(k);if(c.bl||c.br){d.appendChild(j);b(h,c,n,g,false)}e.appendChild(f);if(jQuery.browser.msie)f.onclick=z;e.style.overflow="hidden"}function z(){!this.parentNode.onclick&&this.parentNode.click()}function x(b){var a=document.createElement("a");a.id=b.id;a.className=b.className;if(b.onclick){a.href="javascript:";a.onclick=b.onclick}else{jQuery(b).parent("form").each(function(){a.href=this.action});a.onclick=s}var c=document.createTextNode(b.value);a.appendChild(c);b.parentNode.replaceChild(a,b);return a}function s(){jQuery(this).parent("form").each(function(){this.submit()});return false}function A(c,a,d,e){var f=l(c,a,document.createElement("div"));c.appendChild(f);(a.tl||a.tr)&&b(c,a,d,e,true);(a.bl||a.br)&&b(c,a,d,e,false)}function l(c,d,b){var a=jQuery(c),g;while(g=c.firstChild)b.appendChild(g);if(c.style.height){var f=parseInt(a.css("height"));b.style.height=f+"px";f+=parseInt(a.css("padding-top"))+parseInt(a.css("padding-bottom"));c.style.height=f+"px"}if(c.style.width){var e=parseInt(a.css("width"));b.style.width=e+"px";e+=parseInt(a.css("padding-left"))+parseInt(a.css("padding-right"));c.style.width=e+"px"}b.style.paddingLeft=a.css("padding-left");b.style.paddingRight=a.css("padding-right");if(d.tl||d.tr)b.style.paddingTop=m(c,d,a.css("padding-top"),true);else b.style.paddingTop=a.css("padding-top");if(d.bl||d.br)b.style.paddingBottom=m(c,d,a.css("padding-bottom"),false);else b.style.paddingBottom=a.css("padding-bottom");c.style.padding=0;return b}function m(e,b,a,d){if(a.indexOf("px")<0){try{console.error("%s padding not in pixels",d?"top":"bottom",e)}catch(c){}a=b.sizey+"px"}a=parseInt(a);if(a-b.sizey<0){try{console.error("%s padding is %ipx for %ipx corner:",d?"top":"bottom",a,b.sizey,e)}catch(c){}a=b.sizey}return a-b.sizey+"px"}function a(c,b){var a=document.createElement(c);a.style.border="none";a.style.borderCollapse="collapse";a.style.borderSpacing=0;a.style.padding=0;a.style.margin=0;if(b)a.style.verticalAlign=b;return a}function c(b){try{var a=jQuery.css(b,"background-color");if(a.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&b.parentNode)return c(b.parentNode);if(a==null)return "#ffffff";if(a.indexOf("rgb")>-1)a=o(a);if(a.length==4)a=v(a);return a}catch(d){return "#ffffff"}}function v(a){return "#"+a.substring(1,2)+a.substring(1,2)+a.substring(2,3)+a.substring(2,3)+a.substring(3,4)+a.substring(3,4)}function o(e){for(var f=255,b="",c=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/,d=c.exec(e),a=1;a<4;a++)b+=("0"+parseInt(d[a]).toString(16)).slice(-2);return "#"+b}function h(e,b){var e=e||"",a={sizex:5,sizey:5,tl:false,tr:false,bl:false,br:false,webkit:true,mozilla:true,transparent:false};if(b){a.sizex=b.sizex;a.sizey=b.sizey;a.webkit=b.webkit;a.transparent=b.transparent;a.mozilla=b.mozilla}var d=false,c=false;jQuery.each(e.split(" "),function(f,b){b=b.toLowerCase();var e=parseInt(b);if(e>0&&b==e+"px"){a.sizey=e;if(!d)a.sizex=e;d=true}else switch(b){case "no-native":a.webkit=a.mozilla=false;break;case "webkit":a.webkit=true;break;case "no-webkit":a.webkit=false;break;case "mozilla":a.mozilla=true;break;case "no-mozilla":a.mozilla=false;break;case "anti-alias":a.transparent=false;break;case "transparent":a.transparent=true;break;case "top":c=a.tl=a.tr=true;break;case "right":c=a.tr=a.br=true;break;case "bottom":c=a.bl=a.br=true;break;case "left":c=a.tl=a.bl=true;break;case "top-left":c=a.tl=true;break;case "top-right":c=a.tr=true;break;case "bottom-left":c=a.bl=true;break;case "bottom-right":c=a.br=true}});if(!c)if(!b)a.tl=a.tr=a.bl=a.br=true;else{a.tl=b.tl;a.tr=b.tr;a.bl=b.bl;a.br=b.br}return a}function y(d,a,e){var b=Array(parseInt("0x"+d.substring(1,3)),parseInt("0x"+d.substring(3,5)),parseInt("0x"+d.substring(5,7))),c=Array(parseInt("0x"+a.substring(1,3)),parseInt("0x"+a.substring(3,5)),parseInt("0x"+a.substring(5,7)));r="0"+Math.round(b[0]+(c[0]-b[0])*e).toString(16);g="0"+Math.round(b[1]+(c[1]-b[1])*e).toString(16);a="0"+Math.round(b[2]+(c[2]-b[2])*e).toString(16);return "#"+r.substring(r.length-2)+g.substring(g.length-2)+a.substring(a.length-2)}function b(d,a,b,e,c){if(a.transparent)q(d,a,b,c);else t(d,a,b,e,c)}function t(n,a,q,p,o){var c,b,g=document.createElement("div");g.style.fontSize="1px";g.style.backgroundColor=q;var i=0;for(c=1;c<=a.sizey;c++){var h,f,r;arc=Math.sqrt(1-Math.pow(1-c/a.sizey,2))*a.sizex;var e=a.sizex-Math.ceil(arc),m=Math.floor(i),l=a.sizex-e-m,d=document.createElement("div"),k=g;d.style.margin="0px "+e+"px";d.style.height="1px";d.style.overflow="hidden";for(b=1;b<=l;b++){if(b==1)if(b==l)h=(arc+i)*.5-m;else{f=Math.sqrt(1-Math.pow(1-(e+1)/a.sizex,2))*a.sizey;h=(f-(a.sizey-c))*(arc-m-l+1)*.5}else if(b==l){f=Math.sqrt(1-Math.pow((a.sizex-e-b+1)/a.sizex,2))*a.sizey;h=1-(1-(f-(a.sizey-c)))*(1-(i-m))*.5}else{r=Math.sqrt(1-Math.pow((a.sizex-e-b)/a.sizex,2))*a.sizey;f=Math.sqrt(1-Math.pow((a.sizex-e-b+1)/a.sizex,2))*a.sizey;h=(f+r)*.5-(a.sizey-c)}j(a,d,k,o,y(q,p,h));k=d;var d=k.cloneNode(false);d.style.margin="0px 1px"}j(a,d,k,o,p);i=arc}if(o)n.insertBefore(g,n.firstChild);else n.appendChild(g)}function j(c,a,d,b,e){if(b&&!c.tl)a.style.marginLeft=0;if(b&&!c.tr)a.style.marginRight=0;if(!b&&!c.bl)a.style.marginLeft=0;if(!b&&!c.br)a.style.marginRight=0;a.style.backgroundColor=e;if(b)d.appendChild(a);else d.insertBefore(a,d.firstChild)}function q(g,a,k,h){var b=document.createElement("div");b.style.fontSize="1px";var d=document.createElement("div");d.style.overflow="hidden";d.style.height="1px";d.style.borderColor=k;d.style.borderStyle="none solid";var j=a.sizex-1,i=a.sizey-1;if(!i)i=1;for(var f=0;f<a.sizey;f++){var c=j-Math.floor(Math.sqrt(1-Math.pow(1-f/i,2))*j);if(f==2&&a.sizex==6&&a.sizey==6)c=2;var e=d.cloneNode(false);e.style.borderWidth="0 "+c+"px";if(h)e.style.borderWidth="0 "+(a.tr?c:0)+"px 0 "+(a.tl?c:0)+"px";else e.style.borderWidth="0 "+(a.br?c:0)+"px 0 "+(a.bl?c:0)+"px";h?b.appendChild(e):b.insertBefore(e,b.firstChild)}if(h)g.insertBefore(b,g.firstChild);else g.appendChild(b)}}
