function addAlternate (id, state, href) {
  var img;
  if (document.getElementById 
    && (img = document.getElementById(id))) {
    if (!img.alternates) img.alternates = new Object();
    if (!img.alternates.link) {
      img.alternates.link = new Image(img.width, img.height);
      img.alternates.link.src = img.src;
    }
    var s = new Image();
    s.src = href;
    img.alternates[state.toString()] = s;
  }
}


function OMO (link, state) {
  if (link.getElementsByTagName) {
    var imgs = link.getElementsByTagName('img');
    for (var i = 0; i < imgs.length; i++) {
      var h = imgs[i];
      var s = state.toString();
      if (h.alternates && h.alternates[s]) 
        h.src = h.alternates[s].src;
    }
  }
}

function openwin (url, x, y) {
  window.open(url, 'artwork', 'toolbar=no,locationbar=no,status=no,directories=no,personalbar=no,width=' + x + ',height=' + y);
}

var INCR = 0;
TEXTLAYERS = new Array();

function cycleText (i) {
  var max = TEXTLAYERS.length;
  if (document.getElementById && max) {
    INCR += i;
    for (var j = 0; j < max; j++) {
      if (Math.abs(INCR % max) == j) {
        if (document.getElementById(TEXTLAYERS[j])) {
          document.getElementById(TEXTLAYERS[j]).style.visibility = 'visible';
        }
      }
      else {
        if (document.getElementById(TEXTLAYERS[j]))
          document.getElementById(TEXTLAYERS[j]).style.visibility = 'hidden';
      }
    }
  }
}
