<!--
/**************************************************************************************************\
* The following scripts have been written by Benjamin Dolar of NIGHTLIGHT Consulting.              *
*                      Copyright 2004, all rights reserved.                                        *
*                                                                                                  *
* Reproduction of this script may not be used in any way, private or public, without               *
* the written consent of the above author under penalty of law                                     *
*                                                                                                  *
\**************************************************************************************************/

function Verify_Min(valid) {
var msg="These required fields are missing information:";
var errors=0;
  if (document.CMForm1.taf_a.value==""){
	  if (document.CMForm1.committee.value=="") {
		msg+="\n- Committee field is empty";
		errors++;
		}
	  if (document.CMForm1.L_email.value=="") {
		msg+="\n- Committee Liason Email field is empty";
		errors++;
		}
	  if (document.CMForm1.du_date.value=="") {
		msg+="\n- Due Date field is empty";
		errors++;
		}
	  if (document.CMForm1.order_by.value=="") {
		msg+="\n- Meeting Called To Order By field is empty";
		errors++;
		}
	  if (document.CMForm1.mem_present.value=="") {
		msg+="\n- Committee Members Present field is empty";
		errors++;
		}
	  if (document.CMForm1.min_by.value=="") {
		msg+="\n- Minutes Taken By field is empty";
		errors++;
		}
	  }
  if (errors != 0) {
    alert(msg);
    return false;
    }
}

function Verify_VForm(valid){
var msg="These required fields are missing information:";
var errors=0;
  if (document.VolForm.name.value=="") {
    msg+="\n- Name field is empty";
    errors++;
    }
  if (document.VolForm.address.value=="") {
    msg+="\n- Address field is empty";
    errors++;
    }
  if (document.VolForm.city_state_zip.value=="") {
    msg+="\n- City/State/ZIP field is empty";
    errors++;
    }
  if (document.VolForm.hphone.value=="") {
    msg+="\n- Home Phone field is empty";
    errors++;
    }
  if (document.VolForm.best_time.value=="") {
    msg+="\n- Best Time to Contact You field is empty";
    errors++;
    }
  if (document.VolForm.pref.value=="") {
    msg+="\n- Grade Preference field is empty";
    errors++;
    }
  if (document.VolForm.school_name.value=="") {
    msg+="\n- School Name field is empty";
    errors++;
    }
  if (document.VolForm.school_address.value=="") {
    msg+="\n- School Address field is empty";
    errors++;
    }
  if (document.VolForm.member.value=="") {
    msg+="\n- Current WSRA Member field is empty";
    errors++;
    }
  if (document.VolForm.council.value=="") {
    msg+="\n- Local Council field is empty";
    errors++;
    }
  if (errors != 0) {
    alert(msg);
    return false;
    }
}

function Verify_IForm(valid){
var msg="These required fields are missing information:\n";
var errors=0;
var agecheck=false;
var daycheck=false;
  for (i=0;i<document.IntroducerForm.agepref.length;i++){
	if (document.IntroducerForm.agepref[i].checked){
		agecheck=true;
		}
	}
  if (agecheck==false){
    msg+="\n- School Age Preference is not selected";
    errors++;
    }
  for (i=0;i<document.IntroducerForm.daypref.length;i++){
	if (document.IntroducerForm.daypref[i].checked){
		daycheck=true;
		}
	}
  if (daycheck==false){
    msg+="\n- Day Preference is not selected";
    errors++;
    }
  if (document.IntroducerForm.name.value=="") {
    msg+="\n- Name field is empty";
    errors++;
    }
  if (document.IntroducerForm.email.value=="") {
    msg+="\n- Email field is empty";
    errors++;
    }
  if (document.IntroducerForm.address.value=="") {
    msg+="\n- Address field is empty";
    errors++;
    }
  if (document.IntroducerForm.city.value=="") {
    msg+="\n- City/State/ZIP field is empty";
    errors++;
    }
  if (document.IntroducerForm.district.value=="") {
    msg+="\n- District field is empty";
    errors++;
    }
  if (errors != 0) {
	alert(msg);
    return false;
    }
  else{
	if (!document.IntroducerForm.policy.checked) {
    	msg="Please agree to the Introducer Terms by clicking the check box at the bottom of the form.";
    	alert(msg);
    	return false;
    	}
    }
}

function YACadd(valid){
	var numChild=document.YACForm.noChild.value;
	var numAdult=document.YACForm.noAdult.value;
	var total=(numChild*20 + numAdult*20);
	return document.YACForm.Total.value="$ "+total;
}

function Verify_YACForm(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
  if (document.YACForm.noChild.value==0 && document.YACForm.noAdult.value==0) {
    msg="Please select either the number of children or the number of adults attending.";
    errors++;
    }
  else{
	if (document.YACForm.noChild.value!=0 && document.YACForm.ChildName.value=="") {
    	msg+="\n- Please specify a name and grade for each child attending";
    	errors++;
    	}
  	if (document.YACForm.noAdult.value!=0 && document.YACForm.AdultName.value=="") {
    	msg+="\n- Please specify a name for each adult attending";
    	errors++;
    	}
 	if (document.YACForm.address1.value=="") {
    	msg+="\n- Address field is empty";
    	errors++;
    	}
  	if (document.YACForm.address2.value=="") {
    	msg+="\n- City/State/ZIP field is empty";
    	errors++;
    	}
  	}
  if (errors != 0) {
	alert(msg);
    return false;
    }	
}

function Verify_TAF(valid){
var msg="These required fields are missing information:";
var errors=0;
if (!document.TAForm.addFile[0].checked && !document.TAForm.addFile[1].checked){
  	alert("Please select how you wish to include your narrative file.");
    return false;
    }
else{  
  if (document.TAForm.n_name.value=="") {
    msg+="\n- Nominee Name field is empty";
    errors++;
    }
  if (document.TAForm.n_addy.value=="") {
    msg+="\n- Nominee Address field is empty";
    errors++;
    }
  if (document.TAForm.n_addy2.value=="") {
    msg+="\n- Nominee City/State/ZIP field is empty";
    errors++;
    }
  if (document.TAForm.n_hphone.value=="") {
    msg+="\n- Nominee Home Phone field is empty";
    errors++;
    }
  if (document.TAForm.n_email.value=="") {
    msg+="\n- Nominee Email field is empty";
    errors++;
    }
  if (document.TAForm.school.value=="") {
    msg+="\n- School field is empty";
    errors++;
    }
  if (document.TAForm.schooladdy.value=="") {
    msg+="\n- School Address field is empty";
    errors++;
    }
  if (document.TAForm.district.value=="") {
    msg+="\n- District field is empty";
    errors++;
    }
  if (document.TAForm.districtaddy.value=="") {
    msg+="\n- District Address field is empty";
    errors++;
    }
  if (document.TAForm.submit_by.value=="") {
    msg+="\n- Submitted By field is empty";
    errors++;
    }
  if (document.TAForm.s_addy.value=="") {
    msg+="\n- Submitter's Address field is empty";
    errors++;
    }
  if (document.TAForm.s_addy2.value=="") {
    msg+="\n- Submitter's City/State/ZIP field is empty";
    errors++;
    }
  if (document.TAForm.s_hphone.value=="") {
    msg+="\n- Submitter's Home Phone field is empty";
    errors++;
    }
  if (document.TAForm.addFile[0].checked && document.TAForm.taf_a.value=="") {
    msg+="\n- Attach Narrative field is empty";
    errors++;
    }
  if (errors != 0) {
    alert(msg);
    return false;
    }
  }
}

function Verify_CON(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
	if (document.CForm.name.value=="") {
    	msg+="\n- Your name is required";
    	errors++;
    	}
	if (!document.CForm.email.value && !document.CForm.phone.value) {
    	msg+="\n- Your email OR your telephone number is required";
    	errors++;
    	}
  	if (!document.CForm.subject.value) {
    	msg+="\n- Please specify a subject for this contact";
    	errors++;
    	}
 	if (document.CForm.memo.value=="") {
    	msg+="\n- Please fill in the message box for this contact";
    	errors++;
    	}
  if (errors != 0) {
	alert(msg);
    return false;
    }	
}

function Verify_HOTLINE(valid){
var submitted = false;
var msg="Processing your form produced the following errors:\n";
var errors=0;
  	if (!document.POST.subject.value) {
    	msg+="\n- Subject of post is required";
    	errors++;
    	}
	if (!document.POST.email.value) {
    	msg+="\n- Reply-To email address is required";
    	errors++;
    	}
	if (document.POST.body.value=="") {
    	msg+="\n- Body of post is required";
    	errors++;
    	}
  	if (errors != 0) {
		alert(msg);
    	return false;
    	}
	if(submitted == true) { return; }
     document.POST.submit();
     document.POST.Submit.value = 'Please Wait...';
     document.POST.Submit.disabled = true;
     submitted = true;
}

function Verify_MEM(valid){
var formcheck=false;
for (i=0;i<document.MemForm.membership.length;i++){
	if (document.MemForm.membership[i].checked){
		formcheck=true;
		}
	}
if (formcheck==false){
    alert("Please select if this is a renewal or a New Membership.");
    return false;
    }
}

function Verify_LB(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
	if (!document.LBForm1.name.value) {
    	msg+="\n- Your name is required";
    	errors++;
    	}
	if (!document.LBForm1.school.value) {
    	msg+="\n- Your school is required";
    	errors++;
    	}
  	if (!document.LBForm1.site.value) {
    	msg+="\n- Your site number is required";
    	errors++;
    	}
 	if (!document.LBForm1.email.value) {
    	msg+="\n- A contact email address is required";
    	errors++;
    	}
	if (!document.LBForm1.phone.value) {
    	msg+="\n- A contact phone number is required";
    	errors++;
    	}
  if (errors != 0) {
	alert(msg);
    return false;
    }	
}
function useBilling(Form){ 
   if(Form.use_billing.checked){ 
      Form.bfname.value=Form.fname1.value; 
	  Form.blname.value=Form.lname1.value;
      Form.baddy.value=Form.addy1.value; 
	  Form.bcity.value=Form.city1.value; 
	  Form.bstate.value=Form.state1.value; 
	  Form.bzip.value=Form.zip1.value; 
      Form.bphone.value=Form.hphone1.value; 
      Form.bemail.value=Form.email1.value; 
   } 
   else{ 
      Form.bfname.value=''; 
	  Form.blname.value='';
      Form.baddy.value=''; 
	  Form.bcity.value=''; 
	  Form.bstate.value=''; 
	  Form.bzip.value=''; 
      Form.bphone.value=''; 
      Form.bemail.value=''; 
   } 
} 
function textCounter(field,valuemax,divname) {
	if(field.value.length>0) {
		field.value = field.value.replace(/[^\d]+/g, ''); 
	}
	if(field.value.length==valuemax){
		if(field.getElementByID){
			field.getElementByID(divname).style.visiblilty='visible';//IE
		}else{
			if(document.layers) document.check.visibility='visible';//FireFox
			else document.all.check.style.visibility='visible';//Others
		}
	}else{
		if(field.getElementByID){
			field.getElementByID(divname).style.visiblilty='hidden';//IE
		}else{
			if(document.layers) document.check.visibility='hidden';//FireFox
			else document.all.check.style.visibility='hidden';//Others
		}
	}
}
function intOnly(x) {
	if(x.value.length>0) {
		x.value = x.value.replace(/[^\d]+/g, ''); 
	}
}
function charOnly(x) {
	if(x.value.length>0) {
		x.value = x.value.replace(/[0-9]+/g, ''); 
	}
}
//-->
