var running = false
var endTime = null
var timerID = null

function startTimer() {
	running = true
	now = new Date()
	now = now.getTime()
	endTime = now + (1000 * 60 * 1)
	showCountDown()
}

function showCountDown() {
	var now = new Date()
	now = now.getTime()
	if (endTime - now <= 0) {
		stopTimer()
		alert("Time is up.  Put down your pencils.")
	} else {
		var delta = new Date(endTime - now)
		var theMin = delta.getMinutes()
		var theSec = delta.getSeconds()
		var theTime = theMin
		theTime += ((theSec < 10) ? ":0" : ":") + theSec
		document.forms[0].timerDisplay.value = theTime
		if (running) {
			timerID = setTimeout("showCountDown()",1000)
		}
	}
}

function stopTimer() {
	clearTimeout(timerID)
	running = false
	document.forms[0].timerDisplay.value = "0:00"
}

$(document).ready(function(){
	$(".image-list a").fadeTo(100, 0.60);
	$(".image-list a").mouseover(function(){
		$(this).fadeTo(200, 1.00);
	});
	$(".image-list a").mouseout(function(){
		$(this).fadeTo(200, 0.60);
	});
	$(".image-list a").click(function(){
		var img = $(this).find("img").attr("src");
		$(".header-image").fadeTo(200, 0.00);
		$(".header-image").empty();
		$(".header-image").prepend("<img src='"+img+"' width='890px' height='346px'>");
		$(".header-image").fadeTo(800, 1.00);
	});
	$(".social a").mouseover(function(){
		$(this).fadeTo(100, 0.60);
	});
	$(".social a").mouseout(function(){
		$(this).fadeTo(200, 1.00);
	});
});
