var course = 0;
var section = 0;
var	on = false;

function LogOff() {
  var button = document.getElementById('btnLogoff');
  button.click();
  button.click();
}

function Verify() {
	var win = document.getElementById('notice');
	
	win.style.visibility = 'visible';
	win.style.display = 'block';
	win.style.top = 200;
	win.style.left = 300;
	
	return false;
}

function Continue() {
	var btn = document.getElementById('btnCont');
	btn.click();
	btn.click();
}

function Decline() {
	var win = document.getElementById('notice');
	
	win.style.visibility = 'hidden';
	win.style.display = 'none';
}

function GetCertificate(user, course) {
  window.open('certificate.aspx?id=' + user + '&course=' + course);	
}

function TakeTest() {
  location.href = "testpage.aspx" + location.search;
}

function Verify(c, s) {
	var win = document.getElementById('notice');
	var e = window.event;
	course = c;
	section = s;
	
	win.style.visibility = 'visible';
	win.style.display = 'block';
	win.style.top = e.clientY;
	win.style.left = e.clientX;
}

function Retake() {
	document.location.href = 'section.aspx?course=' + course + '&section=' + section;
}

function Decline() {
	var win = document.getElementById('notice');
	
	win.style.visibility = 'hidden';
	win.style.display = 'none';
}

function StartScroll() {
	on = true;
	while(on)
	{
		Down();
	}
}

function StopScroll() {
	on = false;
}

function Wait() {
	var d = new Date();
	var start = d.getMilliseconds();
	var end = start + 10;
	
	while(start < end)
	{
		d = new Date();
		start = d.getMilliseconds();
	}	
}
			
function Up() {
	var temp = document.getElementById('contentLayer');
	var strTop = temp.style.top;
	var CurrentTop = parseInt(strTop.substring(0, strTop.indexOf("px")));
	
	if(CurrentTop < 0)
	{
		temp.style.top = CurrentTop + 10;
	}
}

function Down() {
	var tempContent = document.getElementById('contentLayer');
	var tempMask = document.getElementById('maskLayer');
	var strTop = tempContent.style.top;
	var CurrentTop = parseInt(strTop.substring(0, strTop.indexOf("px")));
	var diff = tempMask.offsetHeight - tempContent.offsetHeight;
	
	if(CurrentTop > diff)
	{
		tempContent.style.top = CurrentTop - 10;
	}
}
