<!--

//*************************************************************
// VALIDATE EMAIL
//*************************************************************
function validEmail( email ){
	var invalidChars = " /:~;|";

	if( email == "" ){
		return false;
	}

	for( var i=0; i < invalidChars; i++ ){
		var badChar = invalidChars.charAt( i );
		if( email.indexOf( badChar, 0 ) > -1 ){
			return false;
		}
	}

	var atPos = email.indexOf( "@", 1 );
	if( atPos == -1 ){
		return false;
	}

	if( email.indexOf( "@", atPos+1 ) > -1 ){
		return false;
	}

	var periodPos = email.indexOf( ".", atPos );
	if( periodPos == -1 ){
		return false;
	}

	return true;
}

//*************************************************************
// VALIDATE FORM
//*************************************************************
function validateForm( myForm ){
	if( myForm.rName.value == "" ){
		alert( "Please fill in your name." );
		myForm.rName.focus();
		return false;
	}

	if( myForm.rTitle.value == "" ){
		alert( "Please fill in your title." );
		myForm.rTitle.focus();
		return false;
	}
	if( myForm.rCo.value == "" ){
		alert( "Please fill in your company." );
		myForm.rCo.focus();
		return false;
	}

	if( myForm.rAddress1.value == "" ){
		alert( "Please fill in your address." );
		myForm.rAddress1.focus();
		return false;
	}
	if( myForm.rCity.value == "" ){
		alert( "Please fill in your city." );
		myForm.rCity.focus();
		return false;
	}

	var stateChoice = myForm.rState.selectedIndex;
	if( myForm.rState.options[ stateChoice ].value == "--" ){
		alert( "Please select the state your company is residing" );
		return false;
	}

	if( myForm.rZip.value == "" || myForm.rZip.value.length < 5 ){
		alert( "Please fill in your correct ZIP code." );
		myForm.rZip.focus();
		return false;
	}

	if( !validEmail( myForm.rEmail.value ) ){
		alert( "Please enter an e-mail address to be used as your login." );
		myForm.rEmail.focus();
		myForm.rEmail.select();
		return false;
	}

	if( myForm.rPassword.value == "" || myForm.rPassword.value.length < 3 ){
		alert( "Please enter a password that will be used as your user login." );
		myForm.rPassword.focus();
		myForm.rPassword.select();
		return false;
	}

	var contactOption = -1;
	for( var i=0; i < myForm.rContact.length; i++ ){
		if( myForm.rContact[ i ].checked ){
			contactOption = i;
		}
	}
	if( contactOption == 0 ){
		if( myForm.rPhone.value == "" || myForm.rPhone.value.length < 7 ){
			alert( "Please fill in your correct telephone number." );
			myForm.rPhone.focus();
			return false;
		}
	} else if( contactOption == 1 ){
		var methodOption = -1;
		for( i=0; i < myForm.rEmailMethod.length; i++ ){
			if( myForm.rEmailMethod[ i ].checked ){
				methodOption = i;
			}
		}
		if( methodOption == -1 ){
			alert( "You have selected to be contacted via e-mail,\nplease select the desired method of e-mail (HTML or text)" );
			return false;
		}
	} else {
		alert( "Please select the method you wish to be contacted." );
		return false;
	}

	if( myForm.rDescription.value.length == 0 ){
		alert( "Please fill in your description." );
		myForm.rDescription.focus();
		myForm.rDescription.select();
		return false;
	}

	return true;
}

//*************************************************************
// VALIDATE FORM RATE
//*************************************************************
function validateForm_rate( myForm ){
	if( !validateForm( myForm ) ){
		return false;
	}

	if( myForm.oCity.value == "" ){
		alert( "Please fill in the city of origin." );
		myForm.oCity.focus();
		myForm.oCity.select();
		return false;
	}

	var stateChoice = myForm.oState.selectedIndex;
	if( myForm.oState.options[ stateChoice ].value == "--" ){
		alert( "Please fill in the state of origin." );
		return false;
	}

	if( myForm.oZip.value.length < 5 ){
		alert( "Please fill in the zip code of origin." );
		myForm.oZip.focus();
		myForm.oZip.select();
		return false;
	}

	if( myForm.dCity.value == "" ){
		alert( "Please fill in the city of destination." );
		myForm.dCity.focus();
		myForm.dCity.select();
		return false;
	}

	var stateChoice = myForm.dState.selectedIndex;
	if( myForm.rState.options[ stateChoice ].value == "--" ){
		alert( "Please fill in the state of destination." );
		return false;
	}

	if( myForm.dZip.value.length < 5 ){
		alert( "Please fill in the zip code of destination." );
		myForm.dZip.focus();
		myForm.dZip.select();
		return false;
	}

	var codeChoice = myForm.rCode.selectedIndex;
	if( myForm.rCode.options[ codeChoice ].value == "--" ){
		alert( "Please select what type of shipment this is." );
		return false;
	}

	return true;
}

//*************************************************************
// VALIDATE FORM POD
//*************************************************************
function validateForm_pod( myForm ){
	if( !validateForm( myForm ) ){
		return false;
	}

	if( myForm.rShip_ack.value == "" || myForm.rShip_pro.value == "" ){
		alert( "Please fill in either an acknowledgment or Warren Pro number." );
		return false;
	}

	return true;
}

//*************************************************************
// VALIDATE FORM TRAILER
//*************************************************************
function validateForm_trailer( myForm ){
	return true;
}

//*************************************************************
// VALIDATE FORM 5 DAY
//*************************************************************
function validateForm_5day( myForm ){
	return true;
}

//*************************************************************
// VALIDATE FORM WAREHOUSE
//*************************************************************
function validateForm_warehouse( myForm ){
	return true;
}

//*************************************************************
// VALIDATE FORM SPS
//*************************************************************
function validateForm_sps( myForm ){
	return true;
}

// -->
