var min=8;
var max=18;
var normal=12;

function increaseFontSize() {
   var p = document.getElementById('content').getElementsByTagName('*');
   for(i=0;i<p.length;i++) {
	  if(p[i].style.fontSize) {
		 var s = parseInt(p[i].style.fontSize.replace("px",""));
	  } else {
		 var s = normal;
	  }
	  if(s!=max) {
		 s += 1;
	  }
	  p[i].style.fontSize = s+"px"
   }

}

function decreaseFontSize() {
   var p = document.getElementById('content').getElementsByTagName('*');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = normal;
      }
      if(s!=min) {
         s -= 1;
      }
      p[i].style.fontSize = s+"px"
   }

}

function setFontSize() {
   var p = document.getElementById('content').getElementsByTagName('*');
   for(i=0;i<p.length;i++) {
      if(p[i].style.fontSize) {
         var s = parseInt(p[i].style.fontSize.replace("px",""));
      } else {
         var s = normal;
      }
      if(s!=min) {
         s = normal;
      }
      p[i].style.fontSize = s+"px"
   }  
}


function printPage() {
	window.print();
	return false;
}

function rollOver(id) {
	$(id).src = 'images/'+id+'_o.gif';
}

function rollOff(id) {
	$(id).src = 'images/'+id+'.gif';
}

function popUp(url) {
	var popUp = window.open(url+'?refer='+L10_SITE_URL+location.pathname,'emailWindow','width=420,height=400,location=no,menubar=no,scrollbars=no');
	return false;
}

function validateContactForm() {

	var emailMatchString = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
	var re = new RegExp(emailMatchString);

	var errorString = "Please supply the following before submitting:\n\n";
	var allOk = true;


	
	if (!document.contactForm.firstname.value) {
		errorString += "- First name is required\n";
		allOk = false;
	}
	if (!document.contactForm.lastname.value) {
		errorString += "- Last name is required\n";
		allOk = false;
	}
	if (!document.contactForm.organization.value) {
		errorString += "- Organization is required\n";
		allOk = false;
	}
	if (!document.contactForm.state.value) {
		errorString += "- State is required\n";
		allOk = false;
	}
	if (!document.contactForm.phone.value) {
		errorString += "- Phone is required\n";
		allOk = false;
	}
	if (!document.contactForm.email.value) {
		errorString += "- Email is required\n";
		allOk = false;
	}
	if (document.contactForm.email.value && !document.contactForm.email.value.match(re)) {
		errorString += "- Valid email is required\n";
		allOk = false;
	}
	if (!document.contactForm.comments.value) {
		errorString += "- Comments are required\n";
		allOk = false;
	}
	
	if (!allOk) {
		alert(errorString);
	}
	
	return allOk;

}
