(function(a){a.fn.drawCorners=function(b,c,j,f,k,e){if(a.browser.msie){var n=e;var i=j}else{var n=j;var i=e}var l=excanvas(document.getElementById(b+"_UpLeftCorner"));if(l.getContext){var m=l.getContext("2d");m.fillStyle=f;m.fillRect(0,0,c,c);m.fillStyle=n;m.arc(c,c,c,(Math.PI/2),0,0);m.fill();m.fillStyle=i;m.arc(c,c,(c-k),0,(Math.PI/2),1);m.fill()}var h=excanvas(document.getElementById(b+"_UpRightCorner"));if(h.getContext){var m=h.getContext("2d");m.fillStyle=f;m.fillRect(0,0,c,c);m.fillStyle=n;m.arc(0,c,c,(Math.PI),(Math.PI/2),0);m.fill();m.fillStyle=i;m.arc(0,c,(c-k),(Math.PI/2),(Math.PI),1);m.fill()}var g=excanvas(document.getElementById(b+"_DownLeftCorner"));if(g.getContext){var m=g.getContext("2d");m.fillStyle=f;m.fillRect(0,0,c,c);m.fillStyle=n;m.arc(c,0,c,0,(3*Math.PI/2),0);m.fill();m.fillStyle=i;m.arc(c,0,(c-k),(3*Math.PI/2),0,1);m.fill()}var d=excanvas(document.getElementById(b+"_DownRightCorner"));if(d.getContext){var m=d.getContext("2d");m.fillStyle=f;m.fillRect(0,0,c,c);m.fillStyle=n;m.arc(0,0,c,(3*Math.PI/2),(Math.PI),0);m.fill();m.fillStyle=i;m.arc(0,0,(c-k),(Math.PI),(3*Math.PI/2),1);m.fill()}};a.fn.corners=function(b){var b=a.extend({radio:10,outColor:"#FFF",inColor:"#CDCDCD",borderSize:0,borderColor:"#000000"},b?b:{});return this.each(function(){if(b.borderSize>b.radio){b.radio=b.borderSize}if(a(this).css("backgroundColor")!="transparent"){b.inColor=a(this).css("backgroundColor")}if(b.borderSize==0){b.borderColor=a(this).css("border-left-color")||a(this).css("border-top-color")||a(this).css("border-bottom-color")||a(this).css("border-right-color");if((a(this).css("borderWidth")!="medium")||(a(this).css("borderWidth")!="")){b.borderSize=(a(this).outerWidth()-a(this).innerWidth())/2||(a(this).outerHeight()-a(this).innerHeight())/2}}var e=a(this).attr("id");var c=a(this).html();a(this).css({position:"relative",backgroundColor:b.inColor,borderStyle:"solid",borderWidth:b.borderSize+"px",borderColor:b.borderColor}).html("");a(this).append("<canvas id='"+e+"_UpLeftCorner' width="+b.radio+" height="+b.radio+"></canvas>");a(this).append("<canvas id='"+e+"_UpRightCorner' width="+b.radio+" height="+b.radio+"></canvas>");a(this).append("<canvas id='"+e+"_DownLeftCorner' width="+b.radio+" height="+b.radio+"></canvas>");a(this).append("<canvas id='"+e+"_DownRightCorner' width="+b.radio+" height="+b.radio+"></canvas>");a(this).append("<div id='"+e+"_main'>"+c+"</div>");a("#"+e+"_main").css({position:"relative",zIndex:1});a("#"+e+"_UpLeftCorner, #"+e+"_UpRightCorner, #"+e+"_DownLeftCorner, #"+e+"_DownRightCorner").css({position:"absolute",zIndex:0,width:b.radio+"px",height:b.radio+"px",backgroundColor:b.inColor});if(b.borderSize!=0){var d=-(b.borderSize);a("#"+e+"_UpLeftCorner").css({top:d+"px",left:d+"px"});a("#"+e+"_UpRightCorner").css({top:d+"px",right:d+"px"});a("#"+e+"_DownLeftCorner").css({bottom:d+"px",left:d+"px"});a("#"+e+"_DownRightCorner").css({bottom:d+"px",right:d+"px"})}else{a("#"+e+"_UpLeftCorner").css({top:"0px",left:"0px"});a("#"+e+"_UpRightCorner").css({top:"0px",right:"0px"});a("#"+e+"_DownLeftCorner").css({bottom:"0px",left:"0px"});a("#"+e+"_DownRightCorner").css({bottom:"0px",right:"0px"});b.borderColor=b.inColor}a(this).drawCorners(e,b.radio,b.inColor,b.outColor,b.borderSize,b.borderColor)})}})(jQuery);