/* (C) 2006 Lovell Fuller */

function changeYearMonth(yearMonthForm)
{
	var yearMonth = yearMonthForm.yearMonth.options[yearMonthForm.yearMonth.selectedIndex].value;
	document.location.href = "/live/" + yearMonth;
}

function validateLive()
{
	if (isws(document.live.startDate.value))
	{
		alert("Please enter the date in the space provided.");
		document.live.startDate.focus();
		return false;
	}
	// TODO: validate that startDate is a valid date
	if (isws(document.live.startTime.value))
	{
		alert("Please enter the starting time in the space provided.");
		document.live.startTime.focus();
		return false;
	}
	if (isws(document.live.venueName.value))
	{
		alert("Please enter the name of the venue in the space provided.");
		document.live.venueName.focus();
		return false;
	}
	if (isws(document.live.venueLocation.value))
	{
		alert("Please enter the location of the venue in the space provided.");
		document.live.venueLocation.focus();
		return false;
	}
	if (!isws(document.live.ticketUrl.value) && (document.live.ticketUrl.value.indexOf('http') != 0))
	{
		alert("Please enter a valid URL (starting with either 'http://' or 'https://') in the space provided.");
		document.live.ticketUrl.focus();
		return false;
	}
	return true;
}

function onSubmitLiveDelete(where, when)
{
	if (confirm("Are you sure you want to remove details of the live event at " + where + " on " + when + "?"))
	{
		return true;
	}
	return false;
}

function validateLiveReview()
{
	if (isws(document.live.author.value))
	{
		alert("Please enter the author of the review in the space provided.");
		document.live.author.focus();
		return false;
	}
	if (isws(document.live.source.value))
	{
		alert("Please enter the source of the review in the space provided.");
		document.live.source.focus();
		return false;
	}
	return true;
}

