/****************************************************************************************
>> Global Scripts << 
*****************************************************************************************/
/*-------------------------------------------Loads in functions---*/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
/*-------------------------------------------Highlight current page using class name "active"---*/
function highlightPage() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("nav")) return false;
  var nav = document.getElementById("nav");
  var links = nav.getElementsByTagName("a");
  for (var i=0; i<links.length; i++) {
    var linkurl = links[i].getAttribute("href");
    var currenturl = window.location.href;
    if (currenturl.indexOf(linkurl) != -1) {
      links[i].className = "active";
      var linktext = links[i].lastChild.nodeValue.toLowerCase();
      //document.body.setAttribute("id",linktext);
    }
  }
}
addLoadEvent(highlightPage);
/*-------------------------------------------Form Validation---*/
function validate_email()
{
	// Text Fields
	if (document.alert._01_Name.value=="") {
		window.alert ("Please enter your name.");
		document.alert._01_Name.focus();
		return false;
	}
	// EMAIL
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.alert._02_Email.value)) {
		window.alert ("Please enter a valid email address (e.g., user@domain.com)");
		document.alert._02_Email.focus();
		return false;
	}
}