
function $(v) { return(document.getElementById(v)); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function xy(e,v) { return(v?(agent('msie')?event.clientY+document.body.scrollTop:e.pageY):(agent('msie')?event.clientX+document.body.scrollTop:e.pageX)); }

function addEvent(d)
{
	window.open("EditEvent.php?event_date="+d, "_blank", "width=500,height=500,scrollbars=yes,resizable=yes,status=yes");
}

function viewEvent(id)
{
	window.open("ViewEvent.php?event_id="+id, "_blank", "width=500,height=500,scrollbars=yes,resizable=yes,status=yes");
}

function showClassDetails(div, cClass, cTime_Period, cLocation, cInstructor)
{
	div.style.cursor="pointer";
	//div.style.backgroundColor='#ccddee';

	var cHtml = "<table border=\"0\" cellpadding=\"3\">" +
				"<tr><td><b>Class:</b></td><td>" + cClass + "</td></tr>" +
				"<tr><td><b>Time:</b></td><td>" + cTime_Period + "</td></tr>" +
				"<tr><td><b>Locale:</b></td><td>" + cLocation+ "</td></tr>" +
				"<tr><td><b>Instr:</b></td><td>" + cInstructor+ "</td></tr>" +
				"</table>" +
				"<br />Click for more details.";

	//return overlib(cHtml, CAPTION, "Class Details", OFFSETX, -140, OFFSETY, -220, WIDTH, 250);
	return overlib(cHtml, CAPTION, "Class Details", WIDTH, 300);
}

function hideClassDetails(div)
{
	div.style.cursor="default";
	//div.style.backgroundColor='#aabbcc';

	return nd();
}

function editLegend()
{
	try
	{
		var win = window.open("EditNews.php?key=schedule-legend", "_blank", "width=750,height=500,scrollbars=no,resizable=yes,status=yes");
		win.focus();
	}
	catch (ex)
	{
		alert(ex);
	}
}

function previousMonth()
{
	if (document.form1.month.value == "1")
	{
		document.form1.month.value = "12";
		document.form1.year.value = "" + (parseInt(document.form1.year.value) - 1);
		document.form1.submit();
	}
	else
	{
		document.form1.month.value = "" + (parseInt(document.form1.month.value) - 1);
		document.form1.submit();
	}
}

function nextMonth()
{
	if (document.form1.month.value == "12")
	{
		document.form1.month.value = "1";
		document.form1.year.value = "" + (parseInt(document.form1.year.value) + 1);
		document.form1.submit();
	}
	else
	{
		document.form1.month.value = "" + (parseInt(document.form1.month.value) + 1);
		document.form1.submit();
	}
}

function printAttendanceSheets()
{
	var win = window.open("PrintMonthlyAttendanceSheet.php?month=" + document.form1.month.value + "&year=" + document.form1.year.value, "_blank");
	win.focus();
}