var scrollStep=2;

var timerLeft="";
var timerRight="";

function toLeft(id){
  document.getElementById(id).scrollLeft=0;
}

function scrollDivLeft(id){
  clearTimeout(timerRight);
  document.getElementById(id).scrollLeft+=scrollStep;
  timerRight=setTimeout("scrollDivLeft('"+id+"')",10);
}

function scrollDivRight(id){
  clearTimeout(timerLeft);
  document.getElementById(id).scrollLeft-=scrollStep;
  timerLeft=setTimeout("scrollDivRight('"+id+"')",10);
}

function toRight(id){
  document.getElementById(id).scrollLeft=document.getElementById(id).scrollWidth;
}

function stopMe(){
  clearTimeout(timerRight);
  clearTimeout(timerLeft);
}

/*
  Script to show the title of the thumbnail sport within the Showcase slideshow on homepage.
*/
var slides = 20;

function gc_showTitle(imgAlt) {
  var title = document.getElementById("sportTitle");
  title.innerHTML = imgAlt;
}

function gc_hideTitle() {
  document.getElementById("sportTitle").innerHTML = "";
}

function gc_initShowcase() {
	if (typeof ow_AppendLoadEvent == "undefined") {

	  for (i = 1; i <= slides; i++) {
	    imgID = "gc_scImg_" + i;
	    var showcaseImg = document.getElementById(imgID);

	    showcaseImg.onmouseover = function() { gc_showTitle(this.alt); return false; }
	    showcaseImg.onmouseout = function() { gc_hideTitle(); return false; }

	  }		
	}
}

function ghp_AppendLoadEvent(f) {
  var oldonload = window.onload;
  
  if (typeof window.onload != "function") {
    window.onload = f;
  } else {
    window.onload = function() {
      oldonload();
			f();			
    }
  }
}

//ow_f_AddEvent(window, "load", function() { gc_initSlides() }, false);
//ghp_AppendLoadEvent(gc_initSlides);
ow_f_AppendLoadEvent(gc_initShowcase);