$(function() {
	
   $("#tbl1 tbody tr[class!=no-highlight]").hover( 
     function() {  // mouseover 
          $(this).addClass('highlight'); 
     }, 
     function() {  // mouseout 
          $(this).removeClass('highlight'); 
     } 
   );
   
	$("a.event").each( function(n) {
		
		$(this)
			.mouseover( function() {
		
				return showEventDetails(n);
			})
			.mouseout( function() {
			
				return nd();	
			});
	});
});

function viewEvent(a)
{
	window.open(a.href, "_blank", "width=600,height=550,scrollbars=yes,resizable=yes,status=yes");
	
	return false;
}

function showEventDetails(n) //cEvent_Name, cTime_Period, cLocation, cInstructor)
{
	//div.style.cursor="pointer";

	var cHtml = "<table border=\"0\" cellpadding=\"2\">" +
				"<tr><td align=\"right\"><b>Activity:</b></td><td>" + aEvent[n][0] + "</td></tr>" +
				"<tr><td align=\"right\"><b>Time:</b></td><td>" 	+ aEvent[n][1] + "</td></tr>" +
				"<tr><td align=\"right\"><b>Location:</b></td><td>" 	+ aEvent[n][2] + "</td></tr>" +
				"<tr><td align=\"right\"><b>Staff:</b></td><td>" 	+ aEvent[n][3] + "</td></tr>" +
				"</table>" +
				"<br />Click for more details.";

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

function hideClassDetails(div)
{
	//div.style.cursor="default";

	return nd();
}

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();
}
