// JavaScript Document

// on and off behaviors for rollover images 
if (document.images) 
{
	btn_submitoff = new Image();          btn_submitoff.src = "../images/btn_submit.gif";
	btn_submiton = new Image();           btn_submiton.src = "../images/btn_submit_roll.gif";
}

// to validate the form
function validateForm() 
{
	if (document.FORM.salutation[0].selected) {
        alert("Please select a Title.");
     	document.FORM.salutation.focus();
        return false;
	}
	if((document.FORM.firstname.value == "") || (document.FORM.firstname.value == null)) {
		alert('Please enter your First Name.');
		document.FORM.firstname.focus();
		return false;
	} 
	if((document.FORM.lastname.value == "") || (document.FORM.lastname.value == null)) {
		alert('Please enter your Last Name.');
		document.FORM.lastname.focus();
		return false;
	} 
	if (document.FORM.email.value == "" || document.FORM.email.value.indexOf("@") == -1 || document.FORM.email.value.indexOf(".") == -1) {
        alert("Please enter a proper email address (e.g. somebody@isp.com).");
     	document.FORM.email.focus();
        return false;
	}
	if((document.FORM.address1.value == "") || (document.FORM.address1.value == null)) {
		alert('Please enter your Address.');
		document.FORM.address1.focus();
		return false;
	} 
	if((document.FORM.city.value == "") || (document.FORM.city.value == null)) {
		alert('Please enter your City');
		document.FORM.city.focus();
		return false;
	} 
	if((document.FORM.state[0].selected) || (document.FORM.state.value == "") || (document.FORM.state.value == null)) {
        	alert("Please select your state.");
     		document.FORM.state.focus();
        	return false;
	}
	if((document.FORM.zip.value == "") || (document.FORM.zip.value == null)) {
		alert('Please enter your Postal Code.');
		document.FORM.zip.focus();
		return false;
	} 
	if (document.FORM.age[0].selected) {
        alert("Please enter your age.\nIf you are under the age of 18, please do not send us an e-mail, as we cannot reply.");
     	document.FORM.email.focus();
        return false;
	}	
	
}

// to open a pop-up window
function openWin(winName, url, w, h)
{
	var popup;
    if (popup != null && !popup.closed) 
	{
		popup.close();
    }
    var width = 535;
    var height = 520;
    if (arguments.length > 2) { width = w; }
    if (arguments.length > 3) { height = h; }
    if (arguments.length == 1) { url = ''; }
    var left = (screen.availWidth / 2) - (width / 2);
    var top = (screen.availHeight / 2) - (height / 2);
    popup = window.open(url, winName,'toolbar=0,scrollbars=1,resizeable=0,width=' +
width + ',height=' + height + ',top=' + top + ',left=' + left);
    popup.focus();
}