function initRollovers() {
	if (!document.getElementById) return
	
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'rollover') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_over'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);
			
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_over'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;

function getImage(vttype, opt, scurl, x, y) {
  // opt is an optional string of parameters added to the url.
  // If present, opt MUST start with a '&' and be a properly
  // formatted, URL escaped string.
  opt = opt || '';
  scurl = scurl || '';
  // x = x || 54;        // default value for width;
  // y = y || 40;        // default value for height;
  x = x || 1;        // default value for width;
  y = y || 1;        // default value for height;
  cb = new Date();
  cb = cb.getTime(); // cache buster
  durl = document.URL ;      durl = durl.replace(/&/g,'|');
  ref  = document.referrer;  ref  = ref.replace(/&/g,'|');
  document.write(
    '<img src="/image.php?' +
        'vtt=' + vttype + '&' +
        'durl=' + durl + '&' +
        'scurl=' + scurl + '&' +
        'referer=' + ref + '&' +
        'cb='  + cb  +
        opt +
        '" alt="" width="' + x +'" height="' + y + '"' + ' />'
  );
}



function showLayer2(layerName, e, content)
{
  if(document.layers){
    thisbrowser="NN4";
  }
  if(document.all){
    thisbrowser="ie"
  }
  if(!document.all && document.getElementById){
    thisbrowser="NN6";
  }

  if (document.getElementById) // Netscape 6 and IE 5+
  {
    var targetElement = document.getElementById(layerName);

    if (thisbrowser == "NN6") {
      ypos = e.pageY;
      ypos = ypos+10;
      xpos = e.pageX;

      targetElement.style.top = ypos+"px";
      targetElement.style.left = xpos+"px";
    }
    else {
      targetElement.style.top = e.clientY + document.body.scrollTop + 10;
      targetElement.style.left = e.clientX + document.body.scrollLeft;
    }

    if (content != null && content != "") {
      targetElement.innerHTML = content;
    }

    targetElement.style.visibility = 'visible';
  }
}
function hideLayer2(layerName)
{
  if (document.getElementById)
  {
    var targetElement = document.getElementById(layerName);
    targetElement.style.visibility = 'hidden';
  }
}
function toggleLayer2(layerName, e)
{
  if(document.layers){
    thisbrowser="NN4";
  }
  if(document.all){
    thisbrowser="ie"
  }
  if(!document.all && document.getElementById){
    thisbrowser="NN6";
  }

  if (document.getElementById) // Netscape 6 and IE 5+
  {
    var targetElement = document.getElementById(layerName);

    if (targetElement.style.visibility == 'visible') {
      targetElement.style.visibility = 'hidden';
    }
    else {
      if (thisbrowser == "NN6") {
        ypos = e.pageY;
        ypos = ypos + 10;
        targetElement.style.top = ypos+"px";
      }
      else {
        targetElement.style.top = e.clientY + document.body.scrollTop + 10;
      }

      targetElement.style.visibility = "visible";
    }
  }
}

