if( document.all && !document.getElementById ) {
  document.getElementById = function(id) {
    return document.all[id];
  }
}
function strltrim() {
	return this.replace(/^\s+/,'');
}

function strrtrim() {
	return this.replace(/\s+$/,'');
}
 
function strtrim() {
	return this.replace(/^\s+/,'').replace(/\s+$/,'');
}

String.prototype.ltrim = strltrim;
String.prototype.rtrim = strrtrim;
String.prototype.trim = strtrim;
function submitContactForm() {
var formObj = document.forms[0]
if ( ! chkField( "UserFirstName" ) ) {
	formObj.UserFirstName.focus()
	alert("You must enter your First Name.");
	return(false);     
}
if ( ! chkField( "UserLastName" ) ) {
	formObj.UserLastName.focus()
	alert("You must enter your Last Name.");
	return(false);     
}
if ( ! chkField( "UserEmail" ) ) {
	formObj.UserEmail.focus()
	alert("You must enter your email address.");
	return(false);     
}
if ( ! chkEmailAddress( formObj.UserEmail.value ) ) {
	formObj.UserEmail.focus()
	alert("The specified email address does not appear to be formed correctly.");
	return(false);     
}
if ( ! chkField( "Subject" ) ) {
	formObj.Subject.focus()
	alert("You must enter a Subject.");
	return(false);     
}
if (formObj.Body.value.length == 0) {
	formObj.Body.focus()
	alert("You must enter your comments.");
	return(false);     
}
document.forms[0].submit()
}
function chkEmailAddress( emailaddress ) {
	if ( emailaddress.indexOf(' ') != -1 ) {
		return(false);     
	}
	if ( emailaddress.indexOf(',') != -1 ) {
		return(false);     
	}
	if ( emailaddress.indexOf('@') == -1 ) {
		return(false);     
	}
	if ( emailaddress.indexOf('.') == -1 ) {
		return(false);     
	}
	return(true)
}
function chkField( fldName ) {
	var fldval = eval("document.forms[0]." + fldName + ".value");
	if ( fldval == "" || fldval == null || fldval.length == 0 ) {
		return( false );     
	}
	var failed = true;
	
	for (i = 0;  i < fldval.length;  i++) {
		if ( fldval.charAt(i) > ' ' ) {
			failed = false;
			break;
		}
	}
	if ( failed ) {
		return(false);     
	}
	return( true )
}
function getRadioValue( radioObj ) {
	for ( var i=0; i < radioObj.length; i++ ) {
		if ( radioObj[i].checked ) {
	      	return( radioObj[i].value );
      	}
	}
     	return( '' );
}
function newWindow( sURL, sTitle, sWidth, sHeight) {
	var params = "'toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,menubar=yes,width=" + sWidth + ",height=" + sHeight + "'"
	window.open(sURL,sTitle,params)
}
