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

function ValidateNewsletter(theForm)
{
	if (theForm.EmailAddress.value == "")
	{
		alert('Please, enter your email.');
		theForm.EmailAddress.focus();
		return (false);
	}
	else
	{
		if(!ValidateEmail(theForm.EmailAddress.value))
		{
			alert("Please check the emails address");
			theForm.EmailAddress.focus();
			return false;
		}
	}
	return (true);
}

function ValidateSmallData(theForm)
{

	if (theForm.contactDate.value != "")
	{
		//alert('Test');		
		return (false);
	}
	
	if (theForm.Name.value == "")
	{
		alert('Please, enter your first name.');
		theForm.Name.focus();
		return (false);
	}

	if (theForm.Email.value == "")
	{
		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 (theForm.Comments.value == "")
	{
		alert('Please, enter your comments.');
		theForm.Comments.focus();
		return (false);
	}
	
	return (true);
}

function ValidateData(theForm)
{
	if (theForm.contactDate.value != "")
	{
		//alert('Test');		
		return (false);
	}

	if (theForm.Name.value == "")
	{
		alert('Please, enter your first name.');
		theForm.Name.focus();
		return (false);
	}
	
	/*if (theForm.Address.value == "")
	{
		alert('Please, enter your address.');
		theForm.Address.focus();
		return (false);
	}

	if (theForm.City.value == "")
	{
		alert('Please, enter your city.');
		theForm.City.focus();
		return (false);
	}

	if (theForm.State.value == "")
	{
		alert('Please, enter your state.');
		theForm.State.focus();
		return (false);
	}

	if (theForm.ZipCode.value == "")
	{
		alert('Please, enter your zip code.');
		theForm.ZipCode.focus();
		return (false);
	}
		
	if (theForm.Phone.value == "")
	{
		alert('Please, enter your phone.');
		theForm.Phone.focus();
		return (false);
	}*/

	if (theForm.Email.value == "")
	{
		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 (theForm.Comments.value == "")
	{
		alert('Please, enter your comments.');
		theForm.Comments.focus();
		return (false);
	}
	
	return (true);
}

function CheckValues(theForm)
{
	if (theForm.BlemishScar.checked)
	{
		theForm.BlemishScar.value = 'true';
	}
	else
	{
		theForm.BlemishScar.value = 'false';
	}
	
	if (theForm.Blepharoplasty.checked)
	{		
		theForm.Blepharoplasty.value = 'true';
	}
	else
	{
		theForm.Blepharoplasty.value = 'false';
	}
	
	if (theForm.Botox.checked)
	{
		theForm.Botox.value = 'true';
	}
	else
	{
		theForm.Botox.value = 'false';
	}
	
	if (theForm.Browlift.checked)
	{
		theForm.Browlift.value = 'true';
	}
	else
	{
		theForm.Browlift.value = 'false';
	}	
	
	if (theForm.CheekImplants.checked)
	{
		theForm.CheekImplants.value = 'true';
	}
	else
	{
		theForm.CheekImplants.value = 'false';
	}
	
	if (theForm.CheekLift.checked)
	{
		theForm.CheekLift.value = 'true';
	}
	else
	{
		theForm.CheekLift.value = 'false';
	}
	
	if (theForm.ChinImplant.checked)
	{
		theForm.ChinImplant.value = 'true';
	}
	else
	{
		theForm.ChinImplant.value = 'false';
	}
	
	if (theForm.Dermabrasion.checked)
	{		
		theForm.Dermabrasion.value = 'true';
	}
	else
	{
		theForm.Dermabrasion.value = 'false';
	}
	
	if (theForm.Facelift.checked)
	{
		theForm.Facelift.value = 'true';
	}
	else
	{
		theForm.Facelift.value = 'true';
	}
	
	if (theForm.FacialLiposuction.checked)
	{
		theForm.FacialLiposuction.value = 'true';
	}
	else
	{
		theForm.FacialLiposuction.value = 'false';
	}
	
	if (theForm.HairTransplantation.checked)
	{
		theForm.HairTransplantation.value = 'true';
	}
	else
	{
		theForm.HairTransplantation.value = 'false';
	}
	
	if (theForm.LaserHairRemoval.checked)
	{
		theForm.LaserHairRemoval.value = 'true';
	}	
	else
	{
		theForm.LaserHairRemoval.value = 'false';
	}
		
	if (theForm.LaserSkinResurfacing.checked)
	{
		theForm.LaserSkinResurfacing.value = 'true';
	}
	else
	{
		theForm.LaserSkinResurfacing.value = 'false';
	}
		
	if (theForm.LipAugmentation.checked)
	{
		theForm.LipAugmentation.value = 'true';
	}
	else
	{
		theForm.LipAugmentation.value = 'false';
	}
	
	if (theForm.NeckLiposuction.checked)
	{
		theForm.NeckLiposuction.value = 'true';
	}
	else
	{
		theForm.NeckLiposuction.value = 'false';
	}	
	
	if (theForm.Otoplasty.checked)
	{
		theForm.Otoplasty.value = 'true';
	}
	else
	{
		theForm.Otoplasty.value = 'false';
	}
	
	if (theForm.Rhinoplasty.checked)
	{
		theForm.Rhinoplasty.value = 'true';
	}
	else
	{
		theForm.Rhinoplasty.value = 'false';
	}
	
	if (theForm.TatooRemoval.checked)
	{
		theForm.TatooRemoval.value = 'true';
	}
	else
	{
		theForm.TatooRemoval.value = 'false';
	}
	
	if (theForm.Thermage.checked)
	{
		theForm.Thermage.value = 'true';
	}
	else
	{
		theForm.Thermage.value = 'false';
	}
	
	if (theForm.WrinkleFillers.checked)
	{
		theForm.WrinkleFillers.value = 'true';
	}
	else
	{
		theForm.WrinkleFillers.value = 'false';
	}
}


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

function GetResults()
{
	
	if (escape(document.getElementById('Search').value) != "" ){
		var cad = "http://www.painassociates.com/SearchResults.aspx?text=" + escape(document.getElementById('Search').value);
		document.location = cad;
	}
	
}

function MethodEnter(event)
{
	//alert(event.keyCode);
	try{
		if (event.keyCode == 13 && escape(document.getElementById('Search').value) != "" ) 
		{
			//alert(event.keyCode);
			GetResults();
		}	
		if (event.keyCode == 13){
			event.returnvalue=false;
			event.cancel =true;	
			event.keyCode =0;
		}
	}
	catch(e){
		event.preventDefault();
	}
	
}
