/* var showContactFormTimeout = 0; */

function showContactForm()
{
	var showcontactlink = document.getElementById("showcontactlink");
	showcontactlink.style.visibility = "hidden";
	showcontactlink.style.height = "0px";
	showcontactlink.style.paddingTop = "0px";
	
	var contactdynamicarea = document.getElementById("contactdynamicarea");
	contactdynamicarea.style.visibility = "visible";
	contactdynamicarea.style.height = "auto";
	contactdynamicarea.style.marginTop = "10px";
	contactdynamicarea.style.paddingTop = "16px";
	contactdynamicarea.style.paddingBottom = "20px";
	contactdynamicarea.style.opacity = "1";
	var contactrecipient = document.getElementById("contactrecipient");
	contactrecipient.focus();
	
	/* prevent clicked anchor that called this from actually being followed */
	return false;
}

function hideContactForm()
{
	var showcontactlink = document.getElementById("showcontactlink");
	showcontactlink.style.visibility = "visible";
	showcontactlink.style.height = "auto";
	showcontactlink.style.paddingTop = "10px";
	
	var contactdynamicarea = document.getElementById("contactdynamicarea");
	contactdynamicarea.style.visibility = "hidden";
	contactdynamicarea.style.height = "0px";
	contactdynamicarea.style.marginTop = "0px";
	contactdynamicarea.style.paddingTop = "0px";
	contactdynamicarea.style.paddingBottom = "0px";
	contactdynamicarea.style.opacity = "0";
		
	/* prevent clicked anchor that called this from actually being followed */
	return false;
}


function verifyContactForm( tf )
{
	var returnVal = false;
	
	if (tf.recipient.selectedIndex == 0)
	{
		alert("Please select a recipient.");
		tf.recipient.focus();
	}
	else if (tf.firstname.value == "" || (tf.firstname.value.match(/^\s+$/)))
	{
		alert("Please enter your first name.");
		tf.firstname.focus();
	}
	else if (tf.lastname.value == "" || (tf.lastname.value.match(/^\s+$/)))
	{
		alert("Please enter your last name.");
		tf.lastname.focus();
	}
	else if (tf.email.value == "")
	{
		alert("Please enter your e-mail address.");
		tf.email.focus();
	}
	else if (tf.confirmemail.value == "")
	{
		alert("Please confirm your e-mail address.");
		tf.confirmemail.focus();
	}
	else if (tf.email.value != tf.confirmemail.value)
	{
		alert("The e-mail addresses do not match.");
		tf.email.focus();
		tf.email.select();
		tf.confirmemail.value = "";
	}
	else if (tf.operatingsystem.selectedIndex == 0)
	{
		alert("Please select an operating system.");
		tf.operatingsystem.focus();
	}
	else if (tf.product.selectedIndex == 0)
	{
		alert("Please select a product.");
		tf.product.focus();
	}
	else if (tf.version.selectedIndex == 0)
	{
		alert("Please select a version.");
		tf.version.focus();
	}
	else if (tf.subject.value == "")
	{
		alert("Please enter a subject.");
		tf.subject.focus();
	}
	else if( tf.message.value == "" || tf.message.value == tf.message.defaultValue )
	{
		alert("Please enter a message.");
		tf.message.select();
	}
	else
	{
		var result = tf.email.value.match( /^.+@(.+\.\w{2,4})$/ );
		if( result == null )
		{
			alert("That e-email address does not appear to be valid.");
			tf.email.focus();
			tf.email.select();
			tf.confirmemail.value = "";
		}
		else
			returnVal = true;
	}
	
	return returnVal;
}

