window.onload = function () {
  var IsiPhone = navigator.userAgent.indexOf("iPhone") != -1 ;
  var IsiPod = navigator.userAgent.indexOf("iPod") != -1 ;
  var IsiPad = navigator.userAgent.indexOf("iPad") != -1 ;

  var IsiPhoneOS = IsiPhone || IsiPad || IsiPod ;

  function BlockMove(event) {
    // Tell Safari not to move the window.
    if(IsiPad) {
      event.preventDefault() ;
    }
  }



  if(!IsiPhone || !IsiPod) {
    CanvasRenderingContext2D.prototype.fillTextCircle = function(text,x,y,radius,startRotation){
       var numDegreesPerLetter = 2*Math.PI / text.length;
       this.save();
       this.translate(x,y);
       this.rotate(startRotation);

       for(var i=0;i<text.length;i++){
          this.save();
          this.translate(radius, 0);
          this.translate(10, -10);
          this.rotate(1.45);
          this.translate(-10, 10);
          this.fillText(text[i],0,0);
          this.restore();
          this.rotate(numDegreesPerLetter);
       }
       this.restore();
    };

    var can = document.getElementById('background'),
        ctx = can.getContext('2d');

    ctx.font = "300 20px Ubuntu";

    ctx.textAlign = "center";
    ctx.fillStyle = "#0B304E";
    ctx.shadowColor = "#fff";
    ctx.shadowOffsetX = 0;
    ctx.shadowOffsetY = 1;
    ctx.shadowBlur = 1;

    tagscontainer = document.getElementById('tags');
    text = "";
    for(var a in tagscontainer.childNodes) {
      if(tagscontainer.childNodes[a].localName == "li") {
        text += tagscontainer.childNodes[a].innerHTML + " - ";
      }
    }
    text = text.replace("&amp;", "&");
    ctx.fillTextCircle(text,250,250,215,Math.PI / 2);
  }
}


