// checkcart.js

function checkRequiredFields() {

	var msg = "";

	if ( document.form.ShipToName.value == "" ) {
		if ( msg == "" ) {
			document.form.ShipToName.focus();
		}
		msg = msg + "\r\tShip-To Name";
	}

	if ( document.form.ShipToAddress1.value == "" ) {
		if ( msg == "" ) {
			document.form.ShipToAddress1.focus();
		}
		msg = msg + "\r\tShip-To Address";
	}

	if ( document.form.ShipToCity.value == "" ) {
		if ( msg == "" ) {
			document.form.ShipToCity.focus();
		}
		msg = msg + "\r\tShip-To City";
	}

	if ( document.form.ShipToState.selectedIndex < 1 ) {
		if ( msg == "" ) {
			document.form.ShipToState.focus();
		}
		msg = msg + "\r\tShip-To State";
	}

	if ( document.form.ShipToZipCode.value == "" ) {
		if ( msg == "" ) {
			document.form.ShipToZipCode.focus();
		}
		msg = msg + "\r\tShip-To Zip Code";
	}

	if ( document.form.referredFrom.value == "" ) {
		if ( msg == "" ) {
			document.form.referredFrom.focus();
		}
		msg = msg + "\r\tHow you heard about us";
	}

	if ( !document.form.IdenticalAddresses.checked ) {
		if ( document.form.CustomerName.value == "" ) {
			if ( msg == "" ) {
				document.form.CustomerName.focus();
			}
			msg = msg + "\r\tBilling Name";
		}

		if ( document.form.CustomerAddress1.value == "" ) {
			if ( msg == "" ) {
				document.form.CustomerAddress1.focus();
			}
			msg = msg + "\r\tBilling Address";
		}

		if ( document.form.CustomerCity.value == "" ) {
			if ( msg == "" ) {
				document.form.CustomerCity.focus();
			}
			msg = msg + "\r\tBilling City";
		}

		if ( document.form.CustomerState.selectedIndex < 1 ) {
			if ( msg == "" ) {
				document.form.CustomerState.focus();
			}
			msg = msg + "\r\tBilling State";
		}

		if ( document.form.CustomerZipCode.value == "" ) {
			if ( msg == "" ) {
				document.form.CustomerZipCode.focus();
			}
			msg = msg + "\r\tBilling Zip Code";
		}
	}

	if ( msg == "" ) {
		return true;
	} else {
		alert( "You need to supply the following information before continuing:" + msg );
		return false;
	}
}
