// JavaScript Document
function validateAgentsForm()
{


contactedBy_choice=false;


if(document.form2.name.value=="")
{
alert("Please enter your name.");
document.form2.name.focus();
return false;
}

if(document.form2.email.value=="" || document.form2.email.value.indexOf('.')==-1 || document.form2.email.value.indexOf('@')==-1 )
{
alert("Please enter valid email.");
document.form2.email.focus();
return false;
}


if(document.form2.city.value=="")
{
alert("Please enter your city.");
document.form2.city.focus();
return false;
}
if(document.form2.state.value=="")
{
alert("Please enter your state.");
document.form2.state.focus();
return false;
}

if(document.form2.phone.value=="")
{
alert("Please enter your phone number.");
document.form2.phone.focus();
return false;
}

for (var c=0,d=0,e; e=document.getElementById("form2").elements[d]; d++)
		if (e.type=='checkbox' && e.name.match(/^contactedBy\[\]$/) && e.checked) c++;
	if (c < 1) { alert('Please specify how would you like to be contacted by us.'); location="#contactedBy";return false;}
else
{
param="";
for (var c=0,d=0,e; e=document.getElementById("form2").elements[d]; d++)
		if (e.type=='checkbox' && e.name.match(/^contactedBy\[\]$/) && e.checked) 
		param +=", " + e.value;
//alert(param);		
document.getElementById("contactedByText").value=param;
}



}




function validate()
{
contactedBy_choice=false;
receiveInformation_choice=false;


for (var c=0,d=0,e; e=document.getElementById("form2").elements[d]; d++)
		if (e.type=='checkbox' && e.name.match(/^interestedIn\[\]$/) && e.checked) c++;
	if (c < 1) { alert('Please specify your interest.'); location="#interestedIn";return false;}
else
{
param="";
for (var c=0,d=0,e; e=document.getElementById("form2").elements[d]; d++)
		if (e.type=='checkbox' && e.name.match(/^interestedIn\[\]$/) && e.checked) 
		param +=", " + e.value;
//alert(param);		
document.getElementById("interestedInText").value=param;
}




	for(i=0;i<document.form2.contactedBy.length;i++)
{
if(document.form2.contactedBy[i].checked)
{
contactedBy_choice=true;

}

}


if(contactedBy_choice==false)
{
alert("Como você conheceu a SpeakTrips.");
location="#contactedBy";

return false;
}

	for(i=0;i<document.form2.receiveInformation.length;i++)
{
if(document.form2.receiveInformation[i].checked)
{
receiveInformation_choice=true;
}

}


if(receiveInformation_choice==false)
{
alert("Please specify if you would like to receive Information about Sales and  Programs.");
location="#receiveInformation";

return false;
}

if(document.form2.name.value=="")
{
alert("Please enter your name.");
document.form2.name.focus();
return false;
}

if(document.form2.email.value=="" || document.form2.email.value.indexOf('.')==-1 || document.form2.email.value.indexOf('@')==-1 )
{
alert("Please enter valid email.");
document.form2.email.focus();
return false;
}


if(document.form2.city.value=="")
{
alert("Please enter your city.");
document.form2.city.focus();
return false;
}
if(document.form2.state.value=="")
{
alert("Please enter your state.");
document.form2.state.focus();
return false;
}

if(document.form2.phone.value=="")
{
alert("Please enter your phone number.");
document.form2.phone.focus();
return false;
}
}
