/* Simple popup */

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=500,left = 0,top = 0');");
}

/* Simple rollover */
function chgImg(imgField,newImg) {
	if (document.images) {
		document[imgField].src=newImg
	}
}


/* External Links */

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;


/* Client-side form validation */

function validateContact()
{
	if (document.forms['mailForm'].realname.value == "" || (document.forms['mailForm'].realname.value.match(/([0-9]+)/gi)) )
	{
		alert("Please enter your first name. (Letters only)");
		document.forms['mailForm'].realname.focus();
		document.forms['mailForm'].realname.select();
		return false;
	}
	
	else if ( (document.forms['mailForm'].email.value == "") || (!document.forms['mailForm'].email.value.match(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi)) )
	{
		alert("Please be sure to enter a valid email address.\n(i.e. name@company.com)");
		document.forms['mailForm'].email.focus();
		document.forms['mailForm'].email.select();
		return false;
	}
	else 	if (document.forms['mailForm'].captcha_code.value == "")
	{
		alert("Please enter the code shown in the blue box.");
		document.forms['mailForm'].captcha_code.focus();
		return false;
	}
	else
	{
		return true;
	}
  }
