/*!
 * jQuery Corners 0.3
 * Copyright (c) 2008 David Turnbull, Steven Wittens
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 * Algunas Mods por AML
 */
jQuery.fn.corners=function(D){function E(b,a){var c=""+a.sizex+"px "+a.sizey+"px";b=jQuery(b);if(a.tl){b.css("WebkitBorderTopLeftRadius",c);b.css("border-top-left-radius",c)}if(a.tr){b.css("WebkitBorderTopRightRadius",c);b.css("border-top-right-radius",c)}if(a.bl){b.css("WebkitBorderBottomLeftRadius",c);b.css("border-bottom-left-radius",c)}if(a.br){b.css("WebkitBorderBottomRightRadius",c);b.css("border-bottom-right-radius",c)}}function F(b,a){var c=""+a.sizex+"px";b=jQuery(b);if(a.tl){b.css("-moz-border-radius-topleft",
c);b.css("border-top-left-radius",c)}if(a.tr){b.css("-moz-border-radius-topright",c);b.css("border-top-right-radius",c)}if(a.bl){b.css("-moz-border-radius-bottomleft",c);b.css("border-bottom-left-radius",c)}if(a.br){b.css("-moz-border-radius-bottomright",c);b.css("border-bottom-right-radius",c)}}function G(b,a,c,e){var d=l("table"),f=l("tbody");d.appendChild(f);var h=l("tr"),k=l("td","top");h.appendChild(k);var j=l("tr"),i=w(b,a,l("td"));j.appendChild(i);i=l("tr");var o=l("td","bottom");i.appendChild(o);
if(a.tl||a.tr){f.appendChild(h);p(k,a,c,e,true)}f.appendChild(j);if(a.bl||a.br){f.appendChild(i);p(o,a,c,e,false)}b.appendChild(d);if(jQuery.browser.msie)d.onclick=H;b.style.overflow="hidden"}function H(){this.parentNode.onclick||this.parentNode.click()}function I(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=J}var c=document.createTextNode(b.value);
a.appendChild(c);b.parentNode.replaceChild(a,b);return a}function J(){jQuery(this).parent("form").each(function(){this.submit()});return false}function K(b,a,c,e){var d=w(b,a,document.createElement("div"));b.appendChild(d);if(a.tl||a.tr)p(b,a,c,e,true);if(a.bl||a.br)p(b,a,c,e,false)}function w(b,a,c){for(var e=jQuery(b),d;d=b.firstChild;)c.appendChild(d);if(b.style.height){d=parseInt(e.css("height"));c.style.height=d+"px";d+=parseInt(e.css("padding-top"))+parseInt(e.css("padding-bottom"));b.style.height=
d+"px"}if(b.style.width){d=parseInt(e.css("width"));c.style.width=d+"px";d+=parseInt(e.css("padding-left"))+parseInt(e.css("padding-right"));b.style.width=d+"px"}c.style.paddingLeft=e.css("padding-left");c.style.paddingRight=e.css("padding-right");c.style.paddingTop=a.tl||a.tr?x(b,a,e.css("padding-top"),true):e.css("padding-top");c.style.paddingBottom=a.bl||a.br?x(b,a,e.css("padding-bottom"),false):e.css("padding-bottom");b.style.padding=0;return c}function x(b,a,c,e){if(c.indexOf("px")<0){try{console.error("%s padding not in pixels",
e?"top":"bottom",b)}catch(d){}c=a.sizey+"px"}c=parseInt(c);if(c-a.sizey<0){try{console.error("%s padding is %ipx for %ipx corner:",e?"top":"bottom",c,a.sizey,b)}catch(f){}c=a.sizey}return c-a.sizey+"px"}function l(b,a){b=document.createElement(b);b.style.border="none";b.style.borderCollapse="collapse";b.style.borderSpacing=0;b.style.padding=0;b.style.margin=0;if(a)b.style.verticalAlign=a;return b}function u(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 u(b.parentNode);if(a==null)return"#ffffff";if(a.indexOf("rgb")>-1)a=L(a);if(a.length==4)a=M(a);return a}catch(c){return"#ffffff"}}function M(b){return"#"+b.substring(1,2)+b.substring(1,2)+b.substring(2,3)+b.substring(2,3)+b.substring(3,4)+b.substring(3,4)}function L(b){var a="",c=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/.exec(b);for(b=1;b<4;b++)a+=("0"+parseInt(c[b]).toString(16)).slice(-2);return"#"+a}function y(b,a){b=b||"";var c={sizex:5,sizey:5,tl:false,tr:false,bl:false,br:false,
webkit:true,mozilla:true,transparent:false};if(a){c.sizex=a.sizex;c.sizey=a.sizey;c.webkit=a.webkit;c.transparent=a.transparent;c.mozilla=a.mozilla}var e=false,d=false;jQuery.each(b.split(" "),function(f,h){h=h.toLowerCase();f=parseInt(h);if(f>0&&h==f+"px"){c.sizey=f;if(!e)c.sizex=f;e=true}else switch(h){case "no-native":c.webkit=c.mozilla=false;break;case "webkit":c.webkit=true;break;case "no-webkit":c.webkit=false;break;case "mozilla":c.mozilla=true;break;case "no-mozilla":c.mozilla=false;break;
case "anti-alias":c.transparent=false;break;case "transparent":c.transparent=true;break;case "top":d=c.tl=c.tr=true;break;case "right":d=c.tr=c.br=true;break;case "bottom":d=c.bl=c.br=true;break;case "left":d=c.tl=c.bl=true;break;case "top-left":d=c.tl=true;break;case "top-right":d=c.tr=true;break;case "bottom-left":d=c.bl=true;break;case "bottom-right":d=c.br=true;break}});if(!d)if(a){c.tl=a.tl;c.tr=a.tr;c.bl=a.bl;c.br=a.br}else c.tl=c.tr=c.bl=c.br=true;return c}function N(b,a,c){b=Array(parseInt("0x"+
b.substring(1,3)),parseInt("0x"+b.substring(3,5)),parseInt("0x"+b.substring(5,7)));a=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]+(a[0]-b[0])*c).toString(16);g="0"+Math.round(b[1]+(a[1]-b[1])*c).toString(16);a="0"+Math.round(b[2]+(a[2]-b[2])*c).toString(16);return"#"+r.substring(r.length-2)+g.substring(g.length-2)+a.substring(a.length-2)}function p(b,a,c,e,d){a.transparent?O(b,a,c,d):P(b,a,c,e,d)}function P(b,a,c,e,d){var f,
h,k=document.createElement("div");k.style.fontSize="1px";k.style.backgroundColor=c;var j=0;for(f=1;f<=a.sizey;f++){var i,o;arc=Math.sqrt(1-Math.pow(1-f/a.sizey,2))*a.sizex;var n=a.sizex-Math.ceil(arc),q=Math.floor(j),s=a.sizex-n-q,m=document.createElement("div"),t=k;m.style.margin="0px "+n+"px";m.style.height="1px";m.style.overflow="hidden";for(h=1;h<=s;h++){if(h==1)if(h==s)i=(arc+j)*0.5-q;else{i=Math.sqrt(1-Math.pow(1-(n+1)/a.sizex,2))*a.sizey;i=(i-(a.sizey-f))*(arc-q-s+1)*0.5}else if(h==s){i=Math.sqrt(1-
Math.pow((a.sizex-n-h+1)/a.sizex,2))*a.sizey;i=1-(1-(i-(a.sizey-f)))*(1-(j-q))*0.5}else{o=Math.sqrt(1-Math.pow((a.sizex-n-h)/a.sizex,2))*a.sizey;i=Math.sqrt(1-Math.pow((a.sizex-n-h+1)/a.sizex,2))*a.sizey;i=(i+o)*0.5-(a.sizey-f)}z(a,m,t,d,N(c,e,i));t=m;m=t.cloneNode(false);m.style.margin="0px 1px"}z(a,m,t,d,e);j=arc}d?b.insertBefore(k,b.firstChild):b.appendChild(k)}function z(b,a,c,e,d){if(e&&!b.tl)a.style.marginLeft=0;if(e&&!b.tr)a.style.marginRight=0;if(!e&&!b.bl)a.style.marginLeft=0;if(!e&&!b.br)a.style.marginRight=
0;a.style.backgroundColor=d;e?c.appendChild(a):c.insertBefore(a,c.firstChild)}function O(b,a,c,e){var d=document.createElement("div");d.style.fontSize="1px";var f=document.createElement("div");f.style.overflow="hidden";f.style.height="1px";f.style.borderColor=c;f.style.borderStyle="none solid";c=a.sizex-1;var h=a.sizey-1;h||(h=1);for(var k=0;k<a.sizey;k++){var j=c-Math.floor(Math.sqrt(1-Math.pow(1-k/h,2))*c);if(k==2&&a.sizex==6&&a.sizey==6)j=2;var i=f.cloneNode(false);i.style.borderWidth="0 "+j+"px";
i.style.borderWidth=e?"0 "+(a.tr?j:0)+"px 0 "+(a.tl?j:0)+"px":"0 "+(a.br?j:0)+"px 0 "+(a.bl?j:0)+"px";e?d.appendChild(i):d.insertBefore(i,d.firstChild)}e?b.insertBefore(d,b.firstChild):b.appendChild(d)}var A=y(D),B=false;try{B=document.body.style.WebkitBorderRadius!==undefined}catch(Q){}var v=false;try{v=(document.body.style.MozBorderRadius||document.body.style.BorderRadius||document.body.style.borderRadius)!==undefined;var C=navigator.userAgent.indexOf("Firefox");if(C>=0&&parseInt(navigator.userAgent.substring(C+
8))<3)v=false}catch(R){}return this.each(function(b,a){$e=jQuery(a);if(!$e.hasClass("rounded_by_jQuery_corners")){$e.addClass("rounded_by_jQuery_corners");b=(b=/{(.*)}/.exec(a.className))?y(b[1],A):A;var c=a.nodeName.toLowerCase();if(c=="input")a=I(a);if(B&&b.webkit)E(a,b);else if(v&&b.mozilla&&b.sizex==b.sizey)F(a,b);else{var e=u(a.parentNode),d=u(a);switch(c){case "a":case "input":G(a,b,e,d);break;default:K(a,b,e,d);break}}}})};

