///////////////////////////////////////////////////////
// Cowglow Co.
// Shared Functions (script.cowglow.com)
// Philip Saa (psaa@cowglow.com)
// March 15, 2009
///////////////////////////////////////////////////////

var iImageCount = 2;
var iIndex = 0;
var gizmo;

function LoadBgImage(){
	if (document.body){
		iIndex = Math.floor(Math.random()*iImageCount);
		document.body.background = "/assets/scg_background-" + iIndex + ".gif"
	}
}

function EnableDownload(){
    if (document.oForm.aMixList.selectedIndex >= 1){
        document.oForm.bDownload.style.display = '';
    } else {
        document.oForm.bDownload.style.display = 'none';
    }
}

function DownloadMix(){
    var iIndex = document.oForm.aMixList.selectedIndex;
    var sUrl = "scg_content-download.php?filename=" + document.oForm.aMixList.options[iIndex].value;
    window.open(sUrl, 'download'); return false;
}

function stopClock(){
  clearTimeout(gizmo);
}
 
function InitClock(){
  var nd = new Date();
  var h, m;
  var s;
  var time = " ";
  h = nd.getHours();
  m = nd.getMinutes();
  s = nd.getSeconds();
  if (h <= 9) h = "0" + h;
  if (m <= 9) m = "0" + m;
  if (s <= 9) s = "0" + s;
  time += h + ":" + m + ":" + s; 
  document.the_clock.the_time.value = time;
  gizmo = setTimeout("InitClock()", 1000);
}