function StartTimer(seconds) {
	timer = seconds+1;
	window.setTimeout("UpdateTimer()", 1000);
}

function UpdateTimer() {
	var min;
	var sec;
	timer--;
	if (timer > 0) {
		min = Math.floor(timer/60);
		sec = timer%60;
		if (min < 10)
			min = "0" + min;
		if (sec < 10)
			sec = "0" + sec;
		document.getElementById("theTime").innerHTML = "Time remaining : " + min + ":" + sec;
		document.getElementById("theTime").style.visibility="visible";
		window.setTimeout("UpdateTimer()", 1000);
	} else {
		var query = location.search;
			
		if (location.href.indexOf("EnrolmentID") != -1)  //course exams have an enrolmentID in the querystring
		    location.href = "doExam.aspx?EnrolmentID=" + query.substring(query.indexOf("EnrolmentID=") + 12, query.length) + "&a=g";
		else
		    location.href = "cecdoexam.aspx?a=g&ExamID=" + query.substring(query.indexOf("ExamID=") + 7, query.length);;
	}
}

