(function(){AdSenseGraphics.POS_TOP_LEFT_=0;AdSenseGraphics.POS_TOP_RIGHT_=1;AdSenseGraphics.POS_BOTTOM_LEFT_=2;AdSenseGraphics.POS_BOTTOM_RIGHT_=3;AdSenseGraphics.X_INTERCEPT_TOP_=0;AdSenseGraphics.X_INTERCEPT_BOTTOM_=1;AdSenseGraphics.Y_INTERCEPT_LEFT_=2;AdSenseGraphics.Y_INTERCEPT_RIGHT_=3;AdSenseGraphics.USER_AGENT_=navigator.userAgent;AdSenseGraphics.IS_OPERA_="undefined"!=typeof opera;AdSenseGraphics.IS_IE_=!AdSenseGraphics.IS_OPERA_&&-1!=AdSenseGraphics.USER_AGENT_.indexOf("MSIE");
AdSenseGraphics.IS_SAFARI_=!AdSenseGraphics.IS_OPERA_&&-1!=AdSenseGraphics.USER_AGENT_.indexOf("Safari");AdSenseGraphics.S_CURVE_CLASS_NAME_="curve";AdSenseGraphics.ROUNDED_CORNER_BG_CLASS_NAME_="rc_bg";AdSenseGraphics.ROUNDED_CORNER_BORDER_CLASS_NAME_="rc_border";AdSenseGraphics.SIGMOID_FUNCTION_WIDTH=12;AdSenseGraphics.SIGMOID_FUNCTION_OFFSET=6;function AdSenseGraphics(){}AdSenseGraphics.prototype.getPixelLeftX_=function(a){return a};
AdSenseGraphics.prototype.getPixelRightX_=function(a){return a+1};AdSenseGraphics.prototype.getPixelBottomY_=function(a){return a};AdSenseGraphics.prototype.getPixelTopY_=function(a){return a+1};AdSenseGraphics.prototype.computeSigmoid_=function(a,d,b){a=12*a/d-6;return b/(1+Math.exp(a))};AdSenseGraphics.prototype.computeSigmoidInverse_=function(a,d,b){if(0>=a)return d;if(a>=b)return 0;a/=b;a=Math.log((1-a)/a);return d*(a+6)/12};
AdSenseGraphics.prototype.computeCircle_=function(a,d){var b=Math.sqrt(Math.pow(d,2)-Math.pow(a,2));return isNaN(b)?0:b};AdSenseGraphics.prototype.addStyleRule_=function(a,d){if(AdSenseGraphics.IS_IE_)document.styleSheets[0].addRule(a,d);else{var b=document.createElement("style");b.type="text/css";var c=AdSenseGraphics.IS_SAFARI_?"innerText":"innerHTML";b[c]=a+"{"+d+"}";c=document.getElementsByTagName("head")[0];c.appendChild(b)}};
AdSenseGraphics.prototype.createDiv_=function(a,d,b,c,e){var h=document.createElement("div"),f="position:absolute;overflow:hidden;left:",f=f+a,f=f+"px;top:",f=f+d,f=f+"px;width:",f=f+b,f=f+"px;height:",f=f+c,f=f+"px;";null!=e&&(f+="opacity:",f+=e,AdSenseGraphics.IS_IE_&&(f+=";filter: alpha(opacity=",f+=Math.round(100*e),f+=");"));h.style.cssText=f;return h};
AdSenseGraphics.prototype.getCirclePixelIntercepts_=function(a,d,b){var c=Array(4);c[AdSenseGraphics.Y_INTERCEPT_LEFT_]=this.computeCircle_(this.getPixelLeftX_(a),b);c[AdSenseGraphics.Y_INTERCEPT_RIGHT_]=this.computeCircle_(this.getPixelRightX_(a),b);c[AdSenseGraphics.X_INTERCEPT_BOTTOM_]=this.computeCircle_(this.getPixelBottomY_(d),b);c[AdSenseGraphics.X_INTERCEPT_TOP_]=this.computeCircle_(this.getPixelTopY_(d),b);return c};
AdSenseGraphics.prototype.getSigmoidPixelIntercepts_=function(a,d,b,c){var e=Array(4);e[AdSenseGraphics.Y_INTERCEPT_LEFT_]=this.computeSigmoid_(this.getPixelLeftX_(a),b,c);e[AdSenseGraphics.Y_INTERCEPT_RIGHT_]=this.computeSigmoid_(this.getPixelRightX_(a),b,c);e[AdSenseGraphics.X_INTERCEPT_BOTTOM_]=this.computeSigmoidInverse_(this.getPixelBottomY_(d),b,c);e[AdSenseGraphics.X_INTERCEPT_TOP_]=this.computeSigmoidInverse_(this.getPixelTopY_(d),b,c);return e};
AdSenseGraphics.prototype.getSigmoidAntiAliasOpacity_=function(a,d,b,c){b=this.getSigmoidPixelIntercepts_(a,d,b,c);a=this.getAntiAliasOpacity_(a,d,b);return-1==a?0:a};AdSenseGraphics.prototype.getCircleAntiAliasOpacity_=function(a,d,b,c){b=this.getCirclePixelIntercepts_(a,d,b);a=this.getAntiAliasOpacity_(a,d,b);return-1==a?0:c?1-a:a};
AdSenseGraphics.prototype.getAntiAliasOpacity_=function(a,d,b){var c=0,e=Array(2),h=Array(2),f=!1,l=!1,g=!1,m=!1,j=this.getPixelBottomY_(d),d=this.getPixelTopY_(d),k=this.getPixelLeftX_(a),a=this.getPixelRightX_(a);b[AdSenseGraphics.Y_INTERCEPT_LEFT_]>=j&&b[AdSenseGraphics.Y_INTERCEPT_LEFT_]<d?(f=!0,e[0]=0,h[0]=b[AdSenseGraphics.Y_INTERCEPT_LEFT_]-j):b[AdSenseGraphics.X_INTERCEPT_TOP_]>=k&&b[AdSenseGraphics.X_INTERCEPT_TOP_]<a&&(l=!0,e[0]=b[AdSenseGraphics.X_INTERCEPT_TOP_]-k,h[0]=1);if(!l&&!f)return-1;
b[AdSenseGraphics.Y_INTERCEPT_RIGHT_]>=j&&b[AdSenseGraphics.Y_INTERCEPT_RIGHT_]<d?(g=!0,e[1]=1,h[1]=b[AdSenseGraphics.Y_INTERCEPT_RIGHT_]-j):b[AdSenseGraphics.X_INTERCEPT_BOTTOM_]>=k&&b[AdSenseGraphics.X_INTERCEPT_BOTTOM_]<a&&(m=!0,e[1]=b[AdSenseGraphics.X_INTERCEPT_BOTTOM_]-k,h[1]=0);f&&g?(e=h[0]<=h[1]?h[0]:h[1],h=h[0]>h[1]?h[0]:h[1],c=e+(h-e)/2):f&&m?c=h[0]*e[1]/2:l&&g?c=1-(1-e[0])*(1-h[1])/2:l&&m&&(h=e[0]<=e[1]?e[0]:e[1],e=e[0]>e[1]?e[0]:e[1],c=h+(e-h)/2);return c};
AdSenseGraphics.prototype.createSigmoidCurve=function(a,d,b,c,e,h){this.addStyleRule_("#"+a.id+" ."+AdSenseGraphics.S_CURVE_CLASS_NAME_+" div","background-color: "+c);a.style.display="none";c=this.createDiv_(0,0,d,b);c.className=AdSenseGraphics.S_CURVE_CLASS_NAME_;for(var f,l=b-1,g,m,j,k=b-1,p=0;p<d;++p){f=l;l=Math.floor(this.computeSigmoid_(p+1,d,b));m=e?p:d-p;g=h?0:b-l;0<l&&(g=this.createDiv_(m,g,1,l),c.appendChild(g));for(var n=l;n<=f;++n)j=this.getSigmoidAntiAliasOpacity_(p,n,d,b),g=h?n:k-n,g=
this.createDiv_(m,g,1,1,j),c.appendChild(g)}a.appendChild(c);a.style.display=""};
AdSenseGraphics.prototype.applyRoundedCorner=function(a,d,b,c,e,h,f,l){this.addStyleRule_("#"+a.id+" ."+AdSenseGraphics.ROUNDED_CORNER_BG_CLASS_NAME_+" div","background-color: "+c);this.addStyleRule_("#"+a.id+" ."+AdSenseGraphics.ROUNDED_CORNER_BORDER_CLASS_NAME_+" div","background-color: "+e);var d=d+h,b=b+h,g=a.style;g.display="none";a.innerHTML="";g.position="absolute";g.borderWidth="0px";g.backgroundColor="transparent";var e=h+"px solid "+e,m=l==AdSenseGraphics.POS_TOP_LEFT_||l==AdSenseGraphics.POS_BOTTOM_LEFT_,
l=l==AdSenseGraphics.POS_TOP_LEFT_||l==AdSenseGraphics.POS_TOP_RIGHT_,j=d-f;if(0<j){var k=m?d-j:0,j=this.createDiv_(k,0,j,b-h),k=j.style;k.backgroundColor=c;l?k.borderTop=e:k.borderBottom=e;a.appendChild(j)}j=b-f;0<j&&(k=l?b-j:0,j=this.createDiv_(0,k,d-h,j),k=j.style,k.backgroundColor=c,m?k.borderLeft=e:k.borderRight=e,a.appendChild(j));this.createRoundedCorner_(a,d,b,f,h,m,l);g.display=""};
AdSenseGraphics.prototype.createRoundedCorner_=function(a,d,b,c,e,h,f){var l=0<e,e=c-e,d=h?0:d-c,g=f?0:b-c,b=this.createDiv_(d,g,c,c);b.className=AdSenseGraphics.ROUNDED_CORNER_BG_CLASS_NAME_;var m=this.createDiv_(d,g,c,c);m.className=l?AdSenseGraphics.ROUNDED_CORNER_BORDER_CLASS_NAME_:AdSenseGraphics.ROUNDED_CORNER_BG_CLASS_NAME_;for(var j=e,k=c,p=e,n=c,r,s,t=c-1,q=0;q<c;++q){d=h?t-q:q;j=p;k=n;p=Math.ceil(this.computeCircle_(q+1,e));n=Math.floor(this.computeCircle_(q+1,c));r=l?j:n;g=f?c-r:0;g=this.createDiv_(d,
g,1,r);b.appendChild(g);for(var o=n;o<=k;++o)s=this.getCircleAntiAliasOpacity_(q,o,c,!1),g=f?t-o:o,g=this.createDiv_(d,g,1,1,s),m.appendChild(g);if(l){k=n-r;0<k&&(g=f?c-r-k:r,g=this.createDiv_(d,g,1,k),m.appendChild(g));for(o=p-1;o<j;++o)s=this.getCircleAntiAliasOpacity_(q,o,e,!0),g=f?t-o:o,g=this.createDiv_(d,g,1,1,s),m.appendChild(g)}}a.appendChild(b);a.appendChild(m)};var asg=new AdSenseGraphics;if("undefined"!=typeof window.rcl)for(var rc,i=0;i<rcl.length;i++)rc=rcl[i],asg.applyRoundedCorner(document.getElementById(rc[0]),rc[1],rc[2],rc[3],rc[4],rc[5],rc[6],rc[7]);"undefined"!=typeof window.sc&&asg.createSigmoidCurve(document.getElementById(sc[0]),sc[1],sc[2],sc[3],sc[4],sc[5]);})()
