function show_hide_summary(id)
{
  var img = document.getElementById(id+'img');

  if (img.alt == "Expand") {
    img.src = "http://www.darcyburner.com/themes/cp_global_images/collapse.gif";
    img.alt = "Collapse";
    img.title= "Hide Summary";
    if (window.navigator.appName == "Microsoft Internet Explorer")
      document.getElementById(id+'summary').style.display = "block";
    else
      document.getElementById(id+'summary').style.display = "table-cell";
  }
  else {
    img.src = "http://www.darcyburner.com/themes/cp_global_images/expand.gif";
    img.alt = "Expand";
    img.title= "Show Summary";
    document.getElementById(id+'summary').style.display = "none";
  }
}

function show_note(h1_margin_left)
{
  var startTime = new Date();
  var timeSet   = 2800;
  var timeDelay = 6000;
  var timeInc1  = 100;
  var timeInc2  = 250;
  var iter = 16;
  var end  = iter + 1;
  var base = [245, 240, 228];
  var difColorValues =
  [ [ (73-base[0]),  (29-base[1]),   (3-base[2])],
    [(255-base[0]), (255-base[1]), (255-base[2])],
    [(255-base[0]), (255-base[1]), (255-base[2])],
    [(216-base[0]), (201-base[1]), (185-base[2])],
    [(229-base[0]), (212-base[1]), (193-base[2])],
    [(234-base[0]), (225-base[1]), (209-base[2])],
    [(237-base[0]), (231-base[1]), (218-base[2])],
    [(243-base[0]), (237-base[1]), (224-base[2])]];

  for (var i = 0, j = 18, t = timeSet; i < 17; i++, j++, t += timeInc1)
    setTimeout("document.getElementById('noteH1Above').style.margin = '5px 0 "+j+"px "+h1_margin_left+"px'", (t+Number(startTime-(new Date()))));

  setTimeout("setup("+h1_margin_left+")", (t+Number(startTime-(new Date()))));

  for (i = 1, t += timeInc2; i < end; i++, t += timeInc2) {
    var mult = 1 - Math.sqrt(1 - (i * i) / (iter * iter));
    setTimeout("document.getElementById('noteText').style.color = 'rgb("+
      Math.round(base[0] + mult * difColorValues[0][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[0][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[0][2]).toString()+")';"+
    "document.getElementById('noteText').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[1][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[1][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[1][2]).toString()+")';"+
    "document.getElementById('border1').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[2][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[2][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[2][2]).toString()+")';"+
    "document.getElementById('border1').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[3][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[3][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[3][2]).toString()+")';"+
    "document.getElementById('border2').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[4][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[4][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[4][2]).toString()+")';"+
    "document.getElementById('border2').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[5][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[5][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[5][2]).toString()+")';"+
    "document.getElementById('border3').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[6][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[6][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[6][2]).toString()+")';"+
    "document.getElementById('border3').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[7][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[7][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[7][2]).toString()+")';", (t+Number(startTime-(new Date()))));
  }

  for (i = iter, t += timeDelay; i; i--, t += timeInc2) {
    var mult = 1 - Math.sqrt(1 - (i * i) / (iter * iter));
    setTimeout("document.getElementById('noteText').style.color = 'rgb("+
      Math.round(base[0] + mult * difColorValues[0][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[0][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[0][2]).toString()+")';"+
    "document.getElementById('noteText').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[1][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[1][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[1][2]).toString()+")';"+
    "document.getElementById('border1').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[2][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[2][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[2][2]).toString()+")';"+
    "document.getElementById('border1').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[3][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[3][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[3][2]).toString()+")';"+
    "document.getElementById('border2').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[4][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[4][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[4][2]).toString()+")';"+
    "document.getElementById('border2').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[5][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[5][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[5][2]).toString()+")';"+
    "document.getElementById('border3').style.background = 'rgb("+
      Math.round(base[0] + mult * difColorValues[6][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[6][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[6][2]).toString()+")';"+
    "document.getElementById('border3').style.border = '1px solid rgb("+
      Math.round(base[0] + mult * difColorValues[7][0]).toString()+", "+
      Math.round(base[1] + mult * difColorValues[7][1]).toString()+", "+
      Math.round(base[2] + mult * difColorValues[7][2]).toString()+")';", (t+Number(startTime-(new Date()))));
  }

  setTimeout("cleanup("+h1_margin_left+")", (t+Number(startTime-(new Date()))));

  for (i = 0, j = 34, t += timeInc1; i < 17; i++, j--, t += timeInc1)
    setTimeout("document.getElementById('noteH1Above').style.margin = '5px 0 "+j+"px "+h1_margin_left+"px'", (t+Number(startTime-(new Date()))));
}

function setup(h1_margin_left)
{
  document.getElementById('noteH1Above').style.margin = '5px 0 0 '+h1_margin_left+'px';
  document.getElementById('border4').style.display = 'block';
}

function cleanup(h1_margin_left)
{
  document.getElementById('border4').style.display = 'none';
  document.getElementById('noteH1Above').style.margin = '5px 0 34px '+h1_margin_left+'px';
}