// $Id: jquery.curvycorners.min.js,v 1.1.2.1 2010/05/19 19:28:17 sheenad Exp $ /* JQuery Curvy Corners by Mike Jolley http://blue-anvil.com http://code.google.com/p/jquerycurvycorners/ ------------ Version 2.0.2 Beta 3 Original by: Terry Riegel, Cameron Cooke and Tim Hutchison Website: http://www.curvycorners.net This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ function styleit(){for(var t=0;t-1<4){var cc=corners[i];if(cc=="tr"||cc=="tl"){var bwidth=this.x_bw;var bcolor=this.x_bc;}else{var bwidth=this.x_bbw;var bcolor=this.x_bbc;}var newCorner=document.createElement("div");$(newCorner).css({position:"absolute","font-size":"1px",overflow:"hidden"}).height(settings[cc].radius+"px").width(settings[cc].radius+"px");var borderRadius=parseInt(settings[cc].radius-bwidth);for(var intx=0,j=settings[cc].radius;intx=borderRadius)var y1=-1;else var y1=(Math.floor(Math.sqrt(Math.pow(borderRadius,2)-Math.pow((intx+1),2)))-1);if(borderRadius!=j){if((intx)>=borderRadius)var y2=-1;else var y2=Math.ceil(Math.sqrt(Math.pow(borderRadius,2)-Math.pow(intx,2)));if((intx+1)>=j)var y3=-1;else var y3=(Math.floor(Math.sqrt(Math.pow(j,2)-Math.pow((intx+1),2)))-1);}if((intx)>=j)var y4=-1;else var y4=Math.ceil(Math.sqrt(Math.pow(j,2)-Math.pow(intx,2)));if(y1>-1)drawPixel(intx,0,this.x_bgc,100,(y1+1),newCorner,-1,settings[cc].radius,0,this.x_bgi,this.x_width,this.x_height,this.x_bw,this.x_bgr);if(borderRadius!=j){for(var inty=(y1+1);inty=y2){if(y2==-1)y2=0;drawPixel(intx,y2,bcolor,100,(y3-y2+1),newCorner,0,0,1,this.x_bgi,this.x_width,this.x_height,bwidth,this.x_bgr);}}else {if(y3>=y1){drawPixel(intx,(y1+1),bcolor,100,(y3-y1),newCorner,0,0,1,this.x_bgi,this.x_width,this.x_height,bwidth,this.x_bgr);}}var outsideColour=bcolor;}else {var outsideColour=this.x_bgc;var y3=y1;}if(settings.antiAlias){for(var inty=(y3+1);inty0)?0:-1),settings[cc].radius,0,this.x_bgi,this.x_width,this.x_height,bwidth);}}}masterCorners[settings[cc].radius]=$(newCorner).clone();for(var t=0,k=newCorner.childNodes.length;t ');}function drawPixel(intx,inty,colour,transAmount,height,newCorner,image,cornerRadius,isBorder,bgImage,x_width,x_height,x_bw,repeat){var pixel=document.createElement("div");$(pixel).css({"height":height,"width":"1px","position":"absolute","font-size":"1px","overflow":"hidden","top":inty+"px","left":intx+"px","background-color":colour});var topMaxRadius=Math.max(settings.tl?settings.tl.radius:0,settings.tr?settings.tr.radius:0);if(image==-1&&bgImage!=""){$(pixel).css({"background-position":"-"+Math.abs(x_width-(cornerRadius-intx)+x_bw)+"px -"+Math.abs((x_height+topMaxRadius+inty)-x_bw)+"px","background-image":bgImage,"background-repeat":repeat});}else {if(!isBorder)$(pixel).addClass('hasBackgroundColor');}if(transAmount!=100)$(pixel).css({opacity:(transAmount/100)});newCorner.appendChild(pixel);};function BlendColour(Col1,Col2,Col1Fraction){var red1=parseInt(Col1.substr(1,2),16);var green1=parseInt(Col1.substr(3,2),16);var blue1=parseInt(Col1.substr(5,2),16);var red2=parseInt(Col2.substr(1,2),16);var green2=parseInt(Col2.substr(3,2),16);var blue2=parseInt(Col2.substr(5,2),16);if(Col1Fraction>1||Col1Fraction<0)Col1Fraction=1;var endRed=Math.round((red1*Col1Fraction)+(red2*(1-Col1Fraction)));if(endRed>255)endRed=255;if(endRed<0)endRed=0;var endGreen=Math.round((green1*Col1Fraction)+(green2*(1-Col1Fraction)));if(endGreen>255)endGreen=255;if(endGreen<0)endGreen=0;var endBlue=Math.round((blue1*Col1Fraction)+(blue2*(1-Col1Fraction)));if(endBlue>255)endBlue=255;if(endBlue<0)endBlue=0;return"#"+IntToHex(endRed)+IntToHex(endGreen)+IntToHex(endBlue);}function IntToHex(strNum){rem=strNum%16;base=Math.floor(strNum/16);baseS=MakeHex(base);remS=MakeHex(rem);return baseS+''+remS;}function MakeHex(x){if((x>=0)&&(x<=9)){return x;}else {switch(x){case 10:return"A";case 11:return"B";case 12:return"C";case 13:return"D";case 14:return"E";case 15:return"F";}}}function pixelFraction(x,y,r){var pixelfraction=0;var xvalues=new Array(1);var yvalues=new Array(1);var point=0;var whatsides="";var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(x,2)));if((intersect>=y)&&(intersect<(y+1))){whatsides="Left";xvalues[point]=0;yvalues[point]=intersect-y;point=point+1;}var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(y+1,2)));if((intersect>=x)&&(intersect<(x+1))){whatsides=whatsides+"Top";xvalues[point]=intersect-x;yvalues[point]=1;point=point+1;}var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(x+1,2)));if((intersect>=y)&&(intersect<(y+1))){whatsides=whatsides+"Right";xvalues[point]=1;yvalues[point]=intersect-y;point=point+1;}var intersect=Math.sqrt((Math.pow(r,2)-Math.pow(y,2)));if((intersect>=x)&&(intersect<(x+1))){whatsides=whatsides+"Bottom";xvalues[point]=intersect-x;yvalues[point]=0;}switch(whatsides){case"LeftRight":pixelfraction=Math.min(yvalues[0],yvalues[1])+((Math.max(yvalues[0],yvalues[1])-Math.min(yvalues[0],yvalues[1]))/2);break;case"TopRight":pixelfraction=1-(((1-xvalues[0])*(1-yvalues[1]))/2);break;case"TopBottom":pixelfraction=Math.min(xvalues[0],xvalues[1])+((Math.max(xvalues[0],xvalues[1])-Math.min(xvalues[0],xvalues[1]))/2);break;case"LeftBottom":pixelfraction=(yvalues[0]*xvalues[1])/2;break;default:pixelfraction=1;}return pixelfraction;}function rgb2Hex(rgbColour){try{var rgbArray=rgb2Array(rgbColour);var red=parseInt(rgbArray[0]);var green=parseInt(rgbArray[1]);var blue=parseInt(rgbArray[2]);var hexColour="#"+IntToHex(red)+IntToHex(green)+IntToHex(blue);}catch(e){alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");}return hexColour;}function rgb2Array(rgbColour){var rgbValues=rgbColour.substring(4,rgbColour.indexOf(")"));var rgbArray=rgbValues.split(", ");return rgbArray;}function format_colour(colour){var returnColour="#ffffff";if(colour!=""&&colour!="transparent"){if(colour.substr(0,3)=="rgb"&&colour.substr(0,4)!="rgba"){returnColour=rgb2Hex(colour);}else if(colour.length==4){returnColour="#"+colour.substring(1,2)+colour.substring(1,2)+colour.substring(2,3)+colour.substring(2,3)+colour.substring(3,4)+colour.substring(3,4);}else {returnColour=colour;}}return returnColour;}function strip_px(value){if(typeof(value)!='string')return value;return parseInt(((value!="auto"&&value.indexOf("%")==-1&&value!=""&&value.indexOf("px")!==-1)?Math.round(value.slice(0,value.indexOf("px"))):0))}};})(jQuery);