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

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

function VerifyCheckBox(checkBoxElement)
{
	if (checkBoxElement.checked)	checkBoxElement.value = 'true';
	else checkBoxElement.value = 'false';
}

function ValidateData(theForm)
{
	var element = document.getElementById('FirstName');
	if (element.value == "")
	{
		alert('Please, enter first name.');
		element.focus();
		return (false);
	}
	element = document.getElementById('LastName');
	if (element.value == "")
	{
		alert('Please, enter last name.');
		element.focus();
		return (false);
	}
	element = document.getElementById('ZipCode');
	if (element.value == "")
	{
		alert('Please, enter Zip Code.');
		element.focus();
		return (false);
	}
	element = document.getElementById('ZipCode');
	if(element.value != "")
	{
		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('Email');
	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;
		}
	}
	
	element = document.getElementById('Procedure');
	if (element.selectedIndex < 0)
	{
		alert("Please select your procedure option.");
		element.focus();
		return (false);
	}
	if (element.selectedIndex == 0)
	{
		alert("The first procedure option is not a valid selection. Please choose one of the other options.");
		element.focus();
		return (false);
	}
	/*element = document.getElementById('AboutUs');
	if (element.selectedIndex < 0)
	{
		alert("Please select 'How did you hear about us?' option.");
		element.focus();
		return (false);
	}
	
	
	if (element.selectedIndex == 0)
	{
		alert("The first 'How did you hear about us?' option is not a valid selection. Please choose one of the other options.");
		element.focus();
		return (false);
	}*/
	element = document.getElementById('Comments');
	if (element.value == "")
	{
		alert('Please, enter comments.');
		element.focus();
		return (false);
	}	
	return true;
}

function ValidateDataSmall(theForm)
{
	if (theForm.txtName.value == "" || theForm.txtName.value == "Name")
	{
		alert('Please, enter your name.');
		theForm.txtName.focus();
		return (false);
	}
	if (theForm.txtEmail.value == "" || theForm.txtEmail.value == "Email")
	{
		alert('Please, enter your email.');
		theForm.txtEmail.focus();
		return (false);
	}
	else
	{
		if(!ValidateEmail(theForm.txtEmail.value))
		{
			alert("Please check the emails address");
			theForm.txtEmail.focus();
			return false;
		}
	}			
	if (theForm.txtComments.value == "" || theForm.txtComments.value == "Comments")
	{
		alert('Please, enter your comments.');
		theForm.txtComments.focus();
		return (false);
	}
	
	return true;
}



function  ValidateOffer(theForm)
{ 
	//var theForm = document.getElementById(form);
	
	if (theForm.firstName.value == "")
	{
		alert('Please, enter your name.');
		theForm.firstName.focus();
		return (false);
	}
	
	if (theForm.lastName.value == "")
	{
		alert('Please, enter your last name.');
		theForm.lastName.focus();
		return (false);
	}
	
	if (theForm.phoneNumber.value == "")
	{
		alert('Please, enter your phone.');
		theForm.phoneNumber.focus();
		return (false);
	}
	if (theForm.emailtxt.value == "")
	{
		alert('Please, enter your email.');
		theForm.emailtxt.focus();
		return (false);
	}	
	else
	{
		if(!ValidateEmail(theForm.emailtxt.value))
		{
			alert("Please check the emails address");
			theForm.emailtxt.focus();
			return false;
		}
	}		
	
	if (theForm.secretCodeTxt.value == "")
	{
		alert('Please, enter the secret code.');
		theForm.secretCodeTxt.focus();
		return (false);
	}
	
	
	return true;
}

function reset(form)
{
	
	var theForm = document.getElementById(form);
	theForm.firstName.value = "";
	theForm.lastName.value = "";
	theForm.phoneNumber.value = "";
	theForm.email.value = "";
	theForm.secretCodeTxt.value = "";
	return false;
}
function GoToOffer()
{
	
	var text = document.getElementById('txtValue');
	if(text.value!= '')
	{
		if(ValidateEmail(text.value))
		{
			document.location.href = "http://www.accentscosmeticsurgery.com/valentine.htm?email=" + text.value ;
		}
		else
		{
			document.location.href = "http://www.accentscosmeticsurgery.com/valentine.htm?secretCode=" + text.value; 
		}
	}
}

function ValidateEmail(valor) 
{
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
     return true;
  else
     return false;
}