<?php include('../includes/pp-header.php'); ?>


<script type="text/javascript">
	

var today = new Date();

//returns hour (0 - 23)
var nowHours = today.getHours();

var nowMinutes = today.getMinutes();

// returns day of month (1 - 31)
var theDay = today.getDate();

// get month ( 0 - 11 )
var theMonth = today.getMonth();

// get day of week ( 0 - 6, 0 = sunday, 6 = Saturday)
var theDayOfTheWeek = today.getDay();


// set up variables
// 5:55pm
// var startTimeHour = "8";
var startTimeHour = "17";
var startTimeMinute = "55";
// 9:15pm
var endTimeHour = "21";
var endTimeMinute = "15";

// need to subtract 1 as it starts at 0
var month = 05 - 1;

var startDay = 19;

var endDay = 31;


// if it's May
if (theMonth == month)
{
	// if day between start and end
	if (theDayOfTheWeek != 6)
	{
		// if time now between start and end
		if ((nowHours > startTimeHour || (nowHours == startTimeHour && nowMinutes > startTimeMinute)) && (nowHours < endTimeHour || (nowHours == endTimeHour && nowMinutes < endTimeMinute)))
		{
			window.location.replace("contest.php");
		}
		else
		{
			document.write("Sorry, contest isn't open yet - hours.");
		}
	}
	else
	{
		document.write("Sorry, contest isn't open yet - day of week.");
	}
}
else
{
	document.write("Sorry, contest isn't open yet. - month");
}

// if (now > startTime && now < endTime)
// {
// 	window.location.replace("contest.php");
// }
// else
// {
// 	document.write("Sorry, contest isn't open yet.");
// }

</script>
<?php include('../includes/pp-footer.php'); ?>