function rollover(item)
{
	item.src = "images/" + item.id + "_On.gif";
}

function rolloff(item)
{
	item.src = "images/" + item.id + "_Off.gif";
}

// xGetElementById, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xGetElementById(e)
{
  if(typeof(e)!='string') return e;
  if(document.getElementById) e=document.getElementById(e);
  else if(document.all) e=document.all[e];
  else e=null;
  return e;
}


// xVisibility, Copyright 2003-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xVisibility(e, bShow)
{
  if(!(e=xGetElementById(e))) return null;
  if(e.style && xDef(e.style.visibility)) {
    if (xDef(bShow)) e.style.visibility = bShow ? 'visible' : 'hidden';
    return e.style.visibility;
  }
  return null;
}

// xDef, Copyright 2001-2005 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL

function xDef()
{
  for(var i=0; i<arguments.length; ++i)
  {
  	if(typeof(arguments[i])=='undefined')
  		return false;
  }
  return true;
}

function timeChange(item)
{
	var txtBox = xGetElementById(item.id + "_text");
	
	if(item.value == "other")
	{
		// xVisibility(item, false);
		xVisibility(txtBox, true);
		txtBox.focus();
	}
	else
	{
		txtBox.value = "";
		xVisibility(txtBox, false);
	}
}

function validate()
{
	var start_time = xGetElementById("start_time_text");
	var end_time = xGetElementById("end_time_text");

	if(start_time.value != "")
	{
		if(! start_time.value.match(/\d\d?:\d\d/))
		{
			alert("Invalid event start time \"" + start_time.value + "\"\nPlease use this format: 11:35");
			start_time.focus();
			return false;
		}
	}
	
	if(end_time.value != "")
	{
		if(! end_time.value.match(/\d\d?:\d\d/))
		{
			alert("Invalid event end time \"" + end_time.value + "\"\nPlease use this format: 11:35");
			end_time.focus();
			return false;
		}
	}
	
	return true;
}

function play(file, win_height, win_width)
{
	win_height=260;
	win_width=350;
	//win_height+=17;
	left = 300;
	top=200;
	if (screen) {
		leftPos = (screen.width / 2) - (win_width / 2);
		topPos = (screen.height / 2) - (win_height / 2);
	}
	window.open(file, "Preview", "top=" + topPos + ",left=" + leftPos + ",width="+win_width+",height=" + win_height + ",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0");
}