/*********************************************************************************
handle scrolling iframe
*********************************************************************************/
/*************************************************************************
  This code is from Dynamic Web Coding at http://www.dyn-web.com/
  See Terms of Use at http://www.dyn-web.com/bus/terms.html
  regarding conditions under which you may use this code.
  This notice must be retained in the code as is!
*************************************************************************/

var timer_id;
function scroll_iframe(frm,inc,dir) {
  if (timer_id) clearTimeout(timer_id);
  if (window.frames[frm]) {
    if (dir == "v") window.frames[frm].scrollBy(0, inc);
    else window.frames[frm].scrollBy(inc, 0);

    timer_id = setTimeout("scroll_iframe('" + frm + "'," + inc + ",'" + dir + "')", 20);
	//set_arrow_visibility(frm);
  }
}

function stopScroll() { if (timer_id) clearTimeout(timer_id); }

function getDocHeight(doc) {
  var docHt = 0, sh, oh;
  if (doc.height) docHt = doc.height;
  else if (doc.body) {
    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
    if (sh && oh) docHt = Math.max(sh, oh);
  }
  return docHt;
}

function getObj(name) {
	var obj = document.getElementById? document.getElementById(name): document.all? document.all[name]: null;
	return obj;
}

function set_visibility() {
  var frm = 'gigs';
  var iframeWin = window.frames[frm];
  var iframeEl = document.getElementById? document.getElementById(frm): document.all? document.all[frm]: null;
  iframeEl.style.visibility = 'visible';
  if ( iframeEl && iframeWin ) {
    //iframeEl.style.height = "auto"; // helps resize (for some) if new doc shorter than previous  
    var docHt = getDocHeight(iframeWin.document);
	if (docHt > 150) {
		var dArrow = getObj('downArrow');
		dArrow.style.visibility = 'visible';
		var uArrow = getObj('upArrow');
		uArrow.style.visibility = 'visible';
	} 
    // need to add to height to be sure it will all show
    //if (docHt) iframeEl.style.height = docHt + 30 + "px";
  } else alert('else');


	//thetable = window.frames[frm].document.getElementById(tracks);
	//if (true) alert("Test");

}

// Copyright 2006 Bossycat Designs http://www.bossycat.com/
// function to launch mp3 player in a pop-up window
// dir is the director containing all audio files plus
// the player.swf and player.php files
function player (songfile) { 

	dir = "audio/";
	songwin = window.open( dir + "player.php?songfile=" + songfile,"MP3_Player","width=320,height=60,resizable=no,scrollbars=no");
	return false;
	
}
