function isEmail(string) {
	return (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}

function check() {
	if(! document.getElementById('name').value.length) {
		document.getElementById('error').style.display = "block";
		document.getElementById('error').innerHTML = "Please fill in your name.";
		document.getElementById('name').focus();
		return false;
	}
	if(! document.getElementById('email').value.length) {
		document.getElementById('error').style.display = "block";
		document.getElementById('error').innerHTML = "Please fill in your email address.";
		document.getElementById('email').focus();
		return false;
	}
	if(! isEmail(document.getElementById('email').value)) {
		document.getElementById('error').style.display = "block";
		document.getElementById('error').innerHTML = "Please fill in a valid email address.";
		document.getElementById('email').focus();
		return false;
	}
	document.getElementById('submit').disabled = false;
	return true;
}

function signup(cellId) {
	var timestamp = cellId.substr(2);

	var url = 'CalendarSignupPop.php?timestamp=' + timestamp;
	var flags = 'resizable=no, left=200, top=200, width=350, height=150';
	var pop = window.open(url, 'SignUp', flags);
	pop.location.href = url;
	// for JavaScript versions that don't supply a window opener
	// property by default we create the property ourselves.
	if (pop.opener == null) {
		pop.opener = self;
	}
}

function update(timestamp) {
	increment(timestamp);
}

function increment(timestamp) {
	window.opener.document.getElementById('td' + timestamp).className = "cell";
	var number = window.opener.document.getElementById('span' + timestamp);
	number.innerHTML = parseInt(number.innerHTML) + 1;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}