function mailTo(email) {
	email = email.replace(/#/,"@");
	document.location="mailto:" + email;
}

function ajaxPost(url,element,vars){
	var myAjax = new Ajax.Updater(element, url, {
		method: 'post', 
		postBody: vars, 
		evalScripts: true
		});
}

function userLogin(target) {
	var missing = false;
	if($('loginemail').value == '') {
		$('lemaillabel').style.color = 'red';
		missing = true;
	} else $('lemaillabel').style.color = 'black';
	if($('loginpw').value == '') {
		$('lpwlabel').style.color = 'red';
		missing = true;
	} else $('lpwlabel').style.color = 'black';
	
	if(!missing) $('loginform').submit();}

function submitRegistration() {
	var missing = false;
	if($('regemail').value == '') {
		$('emaillabel').style.color = 'red';
		missing = true;
	} else $('emaillabel').style.color = 'black';
	if($('regpw').value == '') {
		$('pwlabel').style.color = 'red';
		missing = true;
	} else $('pwlabel').style.color = 'black';
	if($('regpw2').value == '') {
		$('pw2label').style.color = 'red';
		missing = true;
	} else $('pw2label').style.color = 'black';
	if($('regfname').value == '') {
		$('fnamelabel').style.color = 'red';
		missing = true;
	} else $('fnamelabel').style.color = 'black';
	if($('reglname').value == '') {
		$('lnamelabel').style.color = 'red';
		missing = true;
	} else $('lnamelabel').style.color = 'black';
	
	if(missing) $('REGERRORMSG').innerHTML = 'All fields are required!';
	else {
		if($('regpw').value != $('regpw2').value || $('regpw').value == '') $('REGERRORMSG').innerHTML = 'Passwords do not match!';
		else $('registerform').submit();
	}
}

function setRegion(region,go) {
	document.cookie = 'REGION=' + region + '; path=/';
	if(go) document.location = 'calendar.html';
}
