// JavaScript Document

//contact form
function checkformC(){
	if(document.form.namecont.value.length < 3){
		alert("Please enter your name.");
		document.form.namecont.focus();
		return false;
	}
	if(document.form.mailcont.value == ""){
		alert("Please enter your email.");
		document.form.mailcont.focus();
		return false;
	}else{
		var theEmail = document.form.mailcont.value;
		var atLoc = theEmail.indexOf("@", 1);
		var dotLoc = theEmail.indexOf(".", atLoc+2);
		var len = theEmail.length;
		if(atLoc > 0 && dotLoc > 0 && len > dotLoc+2){
			
		}
		else{
			alert("Please enter the e-mail address properly.");
			document.form.mailcont.focus();
			return false;
		}
	}
	
	//select
	index = document.form.intecont.selectedIndex;
	if(index == 0 || index == 1 || index == 6){
		alert("Please select the area of your interest.");
		document.form.intecont.focus();
		return false;
	}

}

//life insurance
function checkformL(){
	if(document.form.frstlife.value == ""){
		alert("Please enter your first name.");
		document.form.frstlife.focus();
		return false;
	}
	if(document.form.lastlife.value == ""){
		alert("Please enter your last name.");
		document.form.lastlife.focus();
		return false;
	}
	
	flag = 0;
	for ( x = 0; x < 2; x++){
		if(document.form.gendlife[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please select your gender.");
		document.form.gendlife[0].focus();
		return false;		
	}
	
	index1 = document.form.bdmolife.selectedIndex;
	if(index1 == 0){
		alert("Please select the month of your DOB.");
		document.form.bdmolife.focus();
		return false;
	}
	index2 = document.form.bddalife.selectedIndex;
	if(index2 == 0){
		alert("Please select the day of your DOB.");
		document.form.bddalife.focus();
		return false;
	}
	index3 = document.form.bdyrlife.selectedIndex;
	if(index3 == 0){
		alert("Please select the year of your DOB.");
		document.form.bdyrlife.focus();
		return false;
	}
	
	if(document.form.str1life.value==""){
		alert("Please enter the street address.");	
		document.form.str1life.focus();
		return false;
	}
	if(document.form.citylife.value==""){
		alert("Please enter the city.");	
		document.form.citylife.focus();
		return false;
	}
	
	state = document.form.statlife.selectedIndex;
	if(state == ""){
		alert("Please select the state where you live.");
		document.form.statlife.focus();
		return false;
	}
	
	if(document.form.zipplife.value.length < 5){
		alert("Please enter the correct zip code.");
		document.form.zipplife.focus();
		return false;
	}
	
	flag = 0
	for ( x = 0, n = document.form.tabalife.length; x < n; x++){
		if(document.form.tabalife[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Do you use Tabacco? ");
		document.form.tabalife[0].focus();
		return false;		
	}
	
	if(document.form.tel1life.value.length < 10){
		alert("Please enter your correct phone number.");	
		document.form.tel1life.focus();
		return false;
	}
	
	if(document.form.maillife.value==""){
		alert("Please enter your email.");
		document.form.maillife.focus();
		return false;
	}else{
		var theEmail = document.form.maillife.value;
		var atLoc = theEmail.indexOf("@", 1);
		var dotLoc = theEmail.indexOf(".", atLoc+2);
		var len = theEmail.length;
		if(atLoc > 0 && dotLoc > 0 && len > dotLoc+2){
			
		}
		else{
			alert("Please enter the e-mail address properly.");
			document.form.maillife.focus();
			return false;
		}
	}
	
	index4 = document.form.drp2life.selectedIndex;

	if(index4 == 0){
		alert("Please select the coverage amount requested.");
		document.form.drp2life.focus();
		return false;
	}
	index5 = document.form.drp3life.selectedIndex;
	if(index5 == 0){
		alert("Please select the coverage type requested.");
		document.form.drp3life.focus();
		return false;
	}
	index6 = document.form.drp4life.selectedIndex;
	if(index6 == 0){
		alert("Please select your overall health rating.");
		document.form.drp4life.focus();
		return false;
	}
	
	ft = document.form.htftlife.selectedIndex;
	if(ft == 0){
		alert("Please select your height.");	
		document.form.htftlife.focus();
		return false;
	}
	ic = document.form.htinlife.selectedIndex;
	if(ic == 0){
		alert("Please select your height.");	
		document.form.htinlife.focus();
		return false;
	}
	
	if(document.form.weiglife.value == ""){
		alert("Please enter your weight.");	
		document.form.weiglife.focus();
		return false;
	}
}

//health insurance
function checkformH(){
	if(document.form.frstheal.value == ""){
		alert("Please enter your first name.");
		document.form.frstheal.focus();
		return false;
	}
	if(document.form.lastheal.value == ""){
		alert("Please enter your last name.");
		document.form.lastheal.focus();
		return false;
	}
	
	flag = 0;
	for ( x = 0, n = document.form.gendheal.length; x < n; x++){
		if(document.form.gendheal[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please select your gender.");
		document.form.gendheal[0].focus();
		return false;		
	}
	
	index1 = document.form.bdmoheal.selectedIndex;
	if(index1 == 0){
		alert("Please select the month of your DOB.");
		document.form.bdmoheal.focus();
		return false;
	}
	index2 = document.form.bddaheal.selectedIndex;
	if(index2 == 0){
		alert("Please select the day of your DOB.");
		document.form.bddaheal.focus();
		return false;
	}
	index3 = document.form.bdyrheal.selectedIndex;
	if(index3 == 0){
		alert("Please select the year of your DOB.");
		document.form.bdyrheal.focus();
		return false;
	}
	index4 = document.form.mariheal.selectedIndex;
	if(index4 == 0){
		alert("Please select your marital status.");
		document.form.mariheal.focus();
		return false;
	}
	
	flag = 0;
	for ( x = 0, n = document.form.sempheal.length; x < n; x++){
		if(document.form.sempheal[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Are you Self Employed? ");
		document.form.sempheal[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.homeheal.length; x < n; x++){
		if(document.form.homeheal[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you rent or own your home? ");
		document.form.homeheal[0].focus();
		return false;		
	}
	
	feet = document.form.htftheal.selectedIndex;
	if(feet == 0){
		alert("Please select your height.");	
		document.form.htftheal.focus();
		return false;
	}
	inch = document.form.htinheal.selectedIndex;
	if(inch == 0){
		alert("Please select your height.");	
		document.form.htinheal.focus();
		return false;
	}
	
	if(document.form.weigheal.value == ""){
		alert("Please enter your weight.");	
		document.form.weigheal.focus();
		return false;
	}
	
	flag = 0;
	for ( x = 0, n = document.form.tabaheal.length; x < n; x++){
		if(document.form.tabaheal[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you use Tabacco? ");
		document.form.tabaheal[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.citiheal.length; x < n; x++){
		if(document.form.citiheal[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Are you a US Citizen?");
		document.form.citiheal[0].focus();
		return false;		
	}
	
	
	if(document.form.str1heal.value==""){
		alert("Please enter the street address.");	
		document.form.str1heal.focus();
		return false;
	}
	if(document.form.cityheal.value==""){
		alert("Please enter the city.");	
		document.form.cityheal.focus();
		return false;
	}
	
	state = document.form.statheal.selectedIndex;
	if(state == ""){
		alert("Please select the state where you live.");
		document.form.statheal.focus();
		return false;
	}
	
	if(document.form.zippheal.value.length < 5){
		alert("Please enter the correct zip code.");
		document.form.zippheal.focus();
		return false;
	}
	
	
	if(document.form.tel1heal.value.length < 10){
		alert("Please enter your correct phone number.");	
		document.form.tel1heal.focus();
		return false;
	}
	
	if(document.form.mailheal.value==""){
		alert("Please enter your email.");
		document.form.mailheal.focus();
		return false;
	}else{
		var theEmail = document.form.mailheal.value;
		var atLoc = theEmail.indexOf("@", 1);
		var dotLoc = theEmail.indexOf(".", atLoc+2);
		var len = theEmail.length;
		if(atLoc > 0 && dotLoc > 0 && len > dotLoc+2){
			
		}
		else{
			alert("Please enter the e-mail address properly.");
			document.form.mailheal.focus();
			return false;
		}
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio1.length; x < n; x++){
		if(document.form.radio1[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have Asthma?");
		document.form.radio1[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio2.length; x < n; x++){
		if(document.form.radio2[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have cancer?");
		document.form.radio2[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio3.length; x < n; x++){
		if(document.form.radio3[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have depression?");
		document.form.radio3[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio4.length; x < n; x++){
		if(document.form.radio4[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have diabetes?");
		document.form.radio4[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio5.length; x < n; x++){
		if(document.form.radio5[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have high blood pressure?");
		document.form.radio5[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio6.length; x < n; x++){
		if(document.form.radio6[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have HIV/AIDS?");
		document.form.radio6[0].focus();
		return false;		
	}
	
	flag = 0;
	for ( x = 0, n = document.form.radio7.length; x < n; x++){
		if(document.form.radio7[x].checked){
			flag = 1;
		}
	}
	if(flag ==0){
		alert("Please answer the question: Do you have stroke?");
		document.form.radio7[0].focus();
		return false;		
	}

}