// determines which "pic" will be shown on my home pahe
// OR a random canvas...
function makePic()
{
      var xpic;
      var spic;
      xpic = Math.random();
      // xpic = .1;
      // if(xpic>.83333){
      //   spic = '<a href="http://xkcd.com/365"  title="20 years of random...  (xkcd.com)" ><img src="jpgs/teacher.jpg"  border="0" alt="link to xkcd.com" /></a>';
      //   document.getElementById('wyattpic').innerHTML = spic;
      // }
      if(xpic>.8) {
         spic='<a href="http://xkcd.com/71"  title="the serenity of solitude...  (xkcd.com)" ><img src="jpgs/xkcd.jpg"  border="0" alt="link to xkcd.com" /></a>';
         document.getElementById('wyattpic').innerHTML = spic;
      }
      else if(xpic>.6) {
         spic='<a href="http://xkcd.com/664"  title="appreciate it...  (xkcd.com)" ><img src="jpgs/desk.jpg"  border="0" alt="link to xkcd.com" /></a>';
         document.getElementById('wyattpic').innerHTML = spic;
      }
      else
      {
         spic = '<a href="https://developer.mozilla.org/en/HTML/Canvas" title="chance of generating this particular graphic is 1 in 82 octillion! -- savor the uniqueness of the moment..."><canvas height="100" width="150" id="can">use a browser that supports html 5 canvas!</canvas></a>';
         //spic = '<canvas height="100" width="150" id="can">use a browser that supports html 5 canvas!</canvas>';
         document.getElementById('wyattpic').innerHTML = spic;
         var draw = document.getElementById("can");
         var ctx = draw.getContext("2d");
         for(var i=0;i <15;i++)
         {
          // COLOR r, g, b, opacity
          ctx.fillStyle='rgba(' + Math.round(Math.random()*200)  + ','
                                + Math.round(Math.random()*200)  + ','
                                + Math.round(Math.random()*200)  + ','
                                + Math.random()  + ')';
         // RECT x, y, width, height
         ctx.fillRect(Math.floor(Math.random()*120), Math.floor(Math.random()*60),
                      Math.floor(Math.random()*60), Math.floor(Math.random()*50));
         }
         for(var i=0;i <5;i++)
         {
          // COLOR r, g, b, opacity
          ctx.fillStyle='rgba(' + Math.round(Math.random()*256)  + ','
                                + Math.round(Math.random()*256)  + ','
                                + Math.round(Math.random()*256)  + ','
                                + Math.random()  + ')';
   
         // CIRCLE x, y, radius, startAngle, endAngle, anticlockwise        
         ctx.beginPath();         
         ctx.arc( Math.floor(Math.random()*120), Math.floor(Math.random()*60),
                  Math.floor(Math.random()*25),  0.0, (Math.PI * 2), true); 
         ctx.fill();// actually draws here
         }

         // TEXT  text, x , y
         ctx.fillStyle='#000';
         ctx.fillText("canvas by random", 60, 98);
       }
}

