function checkform1()
{
	if (!/^(\w+\.)*(\w+)@(\w+\.)+(\w+)$/.test(form1.Email.value))
	{
		alert("Invalid E-mail Address! Please re-enter.");
		return false;
	}

	return true;
}

function checkform2()
{
	if (!document.form2.name.value)
	{
		// something is wrong
		alert('There is a problem with the Name field');
		return false;
	}
	else if (!document.form2.daytime.value)
	{
		// something else is wrong
		alert('There is a problem with the Daytime Phone field');
		return false;
	}
	else if (!/^(\w+\.)*(\w+)@(\w+\.)+(\w+)$/.test(form2.email.value))
	{
		alert("Invalid E-mail Address! Please re-enter.");
		return false;
	}

	return true;
}

function checkform3()
{
	if (!document.form3.TName.value)
	{
		// something is wrong
		alert('There is a problem with the Name field');
		return false;
	}
	else if (!/^(\w+\.)*(\w+)@(\w+\.)+(\w+)$/.test(form3.email.value))
	{
		alert("Invalid E-mail Address! Please re-enter.");
		return false;
	}
	else if (!document.form3.textarea.value)
	{
		// something else is wrong
		alert('There is a problem with the Question field');
		return false;
	}

	return true;
}

function emailPage() {
	var messageText = 'Hello, I found a great web page at ' + window.location;
	var email = prompt("Enter your friend's email address:", '');
	if(!email) return false;

	if (!/^(\w+\.)*(\w+)@(\w+\.)+(\w+)$/.test(email)) {
		alert("Invalid E-mail Address! Please re-enter.");
		emailPage();
	} else {
		window.location = 'index.html?email='+email+
		'&refer=' + encodeURIComponent(messageText);
	}
}

function fourdigits(number) {
	return (number < 1000) ? number + 1900 : number;
}

var timeStr, dateStr;

function clock() {
	now= new Date();

	// time 
	hours= now.getHours();
	minutes= now.getMinutes();
	seconds= now.getSeconds();
	timeStr= "" + hours;
	timeStr+= ((minutes < 10) ? ":0" : ":") + minutes;
	timeStr+= ((seconds < 10) ? ":0" : ":") + seconds;

	var days = new Array(
	'Sunday','Monday','Tuesday',
	'Wednesday','Thursday','Friday','Saturday');
	var months = new Array(
	'January','February','March','April','May',
	'June','July','August','September','October',
	'November','December');
	var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
	today =  days[now.getDay()] + ", " +
	months[now.getMonth()] + " " +
	date + ", " +
	(fourdigits(now.getYear())) + ", " + timeStr;
	document.clock.today.value = today;

	Timer= setTimeout("clock()",1000);
}

