function clearText(thefield)
{
	if (thefield.defaultValue == thefield.value) 
		thefield.value = "";
} 

function replaceText(thefield)
{
	if (thefield.value == "") 
		thefield.value = thefield.defaultValue;
}

function ValidateDataSmallx(theForm)
{
	if (theForm.sContactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.txtSName.value == "") || (theForm.txtSName.value.toLowerCase() == 'name'))
	{
		alert('Please, enter your name.');
		theForm.txtSName.focus();
		return false;
	}
	
	if ((theForm.txtSEmail.value == "") || (theForm.txtSEmail.value.toLowerCase() == 'email'))
	{
		alert('Please, enter your email.');
		theForm.txtSEmail.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.txtSEmail.value))
		{
			alert("Please check the emails address");
			theForm.txtSEmail.focus();
			return false;
		}
	}
		
	if ((theForm.txtSComments.value == "") || (theForm.txtSComments.value.toLowerCase() == 'comments') || (theForm.txtSComments.value.toLowerCase() == 'comment'))
	{
		alert('Please, enter your comments.');
		theForm.txtSComments.focus();
		return false;
	}
}

function ValidateData(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	var element = document.getElementById('txtName');
	if (element.value == "")
	{
		alert('Please, enter your name.');
		element.focus();
		return false;
	}
	element = document.getElementById('txtAddress');
	if (element.value == "")
	{
		alert('Please, enter your address.');
		element.focus();
		return false;
	}
	element = document.getElementById('txtCity');
	if (element.value == "")
	{
		alert('Please, enter your city.');
		element.focus();
		return false;
	}
	element = document.getElementById('ddlState');
	if (element.value == "")
	{
		alert('Please, select your state.');
		element.focus();
		return false;
	}
	element = document.getElementById('txtZipCode');
	if (element.value == "")
	{
		alert('Please, enter your zip Code.');
		element.focus();
		return false;
	}
	else
	{
		if (element.value.length < 5)
		{
			alert("Please enter at most 5 characters in the zip field.");
			element.focus();
			return false;
		}
		else
		{
			if(isNaN(element.value))
			{
				alert("Please enter only numerical digits in the zip field.");
				element.focus();
				return false;	    
			}
		}
	}
	element = document.getElementById('txtPhone');
	if (element.value == "")
	{
		alert('Please, enter your phone.');
		element.focus();
		return false;
	}
	element = document.getElementById('txtEmail');
	if (element.value == "")
	{
		alert('Please, enter your email.');
		element.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(element.value))
		{
			alert("Please check the emails address");
			element.focus();
			return false;
		}
	}
	if (theForm.ddlAboutUs.selectedIndex < 0)
	{
		alert("Please select 'How did you hear about us?' option.");
		theForm.AboutUs.focus();
		return false;
	}
	if (theForm.ddlAboutUs.selectedIndex == 0)
	{
		alert("The first 'How did you hear about us?' option is not a valid selection. Please choose one of the other options.");
		theForm.ddlAboutUs.focus();
		return false;
	}
	element = document.getElementById('txtComments');
	if (element.value == "")
	{
		alert('Please, enter your comments.');
		element.focus();
		return false;
	}	
	return true;
}

function ValidateEmail(valor) 
{    
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]{2,60}(\.[a-zA-Z]{2,4}){1,2}$/;  
    return emailPattern.test(valor); 
}

