/** * instant.js 2.21 (18-Mar-2009) * (c) by Christian Effenberger * All Rights Reserved * Source: instant.netzgesta.de * Distributed under Netzgestade Software License Agreement * http://www.netzgesta.de/cvi/LICENSE.txt * License permits free of charge * use on non-commercial and * private web sites only **/ var tmp = navigator.appName == 'Microsoft Internet Explorer' && navigator.userAgent.indexOf('Opera') < 1 ? 1 : 0; if(tmp) var isIE = document.namespaces ? 1 : 0; if(isIE) { if(document.namespaces['v']==null) { var e=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","roundrect","oval","rect","arc","image"],s=document.createStyleSheet(); for(var i=0; i0) {t=rF(ha,Math.min(ch,hz)); c=rF(1,t); ctx.quadraticCurveTo(cx+rF(da,dz),cy+c,cx,cy+t); cy+=t; ch-=t;} cx=x; cy=y+h; cw=w; while(cw>0) {t=rF(wa,Math.min(cw,wz)); c=rF(1,t); ctx.quadraticCurveTo(cx+c,cy-rF(da,dz),cx+t,cy); cx+=t; cw-=t;} cx=x+w; cy=y+h; ch=h; while(ch>0) {t=rF(ha,Math.min(ch,hz)); c=rF(1,t); ctx.quadraticCurveTo(cx-rF(da,dz),cy-c,cx,cy-t); cy-=t; ch-=t;} cx=x+w; cy=y; cw=w; while(cw>0) {t=rF(wa,Math.min(cw,wz)); c=rF(1,t); ctx.quadraticCurveTo(cx-c,cy+rF(da,dz),cx-t,cy); cx-=t; cw-=t;} if(!n) ctx.closePath(); } function wavedPath(x,y,w,h,r){ function rI(a,b) {return parseInt(Math.floor(Math.random()*(b-a+1))+a);}; function qC(cX,cY,CPx,CPy,aX,aY) {var z=new Array(6); z[0]=cX+2.0/3.0*(CPx-cX); z[1]=cY+2.0/3.0*(CPy-cY); z[2]=z[0]+(aX-cX)/3.0; z[3]=z[1]+(aY-cY)/3.0; z[4]=aX; z[5]=aY; return z;} var p="",i,k,t,c,cx,cy,cw,ch,wa=w/16,wz=w/32,ha=h/16,hz=h/32,da=r*0.1,dz=r*0.25; p+='m '+x+','+y; cx=x; cy=y; ch=h; while(ch>0) {t=rI(ha,Math.min(ch,hz)); c=rI(1,t); k=qC(cx,cy,cx+rI(da,dz),cy+c,cx,cy+t); p+=' c '+parseInt(k[0])+','+Math.min(h,parseInt(k[1]))+','+parseInt(k[2])+','+Math.min(h,parseInt(k[3]))+','+parseInt(k[4])+','+Math.min(h,parseInt(k[5])); cy+=t; ch-=t;} cx=x; cy=y+h; cw=w; while(cw>0) {t=rI(wa,Math.min(cw,wz)); c=rI(1,t); k=qC(cx,cy,cx+c,cy-rI(da,dz),cx+t,cy); p+=' c '+Math.min(w,parseInt(k[0]))+','+parseInt(k[1])+','+Math.min(w,parseInt(k[2]))+','+parseInt(k[3])+','+Math.min(w,parseInt(k[4]))+','+parseInt(k[5]); cx+=t; cw-=t;} cx=x+w; cy=y+h; ch=h; while(ch>0) {t=rI(ha,Math.min(ch,hz)); c=rI(1,t); k=qC(cx,cy,cx-rI(da,dz),cy-c,cx,cy-t); p+=' c '+parseInt(k[0])+','+Math.max(0,parseInt(k[1]))+','+parseInt(k[2])+','+Math.max(0,parseInt(k[3]))+','+parseInt(k[4])+','+Math.max(0,parseInt(k[5])); cy-=t; ch-=t;} cx=x+w; cy=y; cw=w; while(cw>0) {t=rI(wa,Math.min(cw,wz)); c=rI(1,t); k=qC(cx,cy,cx-c,cy+rI(da,dz),cx-t,cy); p+=' c '+Math.max(0,parseInt(k[0]))+','+parseInt(k[1])+','+Math.max(0,parseInt(k[2]))+','+parseInt(k[3])+','+Math.max(0,parseInt(k[4]))+','+parseInt(k[5]); cx-=t; cw-=t;} return p+' x e'; } function roundedRect(ctx,x,y,width,height,radius,nopath){ if (!nopath) ctx.beginPath(); ctx.moveTo(x,y+radius); ctx.lineTo(x,y+height-radius); ctx.quadraticCurveTo(x,y+height,x+radius,y+height); ctx.lineTo(x+width-radius,y+height); ctx.quadraticCurveTo(x+width,y+height,x+width,y+height-radius); ctx.lineTo(x+width,y+radius); ctx.quadraticCurveTo(x+width,y,x+width-radius,y); ctx.lineTo(x+radius,y); ctx.quadraticCurveTo(x,y,x,y+radius); if (!nopath) ctx.closePath(); } function addIEInstant() { var theimages = getImages('instant'); var image; var object; var vml; var display; var border = 16; var offset = 8; var scale = 1; var icolor = ''; var ishadow = 0; var noshading; var itiltright; var itiltnone; var itiltleft; var itxttitle; var itxtalt; var itxtcol; var text=""; var color = ''; var tilt = 'r'; var opacity = 0; var tw; var preserve, tcolor, head, foot, frame, fill, shadow, shade, txt, over, shine; var classes = ''; var newClasses = ''; var path, historical, nocorner; var inset = 6; var i, f, r, db, hz, flt, ww, hh, ff, yo, xo; for(i=0;i=64 && image.height>=64) { classes = image.className.split(' '); ishadow = getClassValue(classes,"ishadow"); if(ishadow>0) opacity=ishadow/100; icolor = getClassColor(classes,"icolor"); if(icolor!=0) color = icolor; itxtcol = getClassColor(classes,"itxtcol"); if(itxtcol!=0) tcolor = itxtcol; itxttitle = getClassAttribute(classes,"itxttitle"); itxtalt = getClassAttribute(classes,"itxtalt"); itiltleft = getClassAttribute(classes,"itiltleft"); itiltright = getClassAttribute(classes,"itiltright"); itiltnone = getClassAttribute(classes,"itiltnone"); historical = getClassAttribute(classes,"historical"); noshading = getClassAttribute(classes,"noshading"); nocorner = getClassAttribute(classes,"nocorner"); preserve = getClassAttribute(classes,"preserve"); if(historical==true) nocorner = false; if(itiltright==true) tilt = 'r'; if(itiltnone==true) tilt = 'n'; if(itiltleft==true) tilt = 'l'; newClasses = getClasses(classes,"instant"); width = image.width; height = image.height; border = Math.round(((width+height)/2)*0.05); db=border; offset = border/2; inset = parseInt(offset*.75); ww=width-(border*2); hh=height-(border*2); hz=Math.round(hh/3); f=(noshading==0?"t":"f"); r=nocorner?getRadius(border,width,height):0; if(tilt=='r') { rotation = 2.8; scale = 0.95; tilt = 'n'; }else if(tilt=='n') { rotation = 0; scale = 1; tilt = 'l'; }else if(tilt=='l') { rotation = -2.8; scale = 0.95; tilt = 'r'; } display = (image.currentStyle.display.toLowerCase()=='block')?'block':'inline-block'; vml = document.createElement([''].join('')); flt = image.currentStyle.styleFloat.toLowerCase(); display = (flt=='left'||flt=='right')?'inline':display; text = image.alt!=''&&itxtalt!=0?image.alt:image.title!=''&&itxttitle!=0?image.title:''; head = ''; shadow = ''; if(historical==0) { frame = ''; }else {path = wavedPath(0,0,(width-offset)*10,(height-offset)*10,border*10); frame = ''; } shine = ''; if(typeof check_strokeTextCapability=='function' && check_strokeTextCapability() && text!='') { over = ''; text = get_widthText(text,ww,border*1.5,100,100); tw = get_textWidth(text,border*1.5,100,100); txt = get_strokeText(text,((width-offset)-tw)/2,height-offset-(border*(document.documentMode==8&&rotation!=0?3.4:2.4)),border*1.5,100,100,100,"sans-serif",tcolor,1,0); shade = ''; }else { shade = ''; } if(preserve==0) { fill = ''; }else { if(width>height) { ff=(height/width); xo=0; yo=((ww*ff)-hh)/2; hh=(ww*ff); yo=(yo/(hh/100)); }else if(width'; } foot = ''; vml.innerHTML = head+shadow+frame+shine+fill+shade+over+txt+foot; vml.className = newClasses; vml.style.cssText = image.style.cssText; vml.style.visibility = 'visible'; vml.src = image.src; vml.alt = image.alt; vml.width = image.width; vml.height = image.height; if(image.id!='') vml.id = image.id; if(image.title!='') vml.title = image.title; if(image.getAttribute('onclick')!='') vml.setAttribute('onclick',image.getAttribute('onclick')); object.replaceChild(vml,image); } } } function addInstant() { var theimages = getImages('instant'); var image; var object; var canvas; var context; var border = 16; var offset = 8; var inset = 2; var icolor = ''; var ishadow = 0; var noshading; var itiltright; var itiltnone; var itiltleft; var itxttitle; var itxtalt; var itxtcol; var text=""; var tw; var color = ''; var tilt = 'r'; var opacity = 0; var db; var classes = ''; var newClasses = ''; var style = ''; var scale = 0; var xscale = 1; var yscale = 1; var i, ww, hh, ff, yo, xo, tcolor, nocorner, historical, preserve; for(i=0;i=64 && image.height>=64) { classes = image.className.split(' '); ishadow = getClassValue(classes,"ishadow"); if(ishadow>0) opacity=ishadow/100; icolor = getClassColor(classes,"icolor"); if(icolor!=0) color = icolor; itiltleft = getClassAttribute(classes,"itiltleft"); itiltright = getClassAttribute(classes,"itiltright"); itiltnone = getClassAttribute(classes,"itiltnone"); itxtcol = getClassColor(classes,"itxtcol"); if(itxtcol!=0) tcolor = itxtcol; itxttitle = getClassAttribute(classes,"itxttitle"); itxtalt = getClassAttribute(classes,"itxtalt"); historical = getClassAttribute(classes,"historical"); noshading = getClassAttribute(classes,"noshading"); nocorner = getClassAttribute(classes,"nocorner"); preserve = getClassAttribute(classes,"preserve"); if(historical==true) nocorner = false; if(itiltright==true) tilt = 'r'; if(itiltnone==true) tilt = 'n'; if(itiltleft==true) tilt = 'l'; newClasses = getClasses(classes,"instant"); canvas.className = newClasses; canvas.style.cssText = image.style.cssText; canvas.style.height = image.height+'px'; canvas.style.width = image.width+'px'; canvas.height = image.height; canvas.width = image.width; canvas.src = image.src; canvas.alt = image.alt; if(image.id!='') canvas.id = image.id; if(image.title!='') canvas.title = image.title; if(image.getAttribute('onclick')!='') canvas.setAttribute('onclick',image.getAttribute('onclick')); text = canvas.alt!=''&&itxtalt!=0?canvas.alt:canvas.title!=''&&itxttitle!=0?canvas.title:''; border = Math.round(((canvas.width+canvas.height)/2)*0.05); db = Math.round(Math.max(canvas.width,canvas.height)*0.05); offset = border/2; ww=canvas.width-(border*2); hh=canvas.height-(border*2); inset = Math.floor(Math.min(Math.max(border/8,1),2)); if(canvas.width>canvas.height) { xscale = 0.05; yscale = xscale*(canvas.width/canvas.height); }else if(canvas.widthcanvas.height) { ff=(canvas.height/canvas.width); xo=0; yo=((ww*ff)-hh)/2; hh=(ww*ff); }else if(canvas.width