//declare images
var swapImages=["images/footer_contact.gif","images/footer_contact_on.gif","images/footer_sitemap.gif","images/footer_sitemap_on.gif","images/footer_disclaimer.gif","images/footer_disclaimer_on.gif","images/footer_privacy.gif","images/footer_privacy_on.gif"];
var imageRef=new Array();
var imageOnRef=new Array();
var count=0;
for(var i=0; i<swapImages.length-1; i+=2){
	imageRef[count]=new Image(); 
	imageRef[count].src = swapImages[i];
	imageOnRef[count]=new Image(); 
	imageOnRef[count].src = swapImages[i+1];
	count++;
}

function newWindow(page, width, height)
{
	newWindow=window.open(page,'media','width='+width+',height='+height+',top=100,left=100');
	newWindow.focus();
}

//execute the image swap
function swapOver(imgName,action) {
	var theIndex=imgName.substr(1);
	if(document.images) {
		if(action=="over"){
			document[imgName].src = imageOnRef[theIndex].src;
		} else {
			document[imgName].src = imageRef[theIndex].src;
		}
	}
}

//form validation
function validateAndSubmit() {
	var msg = "";
	var frm = document.forms.thisForm;

	if (!frm.firstname.value) msg += " - First Name\n";
	if (!frm.lastname.value) msg += " - Last Name\n";
	if (!frm.telephone.value) msg += " - Telephone Number\n";
	if (!frm.comment.value) msg += " - Question/Comment\n";
	if (!frm.email.value) {
		msg += " - Email Address\n";
	} else {
		if ((frm.email.value.indexOf("@", 1) == -1) || (frm.email.value.indexOf(".", 1) == -1)) {
			msg += " - valid Email address\n";
		}
	}

	if (msg) {
		window.alert("Please complete the following fields:\n" + msg);
		return false;
	} else {
		frm.submit();
		return true;
	}
}