var cv = 0;
var vs = 0;
var vold = false;
var vnew = false;
var ow = 0;
var nw = 0;
var dr = 0;
var tid = false;
var bid = false;
var op = 0;
var opo = 0;
var pp = 1;

function showITip(i, t, l)
 { document.getElementById("tipMenu").style.top = t + "px";
   document.getElementById("tipMenu").style.left = l + "px";
   var x = i+'-Piece Hoop ... <a href="about_our_hoops.php">More</a>';
   document.getElementById("tipMenu").innerHTML = x;
   document.getElementById("tipMenu").style.display = "block";
   if (tDI) {window.clearTimeout(tDI);}
   tDI = window.setTimeout("hideTip()", 30000); }

function pausePlay()
{ if (pp==1) 
  { if (bid) {xid(bid); if (tid) {clearInterval(tid); tid=false;} }
    if (tid) {xid(tid);}
    pp=0; document.getElementById("pplay").innerHTML="Play"; }
  else
  { pp=1; document.getElementById("pplay").innerHTML="Pause";
    loaddisp(); bid = setInterval(loaddisp, fadelay); }
  return false; }

function cvrandom()
{ return 1 + Math.floor(Math.random()*vs); }

function doview(n)
{ if (cv != n)
  { if (tid) {xid(tid);}
    var x = 'vnew = document.getElementById("view' + n + '")'; eval(x);
    var x = 'vold = document.getElementById("view' + cv + '")'; eval(x);
	opo=100; doop(vold, opo);
	op=0; doop(vnew, op);
	vnew.style.width = "710px";
    rebutton(n);
    tid = setInterval(fadeout, faint); return false; } }

function doop(obj, o)
{ if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
  { obj.style.filter = "alpha(opacity=" + o + ")"; }
  else { obj.style.opacity = (o / 100); } }

function fadeout()
{ opo -= fastep; doop(vold, opo);
  op += fastep; doop(vnew, op);
  if (opo<5 || op >95)
  { clearInterval(tid); tid=false;
    vold.style.width = "0px";
    doop(vold, 100);
    doop(vnew, 100);
   // var x = 'document.getElementById("vbutt' + cv + '").src = "images/vbOn.gif"'; eval(x);
    } }

function dohover(n)
{ if (cv!=n) {var x = 'document.getElementById("vbutt' + n + '").src = "images/vbHover.gif"'; eval(x);} }

function drawbutts(n)
{ for (i=1; i<=n; i++)
  { var x = '<td id="vbutt' + i + '"><a href="javascript:void();" onclick="return loadview(' + i + ');">';
    x += lbs[i-1] + '</a></td>\n'; document.write(x); } }

function drawviews(n)
{ var x = "";
  for (i=1; i<=n; i++)
  { if (i==1)
    { var u='<img src="images/spacer.gif" width="710" height="306" />'; }
    else {var u=''; }
    x += '<div id="view' + i + '" onclick="jump(' + i + ');">'+u+'</div>\n'; }
  document.write(x); }

function initdisp()
{ vs = vws.length;
  cv = cvrandom();
  var x = 'vold = document.getElementById("view' + cv + '")'; eval(x);
  var x = 'vnew = document.getElementById("view' + cv + '")'; eval(x);
  for (i=1; i<=vs; i++)
  { var x = 'var ob = document.getElementById("view' + i + '")'; eval(x);
    ob.style.backgroundImage = "url(images/" + vws[i-1] + ")";
    if (i==cv) { ob.style.width = "710px"; } }
  bid = setInterval(loaddisp, fadelay);
}

function jump(n)
{ window.location = lks[n-1]; }

function jump2(n)
{ window.location = n; }

function loaddisp()
{ var x = cv + 1; dr=0;
  if (x==vs+1) {x=1;}
  return doview(x); }

function loadview(n)
{ if (cv != n)
  { if (n > cv) { dr=0; } else { dr=1; }
    var r = 0;
    if (pp==1) { clearInterval(bid); r = 1; }
    doview(n);
    if (r==1) { bid = setInterval(loaddisp, fadelay); } }
  return false; }

function rebutton(n)
{ // var x = 'document.getElementById("vbutt' + cv + '").style.borderColor = "#e2d1ee"'; eval(x);
  cv = n;
  // var x = 'document.getElementById("vbutt' + cv + '").style.borderColor = "#58168c"'; eval(x);
 }

function unhover(n)
{ if (cv!=n)
  { var x = 'document.getElementById("vbutt' + n + '").src = "images/vbOff.gif"'; eval(x); } }

function xid(o)
{ clearInterval(o); o=false;
  vold.style.width = "0px";
  doop(vold, 100);
  vnew.style.width = "710px";
  doop(vnew, 100); }
