/**
 * Set up the javascript handlers once the page finishes loading
 */
window.onload = function() {
	document.getElementById('agree_btn').onclick = replace_form;
	document.getElementById('login_btn').onclick = valid_login;
}

/**
 * Replace the agreement form when the user clicks 'I agree'
 */
function replace_form() {
	window.open('mckinley.cookie.php', '', 'directories=no,height=100,location=no,menubar=no,resizable=no,status=no,width=100,toolbar=100', false);
	document.getElementById('terms_and_conditions').style.display = 'none';
	document.getElementById('login_form').style.display = 'block';
	return false;
}


/**
 * Make sure that the user entered a password
 */
function valid_login() {
	if (('' != document.getElementById('username').value) && ('' != document.getElementById('password').value)) {
		if (-1 == document.getElementById('username').value.indexOf('@')) {
			document.getElementById('username').value = document.getElementById('username').value + '@airimba.com';
		}
	}
	else {
		alert('You must enter your username and password');
		return false;
	} 
}

