// JavaScript Document
function ChangeColor(name1){
  //document.getElementById(name1).style.color = "#AF8F58"; 
}

function PrintVol(volguid) {
	var windowSettings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,"+
								"resizable=yes,width=660,height=600,top=10,left=250";
	
	window.open('volconfirmprt.asp?vol=' + volguid,'',windowSettings);
}

function PrintUpdateVol(volguid) {
	var windowSettings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,"+
								"resizable=yes,width=660,height=600,top=10,left=250";
	
	window.open('volconfirmprt.asp?vol=' + volguid + '&update=y','',windowSettings);
}

function PrintContact(volguid) {
	var windowSettings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,"+
								"resizable=yes,width=660,height=600,top=10,left=250";
	
	window.open('contactconfirmprt.asp?vol=' + volguid,'',windowSettings);
}

function PrintRptContact(sQueryString) {
	var windowSettings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,"+
								"resizable=yes,width=660,height=600,top=10,left=250";
	
	window.open('rptcontactconfirmprt.asp?' + sQueryString,'',windowSettings);
}

function SignUpCheck(){ 
	var reBlank = /^\s*$/;
	var strValue;
  
	strValue = document.frmsignup.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmsignup.email.focus();
		return false;
	}
		
	strValue = document.frmsignup.firstname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Firstname");
		document.frmsignup.firstname.focus();
		return false;
	}

	strValue = document.frmsignup.lastname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Lastname");
		document.frmsignup.lastname.focus();
		return false;
	}

	strValue = document.frmsignup.address1.value;
	if (reBlank.test(strValue)){
		alert("Please enter Street");
		document.frmsignup.address1.focus();
		return false;
	}

	strValue = document.frmsignup.city.value;
	if (reBlank.test(strValue)){
		alert("Please enter City");
		document.frmsignup.city.focus();
		return false;
	}

	strValue = document.frmsignup.zip.value;
	if (reBlank.test(strValue)){
		alert("Please enter Zip");
		document.frmsignup.zip.focus();
		return false;
	}

}

function IsListedCheck(){ 
	var reBlank = /^\s*$/;
	var strValue;
  
	strValue = document.frmcheck.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmcheck.email.focus();
		return false;
	}
}

function SignUpContactCheck(){ 
	var reBlank = /^\s*$/;
	var strValue;
  
	strValue = document.frmsignup.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmsignup.email.focus();
		return false;
	}
		
	strValue = document.frmsignup.firstname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Firstname");
		document.frmsignup.firstname.focus();
		return false;
	}

	strValue = document.frmsignup.lastname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Lastname");
		document.frmsignup.lastname.focus();
		return false;
	}

	strValue = document.frmsignup.city.value;
	if (reBlank.test(strValue)){
		alert("Please enter City");
		document.frmsignup.city.focus();
		return false;
	}
}

function SignUpVolCheck(){ 
	var reBlank = /^\s*$/;
	var strValue;
  
	strValue = document.frmsignup.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmsignup.email.focus();
		return false;
	}
		
	strValue = document.frmsignup.firstname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Firstname");
		document.frmsignup.firstname.focus();
		return false;
	}

	strValue = document.frmsignup.lastname.value;
	if (reBlank.test(strValue)){
		alert("Please enter your Lastname");
		document.frmsignup.lastname.focus();
		return false;
	}

	strValue = document.frmsignup.address1.value;
	if (reBlank.test(strValue)){
		alert("Please enter Street");
		document.frmsignup.address1.focus();
		return false;
	}

	strValue = document.frmsignup.city.value;
	if (reBlank.test(strValue)){
		alert("Please enter City");
		document.frmsignup.city.focus();
		return false;
	}

	strValue = document.frmsignup.zip.value;
	if (reBlank.test(strValue)){
		alert("Please enter Zip");
		document.frmsignup.zip.focus();
		return false;
	}
	
	if (document.getElementById('agerange').selectedIndex == 0 ) {
		alert("Please select Age Range");
		document.frmsignup.agerange.focus();
		return false;
	}
}

function ReportContactCheck(){ 
	var reBlank = /^\s*$/;
	var strValue;

	var sel = document.getElementById('numberofcontacts');
	var NumberofContacts = parseInt(sel.options[sel.selectedIndex].value)

	strValue = document.frmcontact.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmcontact.email.focus();
		return false;
	}
	
	strValue = document.frmcontact.firstname1.value;
	if (reBlank.test(strValue)){
		alert("Please enter First Name of Contact 1.");
		document.frmcontact.firstname1.focus();
		return false;
	}

	strValue = document.frmcontact.lastname1.value;
	if (reBlank.test(strValue)){
		alert("Please enter Last Name of Contact 1.");
		document.frmcontact.lastname1.focus();
		return false;
	}

	strValue = document.frmcontact.contactdate1.value;
	if (reBlank.test(strValue)){
		alert("Please enter the date you contacted Contact 1.");
		document.frmcontact.contactdate1.focus();
		return false;
	}
	
	if (NumberofContacts >=2) {
		strValue = document.frmcontact.firstname2.value;
		if (reBlank.test(strValue)){
			alert("Please enter First Name of Contact 2.");
			document.frmcontact.firstname2.focus();
			return false;
		}

		strValue = document.frmcontact.lastname2.value;
		if (reBlank.test(strValue)){
			alert("Please enter Last Name of Contact 2.");
			document.frmcontact.lastname2.focus();
			return false;
		}

		strValue = document.frmcontact.contactdate2.value;
		if (reBlank.test(strValue)){
			alert("Please enter the date you contacted Contact 2.");
			document.frmcontact.contactdate2.focus();
			return false;
		}
	}

	if (NumberofContacts >=3) {
		strValue = document.frmcontact.firstname3.value;
		if (reBlank.test(strValue)){
			alert("Please enter First Name of Contact 3.");
			document.frmcontact.firstname3.focus();
			return false;
		}

		strValue = document.frmcontact.lastname3.value;
		if (reBlank.test(strValue)){
			alert("Please enter Last Name of Contact 3.");
			document.frmcontact.lastname3.focus();
			return false;
		}

		strValue = document.frmcontact.contactdate3.value;
		if (reBlank.test(strValue)){
			alert("Please enter the date you contacted Contact 3.");
			document.frmcontact.contactdate3.focus();
			return false;
		}
	}

	if (NumberofContacts >=4) {
		strValue = document.frmcontact.firstname4.value;
		if (reBlank.test(strValue)){
			alert("Please enter First Name of Contact 4.");
			document.frmcontact.firstname4.focus();
			return false;
		}

		strValue = document.frmcontact.lastname4.value;
		if (reBlank.test(strValue)){
			alert("Please enter Last Name of Contact 4.");
			document.frmcontact.lastname4.focus();
			return false;
		}

		strValue = document.frmcontact.contactdate4.value;
		if (reBlank.test(strValue)){
			alert("Please enter the date you contacted Contact 4.");
			document.frmcontact.contactdate4.focus();
			return false;
		}
	}
	
	if (NumberofContacts >=5) {
		strValue = document.frmcontact.firstname5.value;
		if (reBlank.test(strValue)){
			alert("Please enter First Name of Contact 5.");
			document.frmcontact.firstname5.focus();
			return false;
		}

		strValue = document.frmcontact.lastname5.value;
		if (reBlank.test(strValue)){
			alert("Please enter Last Name of Contact 5.");
			document.frmcontact.lastname5.focus();
			return false;
		}

		strValue = document.frmcontact.contactdate5.value;
		if (reBlank.test(strValue)){
			alert("Please enter the date you contacted Contact 5.");
			document.frmcontact.contactdate5.focus();
			return false;
		}
	}

}


function SubmitReportContactForm(){ 
	var reBlank = /^\s*$/;
	var strValue;
	var FormOK 
	
	FormOK = 0;
	
	var sel = document.getElementById('numberofcontacts');
	var NumberofContacts = parseInt(sel.options[sel.selectedIndex].value)

	strValue = document.frmcontact.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmcontact.email.focus();
		//return false;
		FormOK = 1;
	}

	if (FormOK == 0) {
		if (document.getElementById('contacttype1').selectedIndex == 0 ) {
			alert("Please select how did you contact the person");
			document.frmcontact.contacttype1.focus();
			//return false;
			FormOK = 1;
	}}

	if (FormOK == 0) {
		if (document.getElementById('contactmonth1').selectedIndex == 0 ) {
			alert("Please select the date you contacted the person.");
			document.frmcontact.contactmonth1.focus();
			//return false;
			FormOK = 1; 
	}}

	if (FormOK == 0) {
		if (document.getElementById('contactday1').selectedIndex == 0 ) {
			alert("Please select the date you contacted the person.");
			document.frmcontact.contactday1.focus();
			//return false;
			FormOK = 1; 
	}}

	if (FormOK == 0) { 
		if (document.getElementById('contactyear1').selectedIndex == 0 ) {
			alert("Please select the date you contacted the person.");
			document.frmcontact.contactyear1.focus();
			//return false;
			FormOK = 1;
	}}

	if (FormOK == 0) {
		if (document.getElementById('responsetype1').selectedIndex == 0 ) {
			alert("Please select the response of the person you contacted.");
			document.frmcontact.responsetype1.focus();
			//return false;
			FormOK = 1;
	}}
	
	if (NumberofContacts >=2) {
		if (FormOK == 0) {
			if (document.getElementById('contacttype2').selectedIndex == 0 ) {
				alert("Please select how did you contact the person");
				document.frmcontact.contacttype2.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactmonth2').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactmonth2.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {		
			if (document.getElementById('contactday2').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactday2.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactyear2').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactyear2.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('responsetype2').selectedIndex == 0 ) {
				alert("Please select the response of the person you contacted.");
				document.frmcontact.responsetype2.focus();
				//return false;
				FormOK = 1;
		}}
	}

	if (NumberofContacts >=3) {
		if (FormOK == 0) {
			if (document.getElementById('contacttype3').selectedIndex == 0 ) {
				alert("Please select how did you contact the person");
				document.frmcontact.contacttype3.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactmonth3').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactmonth3.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactday3').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactday3.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactyear3').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactyear3.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('responsetype3').selectedIndex == 0 ) {
				alert("Please select the response of the person you contacted.");
				document.frmcontact.responsetype3.focus();
				//return false;
				FormOK = 1;
		}}
	}	

	if (NumberofContacts >=4) {
		if (FormOK == 0) {
			if (document.getElementById('contacttype4').selectedIndex == 0 ) {
				alert("Please select how did you contact the person");
				document.frmcontact.contacttype4.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactmonth4').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactmonth4.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {	
			if (document.getElementById('contactday4').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactday4.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactyear4').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactyear4.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('responsetype4').selectedIndex == 0 ) {
				alert("Please select the response of the person you contacted.");
				document.frmcontact.responsetype4.focus();
				//return false;
				FormOK = 1;
		}}
	}
	
	if (NumberofContacts >=5) {
		if (FormOK == 0) {
			if (document.getElementById('contacttype5').selectedIndex == 0 ) {
				alert("Please select how did you contact the person");
				document.frmcontact.contacttype5.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactmonth5').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactmonth5.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactday5').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactday5.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('contactyear5').selectedIndex == 0 ) {
				alert("Please select the date you contacted the person.");
				document.frmcontact.contactyear5.focus();
				//return false;
				FormOK = 1;
		}}

		if (FormOK == 0) {
			if (document.getElementById('responsetype5').selectedIndex == 0 ) {
				alert("Please select the response of the person you contacted.");
				document.frmcontact.responsetype5.focus();
				//return false;
				FormOK = 1;
		}}
	}

	if (FormOK == 0) { 
		document.frmcontact.submitreport.value = '1';
		document.frmcontact.submit();
	}
}

function SendContactReport(){ 
	var reBlank = /^\s*$/;
	var strValue;

	strValue = document.frmcontact.email.value;
	if (reBlank.test(strValue)){
		alert("Please enter your E-mail address.");
		document.frmcontact.email.focus();
		//return false;
	}
	else {
		document.frmcontact.sendreport.value = '1';
		document.frmcontact.submit();	
	}

}

function OpenVol(URL) {
	var windowSettings="toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,"+
								"resizable=yes,width=600,height=600,top=100,left=250";
  	window.open(URL,'',windowSettings);
}

function PopNotes(NotesName) {
	var winSettings; 

	switch (NotesName)	{
		case "confirmedcontacts" :
			winSettings = "height=380,width=400,top=175,left=275";			
			break;
		case  "unreached" :
			winSettings = "height=170,width=365,top=175,left=275";			
			break;
		case  "uncommitted" :
			winSettings = "height=200,width=365,top=175,left=275";			
			break;
		case  "churchstart" :
			winSettings = "height=400,width=365,top=175,left=275";			
			break;
		case  "conditions" :
			winSettings = "height=150,width=365,top=175,left=275";			
			break;
		default :
			winSettings = "height=250,width=365,top=175,left=275";
			break;
	}
	
	winSettings = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=no, " + winSettings
	window.open('notes.asp?n='+ NotesName,'', winSettings);
}