/*------------------------------------------------------------------------------
Function:       eCSStender.CSS3-backgrounds-and-borders.js
Author:         Aaron Gustafson (aaron at easy-designs dot net)
Creation Date:  2010-04-24
Version:        0.3.5
Homepage:       http://github.com/easy-designs/eCSStender.CSS3-backgrounds-and-borders.js
License:        MIT License 
Note:           If you change or improve on this script, please let us know by
                emailing the author (above) with a link to your demo page.
------------------------------------------------------------------------------*/
(function(){if(eCSStender===undefined){return}var f=eCSStender,a=new a(f),g=new c(f),b=new d(f);function a(h){}function c(y){var B,z="property",s="-moz-",q="-webkit-",i="-khtml-",l=" ",k=": ",t="; ",w="border-radius",A="-topleft",m="border-top-left-radius",o="border-top-right-radius",r="border-bottom-right-radius",p="border-bottom-left-radius",u=k+"3px";y.register({fragment:"radius",test:function(){return(!y.isSupported(z,m+u)&&(y.isSupported(z,s+w+A+u)||y.isSupported(z,q+m+u)||y.isSupported(z,i+m+u)))},fingerprint:"net.easy-designs."+w},false,v);function v(e,E,D){var F=e+" { ",C;if(E[w]!=B){C=j(E[w]);if(C.length>1){F+=h(C)}else{F+=s+w+k+E[w]+t+q+w+k+E[w]+t+i+w+k+E[w]+t}E[w]=null}for(var G in E){if(y.isInheritedProperty(E,G)){continue}F+=x(E,G)}F+="} ";y.embedCSS(F,D)}function j(E){var F=E.split("/"),C=[];if(F.length>1){var G=y.trim(F[0]).split(l);var e=y.trim(F[1]).split(l);G=n(G);e=n(e);for(var D=0;D<4;D++){C[D]=G[D]+l+e[D]}}else{C=n(y.trim(F[0]).split(l))}return C}function n(e){if(e.length<4){if(e[1]==B){e[1]=e[0]}if(e[2]==B){e[2]=e[0]}if(e[3]==B){e[3]=e[1]}}return e}function h(e){if(y.isSupported(z,q+m+u)||y.isSupported(z,i+m+u)){h=function(C){return q+m+k+C[0]+t+q+o+k+C[1]+t+q+r+k+C[2]+t+q+p+k+C[3]+t+i+m+k+C[0]+t+i+o+k+C[1]+t+i+r+k+C[2]+t+i+p+k+C[3]+t}}else{h=function(C){return s+w+A+k+C[0]+t+s+w+"-topright: "+C[1]+t+s+w+"-bottomright: "+C[2]+t+s+w+"-bottomleft: "+C[3]+t}}return h(e)}function x(e,C){if(y.isSupported(z,s+w+A+u)){x=function(D,E){return E.replace(/border-(top|bottom)-(left|right)-radius/,s+w+"-$1$2")+k+D[E]+t}}else{x=function(D,E){return E+k+D[E]+t}}return x(e,C)}}function d(y){var C,A="property",r="-moz-",q="-webkit-",h="-khtml-",n=" ",m=": ",s="; ",v="box-shadow",p="filter: ",x="progid:DXImageTransform.Microsoft.Shadow",z="2px",j="black",k="rgb(0, 0, 0)",B=m+k+n+z+n+z+n+z,i=B+n+z,o=p+x+"(color=#000000,direction=135,strength=3)",w=false;y.register({property:v,test:function(){return(!y.isSupported(A,v+i)&&(y.isSupported(A,r+v+i)||y.isSupported(A,q+v+B)||y.isSupported(A,q+v+i)||y.isSupported(A,h+v+B)||y.isSupported(A,h+v+i)||y.isSupported(A,p+o)))},fingerprint:"net.easy-designs."+v},false,u);function u(D,H,K){var J=D+" { ",I=H[v],e=I.match(/((?:rgb|hsl)a?\([^\)]+\))/g),F=count=(e instanceof Array?e.length:0),E="%MASKED_COLOR",G="%";if(F){while(F--){I=I.replace(e[F],E+F+G)}}J+=l(I);F=count;if(F){while(F--){J=J.replace(new RegExp(E+F+G,"g"),e[F])}}J+="} ";y.embedCSS(J,K)}function l(e){if(y.isSupported(A,p+o)){l=function(L){var G=L.split(","),J="zoom: 1; "+p,H=G.length,M=/(#)([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/,E,K,D,I,F;while(H--){L=y.trim(G[H]).split(n);E=L.length;K=t(L[0],L[1]);D=I=null;switch(E){case 5:D=y.trim(L[2]).replace(/(\d+).*/,"$1");I=y.trim(L[3]);F=y.trim(L[4]);break;case 4:D=y.trim(L[2]).replace(/(\d+).*/,"$1");F=y.trim(L[3]);break;case 3:F=y.trim(L[2]);break}if(F.match(M)){F=F.replace(M,"$1$2$2$3$3$4$4")}J+=x+"(color="+F+",direction="+K+",strength="+D+") "}return J+s}}else{if(y.isSupported(A,q+v+i)||y.isSupported(A,h+v+i)){w=true}l=function(L){var I=L.split(","),M=[],J=I.length,H=null,E,G,D,K,F;while(J--){L=y.trim(I[J]).split(n);E=L.length;G=L[0]+" "+L[1];D=K=H;switch(E){case 5:D=y.trim(L[2]);K=y.trim(L[3]);F=y.trim(L[4]);break;case 4:D=y.trim(L[2]);F=y.trim(L[3]);break;case 3:F=y.trim(L[2]);break}M[J]=G+n+(D!=H?D+n:"")+(w&&K!=H?K+n:"")+F}M=M.join(", ")+s;return q+v+m+M+h+v+m+M+r+v+m+M}}return l(e)}function t(e,D){return 270-(Math.atan2(parseInt(D,10),0-parseInt(e,10))*180/Math.PI)}}})();
