<!--
/**************************************************************************************************\
* 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_Eval(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
	if (!document.ConvEval.dates.value) {
    	msg+="\n- The dates you attended are required";
    	errors++;
    	}
	if (!document.ConvEval.email.value) {
    	msg+="\n- Your email address is required";
    	errors++;
    	}
	if (!document.ConvEval.overall.value) {
    	msg+="\n- Question #1 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.topics.value){
		msg+="\n- Question #2 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.speakers.value){
		msg+="\n- Question #3 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.schedule.value){
		msg+="\n- Question #4 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.exhibits.value){
		msg+="\n- Question #5 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.facilities.value){
		msg+="\n- Question #6 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.meals.value){
		msg+="\n- Question #7 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.registration.value){
		msg+="\n- Question #8 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.program.value){
		msg+="\n- Question #9 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.sales.value){
		msg+="\n- Question #10 requires a rating";
    	errors++;
    	}
	if (!document.ConvEval.WedEvening.value){
		msg+="\n- Question #11 requires a Yes/No";
    	errors++;
    	}
	if (!document.ConvEval.CyberCafe.value){
		msg+="\n- Question #12 requires a Yes/No";
    	errors++;
    	}
	if (!document.ConvEval.saturday.value){
		msg+="\n- Question #13 requires a Yes/No";
    	errors++;
    	}
  if (errors != 0) {
	alert(msg);
    return false;
    }	
}
function enableField(field){
	field.disabled=false;
}
function disableField(field){
	field.disabled=true;
}
function clickclear(thisfield, defaulttext) {
	if (thisfield.value == defaulttext) {
		thisfield.value = "";
	}
}
function wordcount(formField,fieldName) {
  var a = formField.value.split(/\s+/g); // split the sentence into an array of words
  //return a.length;
  if (fieldName=='Abstract' && a.length>75){
	  alert("Please limit your "+fieldName+" to no more than 75 words. \n\nWord Count: "+a.length);
	  return false;
  }
}
function wordcount100(formField,fieldName) {
  var a = formField.value.split(/\s+/g); // split the sentence into an array of words
  if (a.length>100){
	  alert("Please limit your "+fieldName+" to no more than 100 words. \n\nWord Count: "+a.length);
	  return false;
  }
}
function livecount(w,x){
	var y=w.value;
	var r = 0;
	a=y.replace('\n',' ');
	a=a.split(' ');
	for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}
	x.value=r;
}
function SubmitTheForm() {
	var submitted = false;
	if (document.AddMemForm.inputfile.value == ""){
	alert('Please specify a file...');
	return false;
	}
	if(submitted == true) { return; }
	 document.AddMemForm.submit();
	 document.AddMemForm.Submit.value = 'Please Wait...';
	 document.AddMemForm.Submit.disabled = true;
	 submitted = true;
}
//BEGIN ConvProp proposal form
function Verify_PropF(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
	if (!document.PropForm.title.value) {
    	msg+="\n1) - The title of your program is required";
    	errors++;
    }
	if (!document.PropForm.fname.value || !document.PropForm.lname.value) {
    	msg+="\n3) - Major Presenter is required";
    	errors++;
    }
	if (!document.PropForm.addy.value || document.PropForm.addy.value=='(address, city, state, zip)'){
		msg+="\n6) - Your Home Address is required";
    	errors++;
    }
	if (!document.PropForm.hphone.value && !document.PropForm.wphone.value){
		msg+="\n7/8) - Your Home OR Work Phone is required";
    	errors++;
    }
	if (!document.PropForm.email.value){
		msg+="\n9) - Your Email Address is required";
    	errors++;
    }
	//type of program check loop
	var typecheck=false;
	for (i=0;i<document.PropForm.type.length;i++){
		if (document.PropForm.type[i].checked){
			typecheck=true;
		}
	}
	if (typecheck==false){
		msg+="\n11) - Type of Program is required";
		errors++;
	}else{
		if (document.PropForm.type[3].checked && !document.PropForm.typeOther.value){
			msg+="\n11.1) - When selecting Other or Type of Program, please specify in the field provided";
			errors++;
		}
	}
	//audience check loop
	  var audcheck=false;
	  var objForm = document.forms[0].elements
	  for(i=0;i<objForm.length;i++){
		if(objForm[i].type == "checkbox" && objForm[i].name.indexOf('t1-aud[]')!= "-1" && objForm[i].checked){
		   audcheck=true;
		}
	  }
	if (audcheck==false){
		msg+="\n12) - Intended Audience is required";
		errors++;
	}
			
	if (!document.PropForm.standards.value){
		msg+="\n13) - The Standards your proposal addresses are required";
    	errors++;
	}		
	
	
	if (document.PropForm.lcdP.checked){
		var lcdcheck=false;
		for (i=0;i<document.PropForm.lcdC.length;i++){
			if (document.PropForm.lcdC[i].checked){
				lcdcheck=true;
			}
		}
		if (lcdcheck==false){
			msg+="\n14) - When requiring an LCD Projector, please select an operating system";
			errors++;
		}else{
			if (document.PropForm.lcdC[1].checked && !document.PropForm.typeMac.value){
				msg+="\n14) - When selecting Type of MAC, please specify type in field provided";
				errors++;
			}
		}
    }
	if (!document.PropForm.abstract.value){
		msg+="\n15) - Abstract is required";
    	errors++;
	}	
	if (errors != 0) {
		alert(msg);
		return false;
	}	
	return wordcount(document.PropForm.abstract,'Abstract');
}
//END ConvProp proposal form
//BEGIN Featured ConvProp form
function Verify_PropFS(valid){
var msg="Processing your form produced the following errors:\n";
var errors=0;
	if (!document.PropForm.fname.value || !document.PropForm.lname.value) {
    	msg+="\n1) - Speaker Name is required";
    	errors++;
    }
	if (!document.PropForm.addy.value || document.PropForm.addy.value=='(address, city, state, zip)'){
		msg+="\n2) - Your Home Address is required";
    	errors++;
    }
	if (!document.PropForm.hphone.value && !document.PropForm.wphone.value){
		msg+="\n3/4) - Your Home OR Work Phone is required";
    	errors++;
    }
	if (!document.PropForm.email.value){
		msg+="\n6) - Your Email Address is required";
    	errors++;
    }
	if (!document.PropForm.bio.value){
		msg+="\n7) - Your Biographical is required";
    	errors++;
	}	
	if (!document.PropForm.title1.value){
		msg+="\n9.1) - A Title for your 1st Abstract is required";
    	errors++;
	}
	if (!document.PropForm.abs1.value){
		msg+="\n9.1) - Your 1st Abstract is required";
    	errors++;
	}
	if ((document.PropForm.title2.value && !document.PropForm.abs2.value) || (!document.PropForm.title2.value && document.PropForm.abs2.value)){
		msg+="\n9.2) - When submitting a 2nd Abstract, please make sure that the Title and Abstract fields are filled in";
    	errors++;
	}
	if ((document.PropForm.title3.value && !document.PropForm.abs3.value) || (!document.PropForm.title3.value && document.PropForm.abs3.value)){
		msg+="\n9.3) - When submitting a 3rd Abstract, please make sure that the Title and Abstract fields are filled in";
    	errors++;
	}
	if ((document.PropForm.title4.value && !document.PropForm.abs3.value) || (!document.PropForm.title4.value && document.PropForm.abs4.value)){
		msg+="\n9.4) - When submitting a 4th Abstract, please make sure that the Title and Abstract fields are filled in";
    	errors++;
	}
	//audience check loop
	  var audcheck=false;
	  var objForm = document.forms[0].elements
	  for(i=0;i<objForm.length;i++){
		if(objForm[i].type == "checkbox" && objForm[i].name.indexOf('aud[]')!= "-1" && objForm[i].checked){
		   audcheck=true;
		}
	  }
	if (audcheck==false){
		msg+="\n10) - Intended Audience is required";
		errors++;
	}
			
	if (!document.PropForm.standards.value){
		msg+="\n11) - The Standards your proposal addresses are required";
    	errors++;
	}	
	if (document.PropForm.lcdP.checked){
		var lcdcheck=false;
		for (i=0;i<document.PropForm.lcdC.length;i++){
			if (document.PropForm.lcdC[i].checked){
				lcdcheck=true;
			}
		}
		if (lcdcheck==false){
			msg+="\n11) - When requiring an LCD Projector, please select an operating system";
			errors++;
		}else{
			if (document.PropForm.lcdC[1].checked && !document.PropForm.typeMac.value){
				msg+="\n11) - When selecting Type of MAC, please specify type in field provided";
				errors++;
			}
		}
    }
	if (errors != 0) {
		alert(msg);
		return false;
	}
	var returnVal=true;
		returnVal=wordcount100(document.PropForm.bio,'Biographical');
		if(returnVal==false) return returnVal;
		returnVal=wordcount100(document.PropForm.abs1,'1st Abstract');
		if(returnVal==false) return returnVal;
		returnVal=wordcount100(document.PropForm.abs2,'2nd Abstract');
		if(returnVal==false) return returnVal;
		returnVal=wordcount100(document.PropForm.abs3,'3rd Abstract');
		if(returnVal==false) return returnVal;
		returnVal=wordcount100(document.PropForm.abs4,'4th Abstract');
		if(returnVal==false) return returnVal;
	return returnVal;
}
//END Featured ConvProp form
//BEGIN ConvProp index.php form
function moveOver(field,box)  {
	var boxLength = box.length;
	var selectedItem = field.selectedIndex;
	var selectedText = field.options[selectedItem].text;
	var selectedValue = field.options[selectedItem].value;
	var i;
	var isNew = true;
	if (boxLength != 0) {
		for (i = 0; i < boxLength; i++) {
			thisitem = box.options[i].text;
			if (thisitem == selectedText) {
				isNew = false;
				break;
			 }
		}
	} 
	if (isNew) {
		newoption = new Option(selectedText, selectedValue, false, false);
		box.options[boxLength] = newoption;
	}
	field.selectedIndex=-1;
}
function removeMe(box) {
	var boxLength = box.length;
	arrSelected = new Array();
	var count = 0;
	for (i = 0; i < boxLength; i++) {
		if (box.options[i].selected) {
			arrSelected[count] = box.options[i].value;
		}
		count++;
	}
	var x;
	for (i = 0; i < boxLength; i++) {
		for (x = 0; x < arrSelected.length; x++) {
			if (box.options[i].value == arrSelected[x]) {
				box.options[i] = null;
		   }
		}
		boxLength = box.length;
	}
}
function saveMe() {
	var strValues = "";
	var sorted = "";
	var boxLength = document.choiceForm.choiceBox.length;
	var boxLengthS = document.choiceForm.choiceBoxS.length;
	if(document.choiceForm.propyear[0].checked){
		var propyear = document.choiceForm.propyear[0].value;
	}else if(document.choiceForm.propyear[1].checked){
		var propyear = document.choiceForm.propyear[1].value;
	}else if(document.choiceForm.propyear[2].checked){
		var propyear = document.choiceForm.propyear[2].value;
	}	
	else if(document.choiceForm.propyear[3].checked){
		var propyear = document.choiceForm.propyear[3].value;
	}	
	else if(document.choiceForm.propyear[4].checked){
		var propyear = document.choiceForm.propyear[4].value;
	}	
	var count = 0;
	if (boxLength != 0) {
	for (i = 0; i < boxLength; i++) {
		if (count == 0) {
			strValues = document.choiceForm.choiceBox.options[i].value;
		} else {
			strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
		}
		count++;
		}
	}
	var countS=0;
	if (boxLengthS != 0) {
	for (i = 0; i < boxLengthS; i++) {
		if (countS == 0) {
			sorted = document.choiceForm.choiceBoxS.options[i].value;
		} else {
			sorted = sorted + "," + document.choiceForm.choiceBoxS.options[i].value;
		}
		countS++;
		}
	}
	if (strValues.length == 0) {
		alert("You have not made any selections");
		return false;
	}else if (!sorted){
		document.location.href="index.php?action="+strValues+"&yr="+propyear;
		return false;
	}else {
		document.location.href="index.php?action="+strValues+"&yr="+propyear+"&sortby="+sorted;
		return false;
	}
}//END ConvProp index.php form
function Verify_Inv(){//BEGIN invsearch.php
	var msg="Processing your form produced the following errors:\n";
	var errors=0;
	if (!document.InvSearch.i.value) {
    	msg+="\n- Your invoice number is required";
    	errors++;
    	}
	if (!document.InvSearch.b.value) {
    	msg+="\n- The last name of the Billing Address is required";
    	errors++;
    	}
	if (document.InvSearch.i.value.length>0 && document.InvSearch.i.value.length<6) {
    	msg+="\n- Your invoice number should be 6 digits in length";
    	errors++;
    	}
	if (errors != 0) {
		alert(msg);
		return false;
	}
}//END invsearch.php
function Verify_Event(eventForm){//BEGIN register.php
	var msg="Processing your form produced the following errors:\n";
	var errors=0;
	for (i=1;i<=eventForm.att.value;i++) {
		fname1="fname"+i;
		lname1="lname"+i;
		fee1="fee"+i;
		fname=eventForm.fname1;
		lname=eventForm.lname1;
		fee=eventForm.fee1;
		if (!fname.value || !lname.value) {
			msg+="\n- Attendee #"+i+" - full name is required";
			errors++;
			}
		var feeCheck=false;
		for (x=0;x<fee.length;x++){
			if (fee[x].checked){
				feeCheck=true;
			}
		}
		if (feeCheck==false){
			msg+="\n- Attendee #"+i+" - fee is required";
			errors++;
		}
	}
	if (!eventForm.bdistrict.value) {
		msg+="\n- A district name is required";
		errors++;
	}
	if (!eventForm.baddy.value || !eventForm.bcity.value || !eventForm.bstate.value || !eventForm.bzip.value) {
		msg+="\n- A full billing address is required (Street Address, City, State, ZIP)";
		errors++;
	}
	if (!eventForm.bphone.value) {
		msg+="\n- A billing telephone number is required";
		errors++;
	}
	if (errors != 0) {
		alert(msg);
		return false;
	}
}//END register.php
function AdminForm(){//BEGIN adminaward
	var msg="Processing your form produced the following errors:\n";
	var errors=0;
	if (!document.AAForm.aname.value) {
    	msg+="\n- An administrators name is required";
    	errors++;
    	}
	if (!document.AAForm.school.value) {
    	msg+="\n- The administrators school name is required";
    	errors++;
    	}
	if (!document.AAForm.schooladdy.value) {
    	msg+="\n- The administrators school address is required";
    	errors++;
    	}
	if (!document.AAForm.district.value) {
    	msg+="\n- The administrators district is required";
    	errors++;
    	}
	if (!document.AAForm.districtaddy.value) {
    	msg+="\n- The administrators district address is required";
    	errors++;
    	}
	if (!document.AAForm.nominated_by.value) {
    	msg+="\n- The nominating local council is required";
    	errors++;
    	}
	if (!document.AAForm.pres_sig.value) {
    	msg+="\n- The council presidents signature (WSRA membership ID) is required";
    	errors++;
    	}
	if (!document.AAForm.pres_addy.value) {
    	msg+="\n- The council presidents address is required";
    	errors++;
    	}
	if (!document.AAForm.pres_csz.value) {
    	msg+="\n- The council presidents City, State and ZIP are required";
    	errors++;
    	}
	if (errors != 0) {
		alert(msg);
		return false;
	}
}//END adminaward
function CouncilForm(){//BEGIN councilaward
	var msg="Processing your form produced the following errors:\n";
	var errors=0;
	if (!document.CAForm.addFile[0].checked && !document.CAForm.addFile[1].checked){
  		alert("Please select how you wish to include your program description file.");
    	return false;
    }
	else{  
		if (!document.CAForm.nominee.value) {
			msg+="\n- A council nominee is required";
			errors++;
		}
		if (!document.CAForm.contact.value) {
			msg+="\n- A contact person is required";
			errors++;
		}
		if (!document.CAForm.addy.value) {
			msg+="\n- The contact persons address is required";
			errors++;
		}
		if (!document.CAForm.csz.value) {
			msg+="\n- The contact persons City, State and ZIP are required";
			errors++;
		}
		if (!document.CAForm.phone.value) {
			msg+="\n- The contact persons phone is required";
			errors++;
		}
		if (!document.CAForm.program.value) {
			msg+="\n- The program name is required";
			errors++;
		}
		if (!document.CAForm.pres_sig.value) {
			msg+="\n- The council presidents signature (WSRA membership ID) is required";
			errors++;
		}
		if (!document.CAForm.pres_addy.value) {
			msg+="\n- The council presidents address is required";
			errors++;
		}
		if (!document.CAForm.pres_csz.value) {
			msg+="\n- The council presidents City, State and ZIP are required";
			errors++;
		}
		if (errors != 0) {
			alert(msg);
			return false;
		}
	}
}//END councilaward
function FriendsForm(){//BEGIN friendslit
if (!document.FLForm.nominee.value ||
	!document.FLForm.addy.value ||
	!document.FLForm.csz.value ||
	!document.FLForm.phone.value ||
	!document.FLForm.school.value ||
	!document.FLForm.saddy.value ||
	!document.FLForm.district.value ||
	!document.FLForm.nom.value ||
	!document.FLForm.naddy.value ||
	!document.FLForm.ncsz.value ||
	!document.FLForm.nphone.value ||
	!document.FLForm.nomsig.value ||
	!document.FLForm.library.value ||
	!document.FLForm.lcontact.value ||
	!document.FLForm.laddy.value ||
	!document.FLForm.lcsz.value ||
	!document.FLForm.lphone.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END friendslit
function LitFormI(){//BEGIN LitAwardI
if (!document.LAIForm.addFile[0].checked && !document.LAIForm.addFile[1].checked){
		alert("Please select how you wish to include your program description file.");
		return false;
	}
if (!document.LAIForm.nominee.value ||
	!document.LAIForm.org.value ||
	!document.LAIForm.addy.value ||
	!document.LAIForm.csz.value ||
	!document.LAIForm.phone.value ||
	!document.LAIForm.contact.value ||
	!document.LAIForm.caddy.value ||
	!document.LAIForm.ccsz.value ||
	!document.LAIForm.cphone.value ||
	!document.LAIForm.council.value ||
	!document.LAIForm.pres_sig.value ||
	!document.LAIForm.pres_addy.value ||
	!document.LAIForm.pres_csz.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END LitAwardI
function LitFormG(){//BEGIN LitAwardG
if (!document.LAGForm.addFile[0].checked && !document.LAGForm.addFile[1].checked){
		alert("Please select how you wish to include your program description file.");
		return false;
	}
if (!document.LAGForm.nominee.value ||
	!document.LAGForm.addy.value ||
	!document.LAGForm.csz.value ||
	!document.LAGForm.phone.value ||
	!document.LAGForm.contact.value ||
	!document.LAGForm.caddy.value ||
	!document.LAGForm.ccsz.value ||
	!document.LAGForm.cphone.value ||
	!document.LAGForm.council.value ||
	!document.LAGForm.pres_sig.value ||
	!document.LAGForm.pres_addy.value ||
	!document.LAGForm.pres_csz.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END LitAwardG
function OutServForm(){//BEGIN OutServ
if (!document.OSForm.nominee.value ||
	!document.OSForm.addy.value ||
	!document.OSForm.csz.value ||
	!document.OSForm.phone.value ||
	!document.OSForm.school.value ||
	!document.OSForm.saddy.value ||
	!document.OSForm.district.value ||
	!document.OSForm.nom.value ||
	!document.OSForm.nomsig.value ||
	!document.OSForm.nemail.value ||
	!document.OSForm.naddy.value ||
	!document.OSForm.ncsz.value ||
	!document.OSForm.nphone.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END OutServ
function SSS_Form(){//BEGIN Student Scholar S form
if (!document.SSSForm.student.value ||
	!document.SSSForm.addy.value ||
	!document.SSSForm.csz.value ||
	!document.SSSForm.phone.value ||
	!document.SSSForm.college.value ||
	!document.SSSForm.status.value ||
	!document.SSSForm.major.value ||
	!document.SSSForm.interest.value ||
	!document.SSSForm.plan.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END Student Scholar S form
function SSN_Form(){//BEGIN Student Scholar N form
if (!document.SSNForm.student.value ||
	!document.SSNForm.council.value ||
	!document.SSNForm.nom.value ||
	!document.SSNForm.addy.value ||
	!document.SSNForm.csz.value ||
	!document.SSNForm.phone.value ||
	!document.SSNForm.position.value ||
	!document.SSNForm.contact.value ||
	!document.SSNForm.support.value) {
		alert('One or more required fields are missing information.  Please verify that all necessary fields are filled in correctly.');
		return false;
	}
}//END Student Scholar N form
//-->
