function VerifyCheckBox(checkBoxElement)
{
	if (checkBoxElement.checked)	checkBoxElement.value = 'true';
	else checkBoxElement.value = 'false';
}

function ValidateData(theForm)
{
	// Spam validation
	if (theForm.FillBySpam.value != "")
	{						
		return (false);
	}

	if (theForm.firstname.value == "")
	{
		alert('Please, enter your name.');
		theForm.firstname.focus();
		return (false);
	}

	if (theForm.address.value == "")
	{
		alert('Please, enter your address.');
		theForm.address.focus();
		return (false);
	}
	
	if (theForm.phone.value == "")
	{
		alert('Please, enter your phone.');
		theForm.email.focus();
		return (false);
	}
	else
	{
		if(!ValidatePhone(theForm.phone.value))
			{
				alert("Please check the Phone.");
				theForm.phone.focus();
				return false;
			}
	}

	if ((theForm.email.value == "") || (theForm.email.value == 'Email'))
	{
		alert('Please, enter your email.');
		theForm.email.focus();
		return (false);
	}
	else
	{
		if(!ValidateEmail(theForm.email.value))
		{
			alert("Please check the emails address.");
			theForm.email.focus();
			return false;
		}
	}
	
	if  ( 
			hasSpamStrings(theForm.firstname) ||
			hasSpamStrings(theForm.address) ||						
			hasSpamStrings(theForm.city) 	||
			hasSpamStrings(theForm.state) 	||
			hasSpamStrings(theForm.zip) 	||
			hasSpamStrings(theForm.issue) 	
		)
	{
		return false;
	}
	
	return (true);
}

	//  @Added : Carlos Balbuena - 24/03/2008
	//  Validate spam strings : @, http:\\
	function hasSpamStrings(textField)
	{

		var fieldValue = textField.value;
		
		if (	
				fieldValue.indexOf('@')			!=	-1 	|| 
				fieldValue.indexOf('http://')	!=	-1
			)
		{
				alert('Please, enter a valid value.');
				textField.focus();
				return true;
		}	
		else
		{
				return false;
		}

	}
	

function ValidateEmail(valor) 
{
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor))
		return true;
	else
		return false;
}

function ValidatePhone(incoming)
{
	var ValidChars = "0123456789.()- ";
	var IsCorrect=true;
	var Char;

	for (cont = 0; cont < incoming.length && IsCorrect == true; cont++) 
	{ 
		Char = incoming.charAt(cont); 
		if (ValidChars.indexOf(Char) == -1) 
			return false;
	}
	return true;
}