function rollover (whichImage, state) {
	document.getElementById(whichImage).setAttribute("src","images/" + whichImage + "_" + state + ".gif");
}

function showPublisher() {
	alert("Sanofi Pasteur Inc.\n"
		+ "Discovery Drive\n"
		+ "Swiftwater, PA 18370"
		);
	return false;
}

var oValidate = {
    run:function(oF) {
        var bVal = true;
        var sError = "";

        //Required
        if( !this.valString(document.getElementById('doctor_name').value) ) {
            bVal = false;
            sError += "Please enter a valid name\n";
        }

        if( !this.valString(document.getElementById('facility_name').value) ) {
            bVal = false;
            sError += "Please enter a valid facility name\n";
        }

        if( document.getElementById('occupation').value == "" ) {
            bVal = false;
            sError += "Please select a health-care occupation\n";
        }

        if( !this.valTel(document.getElementById('phone_number').value) ) {
            bVal = false;
            sError += "Please enter a valid telephone number\n";
        }

        if( !this.valEmail(document.getElementById('email_address').value) )  {
            bVal = false;
            sError += "Please enter a valid email address\n";
        }

        //Not required
        if( this.trim(document.getElementById('fax_number').value) != '' && !this.valTel(document.getElementById('fax_number').value) ) {
            bVal = false;
            sError += "Please enter a valid fax number\n";
        }

        if( this.trim(document.getElementById('postal_code').value) != '' && !this.valZip(document.getElementById('postal_code').value) ) {
            bVal = false;
            sError += "Please enter a valid zip code\n";
        }

        if(!bVal) {
            alert(sError);
            return(bVal);
        }
    },

    valString:function(s) { return (!/[a-z \,\.\-]+/i.test(this.trim(s))) ? false : true; },
    valTel:function(s) { return (!/^[\d \-\.\)\(]+$/i.test(this.trim(s))) ? false : true; },
    valZip:function(s) { return (!/^\d{5}(\-\d{4})?$/i.test(this.trim(s))) ? false : true; },
    valEmail:function(s) { return (!/^[\w\.\-]+\@([\w+\-]+\.)+[a-z]{2,4}$/i.test(this.trim(s))) ? false : true; },

    trim:function(s) { return s.replace(/^\s+|\s+$/, ''); }
}
