// JavaScript Document
function openNewWindow(URLtoOpen, windowName, windowFeatures) {newWindow=window.open(URLtoOpen, windowName, windowFeatures); }

function reloadPage() { window.location.reload(); }	

function doMail(theLink, key){

    //Get the HREF tag. This includes the anti-spam 'key'
    var before = theLink.getAttribute('href');

    //If the anti-spam key is not found in the link, exit the function without doing anything
    //If the link is clicked more than once, this prevents the Javascript from throwing an error
    if(before.indexOf(key) == -1) return false;

    //Our new variable "addy" is a combination of the text that
    //comes BEFORE the key [0] and AFTER the key [1]
    var addy = before.split(key)[0] + before.split(key)[1];

    //Substitute the original link with the new link ("addy")
    theLink.href = addy;

}

function randomImage(banner){
	images = new Array(10);
	images[0] = "<img src='images/"+banner+"_01.jpg' alt='' />";
	images[1] = "<img src='images/"+banner+"_02.jpg' alt='' />";
	images[2] = "<img src='images/"+banner+"_03.jpg' alt='' />";
	images[3] = "<img src='images/"+banner+"_04.jpg' alt='' />";
	images[4] = "<img src='images/"+banner+"_05.jpg' alt='' />";
	images[5] = "<img src='images/"+banner+"_06.jpg' alt='' />";
	images[6] = "<img src='images/"+banner+"_07.jpg' alt='' />";
	images[7] = "<img src='images/"+banner+"_08.jpg' alt='' />";
	images[8] = "<img src='images/"+banner+"_09.jpg' alt='' />";
	images[9] = "<img src='images/"+banner+"_10.jpg' alt='' />";
	index = Math.floor(Math.random() * images.length); document.write(images[index]);
}
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";
 }
}
function imageSwitch() {
	if (document.images) document.getElementById('hire_us_button').src ="images/hire_us_over.jpg"; 
}
function imageReturn() {
	if (document.images) document.getElementById('hire_us_button').src ="images/hire_us_up.jpg"; 
}

window.onload = externalLinks;
window.onresize = reloadPage;
function cursorSet() {
	document.contactForm.emailAddress.focus();
	}
