function ajax(url,callback){var xmlHttp=null;try{xmlHttp=new XMLHttpRequest();}catch(e){}if(xmlHttp){xmlHttp.open('GET',url,true);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){callback(xmlHttp.responseText);}};xmlHttp.send(null);}}window.onscroll=function(){scrollFunction()};function scrollFunction(){if(window.pageYOffset > 250){document.getElementById("back-to-top").style.display="block";}else{document.getElementById("back-to-top").style.display="none";}}function scrollTopFunction(){window.scrollBy(0,Math.floor(window.pageYOffset/-5));if(window.pageYOffset > 5){window.setTimeout(scrollTopFunction,25);}else{window.scrollTo(0,0);}}function saveCanvas(canvas,button){var dataURL=canvas.toDataURL();button.href=dataURL;}function canvasFillBackground(canvas,color){var c=canvas.getContext('2d');var width=canvas.offsetWidth;var height=canvas.offsetHeight;c.beginPath();c.fillStyle=color;c.fillRect(0,0,width,height);}function canvasDrawLine(context,x1,y1,x2,y2){context.beginPath();context.moveTo(x1,y1);context.lineTo(x2,y2);context.stroke();}function canvasDrawRect(context,x,y,w,h){context.beginPath();context.rect(x,y,w,h);context.stroke();}function canvasDrawRectFilled(context,x,y,w,h){context.beginPath();context.rect(x,y,w,h);context.fill();}function canvasDrawCircle(context,x,y,r){context.beginPath();context.arc(x,y,r,0,2*Math.PI);context.stroke();}function canvasDrawCircleFilled(context,x,y,r){context.beginPath();context.arc(x,y,r,0,2*Math.PI);context.fill();}function canvasDrawStickFigure(c,x,y,yell,wink){c.beginPath();c.moveTo(x,y-5);c.lineTo(x,y+10);c.stroke();c.beginPath();c.arc(x,y-15,10,0,2*Math.PI);c.stroke();if(yell)canvasDrawCircle(c,x-4,y-18,2);else canvasDrawCircle(c,x-4,y-18,1);if(yell)canvasDrawCircle(c,x+4,y-18,2);else canvasDrawCircle(c,x+4,y-18,1);c.beginPath();c.moveTo(x,y-17);c.lineTo(x,y-14);c.stroke();c.beginPath();if(yell)c.arc(x,y-11,2,0,2*Math.PI);if(wink)c.arc(x,y-12,3,6.5,9.4);if(!yell && !wink){c.moveTo(x-5,y-11);c.lineTo(x+5,y-11);}c.stroke();c.moveTo(x,y);if(yell || wink)c.lineTo(x+12,y-10);else c.lineTo(x+10,y+10);c.stroke();c.moveTo(x,y+10);c.lineTo(x+10,y+25);c.stroke();c.moveTo(x,y);if(yell)c.lineTo(x-12,y-10);else c.lineTo(x-10,y+10);c.stroke();c.moveTo(x,y+10);c.lineTo(x-10,y+25);c.stroke();} function clock(time,date,day){jetzt=new Date();Stunde=jetzt.getHours();Stunde=(Stunde < 10)? "0"+Stunde:Stunde;Minute=jetzt.getMinutes();Minute=(Minute < 10)? "0"+Minute:Minute;Sekunde=jetzt.getSeconds();Sekunde=(Sekunde < 10)? "0"+Sekunde:Sekunde;time.innerHTML=Stunde+":"+Minute+":"+Sekunde;Tag=jetzt.getDate();Tag=(Tag < 10)? "0"+Tag:Tag;Monat=jetzt.getMonth()+1;Monat=(Monat < 10)? "0"+Monat:Monat;Jahr=jetzt.getFullYear();date.innerHTML=Tag+"."+Monat+"."+Jahr;var WochenTag=new Array("Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag");day.innerHTML=WochenTag[jetzt.getDay()];}function getEventPosition(event){var position=[];var posX=event.pageX;var posY=event.pageY;position['x']=posX;position['y']=posY;return position;}function getEventPositionOnElement(event,element){var position=getEventPosition(event);position['x']=position['x']- element.getBoundingClientRect().left;position['y']=position['y']- element.getBoundingClientRect().top;position['x']=position['x']- window.pageXOffset;position['y']=position['y']- window.pageYOffset;return position;} function htmlTableOfContents(url=document.location){var toc=document.createElement("nav");toc.setAttribute('id','jsToc');toc.setAttribute('class','jstoc');var h1=[].slice.call(document.body.querySelectorAll('h1'));h1.forEach(function(heading,index){heading.parentNode.insertBefore(toc,heading.nextSibling);});var headings=[].slice.call(document.body.querySelectorAll('h2,h3,h4,h5,h6'));headings.forEach(function(heading,index){var anchor=document.createElement('a');anchor.setAttribute('name',heading.textContent);anchor.setAttribute('id',heading.textContent);var link=document.createElement('a');link.setAttribute('href',url+'#'+heading.textContent);link.textContent=heading.textContent;var div=document.createElement('span');div.setAttribute('class',heading.tagName.toLowerCase());div.appendChild(link);toc.appendChild(div);toc.appendChild(document.createElement('br'));heading.parentNode.insertBefore(anchor,heading);});} function pad0(value,count){var result=value.toString();for(;result.length < count;--count)result='0'+result;return result;} function swap(dict){var ret={};for(var key in dict){ret[dict[key]]=key;}return ret;}