function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){if(oldonload){oldonload();}
func();}}}
var getElementsByClassName=function(className,tag,elm){if(document.getElementsByClassName){getElementsByClassName=function(className,tag,elm){elm=elm||document;var elements=elm.getElementsByClassName(className),nodeName=(tag)?new RegExp("\\b"+ tag+"\\b","i"):null,returnElements=[],current;for(var i=0,il=elements.length;i<il;i+=1){current=elements[i];if(!nodeName||nodeName.test(current.nodeName)){returnElements.push(current);}}
return returnElements;};}
else if(document.evaluate){getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck="",xhtmlNamespace="http://www.w3.org/1999/xhtml",namespaceResolver=(document.documentElement.namespaceURI===xhtmlNamespace)?xhtmlNamespace:null,returnElements=[],elements,node;for(var j=0,jl=classes.length;j<jl;j+=1){classesToCheck+="[contains(concat(' ', @class, ' '), ' "+ classes[j]+" ')]";}
try{elements=document.evaluate(".//"+ tag+ classesToCheck,elm,namespaceResolver,0,null);}
catch(e){elements=document.evaluate(".//"+ tag+ classesToCheck,elm,null,0,null);}
while((node=elements.iterateNext())){returnElements.push(node);}
return returnElements;};}
else{getElementsByClassName=function(className,tag,elm){tag=tag||"*";elm=elm||document;var classes=className.split(" "),classesToCheck=[],elements=(tag==="*"&&elm.all)?elm.all:elm.getElementsByTagName(tag),current,returnElements=[],match;for(var k=0,kl=classes.length;k<kl;k+=1){classesToCheck.push(new RegExp("(^|\\s)"+ classes[k]+"(\\s|$)"));}
for(var l=0,ll=elements.length;l<ll;l+=1){current=elements[l];match=false;for(var m=0,ml=classesToCheck.length;m<ml;m+=1){match=classesToCheck[m].test(current.className);if(!match){break;}}
if(match){returnElements.push(current);}}
return returnElements;};}
return getElementsByClassName(className,tag,elm);};function supports_canvas(){return!!document.createElement('canvas').getContext;}
function gaussianBlur(img,pixels,amount){var width=img.width;var width4=width<<2;var height=img.height;var data=pixels.data;var q;if(amount<0.0){amount=0.0;}
if(amount>=2.5){q=0.98711*amount- 0.96330;}else if(amount>=0.5){q=3.97156- 4.14554*Math.sqrt(1.0- 0.26891*amount);}else{q=2*amount*(3.97156- 4.14554*Math.sqrt(1.0- 0.26891*0.5));}
var qq=q*q;var qqq=qq*q;var b0=1.57825+(2.44413*q)+(1.4281*qq)+(0.422205*qqq);var b1=((2.44413*q)+(2.85619*qq)+(1.26661*qqq))/b0;var b2=(-((1.4281*qq)+(1.26661*qqq)))/b0;var b3=(0.422205*qqq)/b0;var bigB=1.0-(b1+ b2+ b3);for(var c=0;c<3;c++){for(var y=0;y<height;y++){var index=y*width4+ c;var indexLast=y*width4+((width- 1)<<2)+ c;var pixel=data[index];var ppixel=pixel;var pppixel=ppixel;var ppppixel=pppixel;for(;index<=indexLast;index+=4){pixel=bigB*data[index]+ b1*ppixel+ b2*pppixel+ b3*ppppixel;data[index]=pixel;ppppixel=pppixel;pppixel=ppixel;ppixel=pixel;}
index=y*width4+((width- 1)<<2)+ c;indexLast=y*width4+ c;pixel=data[index];ppixel=pixel;pppixel=ppixel;ppppixel=pppixel;for(;index>=indexLast;index-=4){pixel=bigB*data[index]+ b1*ppixel+ b2*pppixel+ b3*ppppixel;data[index]=pixel;ppppixel=pppixel;pppixel=ppixel;ppixel=pixel;}}}
for(var c=0;c<3;c++){for(var x=0;x<width;x++){var index=(x<<2)+ c;var indexLast=(height- 1)*width4+(x<<2)+ c;var pixel=data[index];var ppixel=pixel;var pppixel=ppixel;var ppppixel=pppixel;for(;index<=indexLast;index+=width4){pixel=bigB*data[index]+ b1*ppixel+ b2*pppixel+ b3*ppppixel;data[index]=pixel;ppppixel=pppixel;pppixel=ppixel;ppixel=pixel;}
index=(height- 1)*width4+(x<<2)+ c;indexLast=(x<<2)+ c;pixel=data[index];ppixel=pixel;pppixel=ppixel;ppppixel=pppixel;for(;index>=indexLast;index-=width4){pixel=bigB*data[index]+ b1*ppixel+ b2*pppixel+ b3*ppppixel;data[index]=pixel;ppppixel=pppixel;pppixel=ppixel;ppixel=pixel;}}}
return(pixels);}
