var DefaultEmailText = "Email address";
var DefaultCommentsText = "Message";

window.addEvent("domready", function(){

	// add events to the mail form
	var mailButton = $("mailButton");
	var mailForm = $("mailForm");
	var emailField = $("email");
	var commentsField = $("comments");
	if (mailForm)
	{
		mailButton.addEvent("click", function(event) {
			event.stop();
			// check the values of the data
			if (emailField && emailField.value == DefaultEmailText)
			{
				emailField.value = "";
			}
			if (commentsField && commentsField.value == DefaultCommentsText)
			{
				commentsField.value = "";
			}
			mailForm.submit();
		});
	}

	if (emailField)
	{
		emailField.addEvent("focus", function() {
			if (emailField.value == DefaultEmailText)
			{
				emailField.value = "";
			}
		});
		emailField.addEvent("blur", function() {
			if (emailField.value == "")
			{
				emailField.value = DefaultEmailText;
			}
		});
	}

	if (commentsField)
	{
		commentsField.addEvent("focus", function() {
			if (commentsField.value == DefaultCommentsText)
			{
				commentsField.value = "";
			}
		});
		commentsField.addEvent("blur", function() {
			if (commentsField.value == "")
			{
				commentsField.value = DefaultCommentsText;
			}
		});
	}

});