
var pth= "http://www.ethicaltraveler.org/images/nav_";
// make sure these are in the same order as they appear in nav.inc
var imgArray = new Array('home', 'explore', 'act', 'news', 'register', 'contribute', 'about');
var imgOut = new Array();
var imgOver = new Array();

if (document.images){
	for (i=0;i<imgArray.length;i++){
		imgOut[i] = new Image();
		imgOut[i].src = pth + imgArray[i] + "_out.gif";
		imgOver[i] = new Image();
		imgOver[i].src = pth + imgArray[i] + "_over.gif";
	}
}

function rollOver(i){
	document.images[imgArray[i]].src = imgOver[i].src;
}

function rollOut(i){
	document.images[imgArray[i]].src = imgOut[i].src;
}

function newWin(URL) {
    newWin = window.open(URL, 'newWin', 'toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=650');
}     

function openWin(URL) {
    bioWin = window.open(URL, 'bioWin', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=450,left=20,top=20');
}     

function openWin2(URL) {
    articleWin = window.open(URL, 'articleWin', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=650,height=550,left=20,top=20');
}     

function openWin3(URL) {
    bookWin = window.open(URL, 'bookWin', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=650,height=450,left=20,top=20');
}     

function openWin4(URL) {
    letterWin = window.open(URL, 'letterWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=450,height=580,left=20,top=20');
}     

function openWin5(URL) {
    prWin = window.open(URL, 'prWin', 'toolbar=yes,location=yes,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=800,height=650,left=20,top=20');
}     

function clearFld(pField) {
	if (pField.value == "enter your email address") {
		pField.value = "";
	}
}

function submitRegForm(email) {
	var emailFilter = /^.+@.+\..{2,3}$/;
	if (email == '') { 
		alert ('Please enter your email address.');
	} else if (!(emailFilter.test(email))) { 
		alert ('Please enter a valid email address.');
	} else {
		document.signup_form.submit();
	}
	document.signup_form.email.focus();
}

function contribute() {
	opener.location.href = "https://www.earthisland.org/ethicaltraveler/contribute_cc.htm";
	window.close();	
}