var height = 256;
var angle1 = 0;
var angle2 = 0;

function drawCopper() {
  var a1 = angle1;
  var a2 = angle2;
  for (var i = 0; i < height; i++) {
    var e = document.getElementById("copper-" + i);
    var y = 128 + 63 * Math.sin(a1) + 63 * Math.sin(a2);
    e.style.backgroundPosition = "0px " + y + "px";
    a1 += 0.0175;
    a2 += 0.0375;
  }
  angle1 += 0.085;
  angle2 -= 0.105;
}

function initializeCopper() {
  document.write('<style type="text/css">');
  document.write('div.copper {');
  document.write('position: absolute;');
  document.write('left: 1px;');
  document.write('top: 1px;');
  document.write('width: 256px;');
  document.write('height: 1px;');
  document.write('background-image: url("img/copper.png");');
  document.write('z-index: 3;');
  document.write('}');
  document.write('</style>');
  for (var y = 0; y < height; y++) {
    document.write("<div id=\"copper-" + y +"\" class=\"copper\"></div>");
    var e = document.getElementById("copper-" + y);
    e.style.top = (1 + y) + "px";
  }
}

randomInitializeFunctions.push(initializeCopper);
randomDrawFunctions.push(drawCopper);
