
window.onload = function()
{

	highlightGlobalNav('header');
	highlightLocalNav('right-column');

}


function highlightGlobalNav(navdiv)
{
	var thissection = window.location.toString().split('/')[3];
	var navul = document.getElementById(navdiv);
	if (navul) {
		var navanchors = navul.getElementsByTagName('a');
		if (navanchors) {
			for(var i = 0; i <= navanchors.length-1; i++) {
				if (navanchors[i].href.toString().split('/')[3] == thissection) {
					navanchors[i].className = 'here';
					break;
				} else {
					navanchors[i].className = 'nothere';
				}
			}
		}
	}
}


function highlightLocalNav(navdiv)
{
	var thispath = window.location.toString().split('#')[0].split('?')[0];
	var navwrap = document.getElementById(navdiv);
	if (navwrap) {
		var navanchors = navwrap.getElementsByTagName('a');
		if (navanchors) {
			for(var i = 0; i <= navanchors.length-1; i++) {
				if (navanchors[i].href == thispath) {
					navanchors[i].className = 'here';
					break;
				} else {
					navanchors[i].className = 'nothere';
				}
			}
		}
	}
}


function clearfield(element) 
{
	if (element.defaultValue == element.value) element.value = "";
}

function startCalc(){
	interval = setInterval("calc()",1);
}
	
function calc(){
	one = document.Form990Payment.Subtotal.value;
	two = document.Form990Payment.Tax.value; 
	document.Form990Payment.AMOUNT.value = (one * 1) + (two * 1);
}

function stopCalc(){
	clearInterval(interval);
}

/*function startCalc2(){
	interval = setInterval("calc2()",1);
}
	
function calc2(){
	one = document.Form990Payment.BQUnits.value;
	two = document.Form990Payment.OrgUnits.value;
	three = document.Form990Payment.RBQUnits.value;
	
	if (one < 51) {
		subtotal1 = (one * 200);	
	}
	
	document.Form990Payment.Subtotal.value = subtotal1 + subtotal2 + (two * 100);	
	
}*/

function Form_Validator(theForm) {

	// check to see if the name field is blank
	if (theForm.Name.value == "") {
	  alert("You must enter a name.");
	  theForm.Name.focus();
	  return (false);
	}

	if (theForm.Firm.value == "") {
	  alert("You must enter a Firm/Organization name.");
	  theForm.Firm.focus();
	  return (false);
	}

	if (theForm.Address.value == "") {
	  alert("You must enter an address.");
	  theForm.Address.focus();
	  return (false);
	}

	if (theForm.City.value == "") {
	  alert("You must enter a city.");
	  theForm.City.focus();
	  return (false);
	}

	if (theForm.State.value == "Default") {
	  alert("You must enter a state.");
	  theForm.State.focus();
	  return (false);
	}

	if (theForm.Zip.value == ""  || theForm.Zip.value.length < 5) {
	  alert("You must enter a valid zip code.");
	  theForm.Zip.focus();
	  return (false);
	}

	if (theForm.Email.value == "") {
	  alert("You must enter an email address.");
	  theForm.Email.focus();
	  return (false);
	}

	if (theForm.Phone.value != "" && theForm.Phone.value.length < 12) {
	  alert("You have entered an invalid phone number.");
	  theForm.Email.focus();
	  return (false);
	}

	if (theForm.Fax.value != "" && theForm.Fax.value.length < 12) {
	  alert("You have entered an invalid fax number.");
	  theForm.Email.focus();
	  return (false);
	}	
	
	if ((theForm.BQUnits08.value == "0" || theForm.BQUnits08.value == "" || theForm.BQUnits08.value == 0) &&
	(theForm.BQUnits09.value == 0 || theForm.BQUnits09.value == "" || theForm.BQUnits09.value == 0) &&
	(theForm.RBQUnits08.value == 0 || theForm.RBQUnits08.value == "" || theForm.RBQUnits08.value == 0) &
	(theForm.RBQUnits09.value == 0 || theForm.RBQUnits09.value == "" || theForm.RBQUnits09.value == 0) &&
	(theForm.OrgUnits08.value == 0 || theForm.OrgUnits08.value == "" || theForm.OrgUnits08.value == 0) &&
	(theForm.OrgUnits09.value == 0 || theForm.OrgUnits09.value == "" || theForm.OrgUnits09.value == 0)) {
	  alert("Please enter the amount of basic Board Questionnaire Templates, Related Board Questionnaire Templates and/or 990 Organizers you would like to purchase.");
	  theForm.BQUnits08.focus();
	  return (false);		
	}

	if (theForm.Agree.checked == false) {
	  alert("You must accept the Terms and Conditions before proceeding.");
	  theForm.Agree.focus();
	  return (false);
	}

}

function Form1_Validator(theForm) {

	if (theForm.Tax.value == ""  || theForm.Tax.value == 0) {
		alert("Washington State residents must add sales tax.");
	  	theForm.Tax.focus();
	  	return (false);
	}

}



