/*
JAVASCRIPT FUNCTIONS

-form validation handlers


*/
//
/*********************** FORM VALIDATION *****************************/
/*********************************************************************/
//
//
//validate contact form on contact-tony/index.php
function v_contactForm(){
	toTest = document.contactForm.title.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your salutation.");
	  document.contactForm.title.focus();
	  return false;
	}
	toTest = document.contactForm.fname.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your first name.");
	  document.contactForm.fname.focus();
	  return false;
	}
	toTest = document.contactForm.lname.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your last name.");
	  document.contactForm.lname.focus();
	  return false;
	}
	toTest = document.contactForm.streetnum.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your street number.");
	  document.contactForm.streetnum.focus();
	  return false;
	}
	toTest = document.contactForm.streetname.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your street name.");
	  document.contactForm.streetname.focus();
	  return false;
	}
	toTest = document.contactForm.city.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your city.");
	  document.contactForm.city.focus();
	  return false;
	}
	toTest = document.contactForm.province.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your province.");
	  document.contactForm.province.focus();
	  return false;
	}
	toTest = document.contactForm.postal.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your postal code.");
	  document.contactForm.postal.focus();
	  return false;
	}
	toTest = document.contactForm.area.value;
	toTestLen = toTest.length;
	if(toTest==null || toTest=="" || toTestLen < 3) {
	  alert("Please complete your phone number.");
	  document.contactForm.area.focus();
	  return false;
	}
	toTest = document.contactForm.region.value;
	toTestLen = toTest.length;
	if(toTest==null || toTest=="" || toTestLen < 3) {
	  alert("Please complete your phone number.");
	  document.contactForm.region.focus();
	  return false;
	}
	toTest = document.contactForm.number.value;
	toTestLen = toTest.length;
	if(toTest==null || toTest=="" || toTestLen < 4) {
	  alert("Please complete your phone number.");
	  document.contactForm.number.focus();
	  return false;
	}
	toTest = document.contactForm.email.value;
	if(toTest==null || toTest=="") {
	  bool = confirm("Please enter your email\n\nIf you do not have an email address, click 'CANCEL'.");
	  if (bool!=true){
	  	document.contactForm.email.value = 'none';
		//return false;
	  } else {
	  	document.contactForm.email.focus();
		return false;		
	  }
	}
	toTest = document.contactForm.subject.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter the subject of your email.");
	  document.contactForm.subject.focus();
	  return false;
	}
	toTest = document.contactForm.comments.value;
	if(toTest==null || toTest=="") {
	  alert("Please enter your comment(s).");
	  document.contactForm.comments.focus();
	  return false;
	}
	toTest = document.contactForm.terms.checked;
	if(toTest==false) {
	  bool = confirm("Do you agree with the Privacy Policy for this website?\n\nIf you agree, click 'OK'.");
	  if (bool!=true){
	  	document.contactForm.terms.focus();
		return false;
	  } else {
	  	document.contactForm.terms.checked = true;
		return true;		
	  }
	}
}
/*********** VISUAL NAV FUNCTION START *****************/
/*******************************************************/
//
//These function controls the nav rollovers
function navRollOver(what, to){
	if (to == "over"){
		//these 'className'(s) are in the CSS for this site.
		what.className = 'navOver';
		what.style.cursor = 'hand'; 
	} else {
		what.className = 'navUp';
		what.style.cursor = 'default'; 
	}
}
/************************ UI Functions *******************/
/*********************************************************/
// opens hidden help divs
popElements = Array();
function popit(id, isRollOver){
	// see if user has already rolled over element
	if (isRollOver == 1) {
		for (i=0;i<popElements.length;i++){
			if (popElements[i] == id){
				return;
			}
		}
		popElements.push(id);
	}
    popElement = document.getElementById(id);
	if (popElement.style.display == 'none'){
		popElement.style.display = 'block';
	} else {
		popElement.style.display = 'none';
	
	}
}

