function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

function validate(x)
{
 var msgs = "\n";

 if (document.form1.first_name.value.length < 1)
 {
  msgs = msgs + "Please enter a first name\n";
 }
 if (document.form1.last_name.value.length < 1)
 {
  msgs = msgs + "Please enter a last name\n";
 }
 if (document.form1.email_address.value.length < 1)
 {
  msgs = msgs + "Please enter an email address\n";
 }
 if (document.form1.email_address.value.indexOf("@") < 0 ||
 document.form1.email_address.value.indexOf(".") < 0)
 {
  msgs = msgs + "Please enter a valid email address\n";
 }
 if (document.form1.homeloc.value.length < 1)
 {
  msgs = msgs + "Please enter your home location\n";
 }
 if (document.form1.un.value.length < 1)
 {
  msgs = msgs + "Please enter your desired username\n";
 }
if (document.form1.pass.value.length < 1)
{
  msgs = msgs + "Please enter your password\n";
}
if (document.form1.pass2.value.length < 1)
{
  msgs = msgs + "Please enter your password confirmation\n";
}
if (document.form1.pass.value != document.form1.pass2.value)
{
  msgs = msgs + "Passwords do not match\n";
}

//CHECK TO SEE IF THERE ARE ANY ERRORS, IF SO, DISPLAY MESSAGE
if(msgs != "\n") {
	alert("There is either missing or invalid data in the following fields:\n\n" +
	msgs + "\nPlease complete the data in this form before continuing!");
} else {
	document.form1.submit();
	//return;
}
}
