function isNum(passedVal) {
	if(passedVal == ""){
		return false
	}
	for (i=0; i<passedVal.length; i++){
		if(passedVal.charAt(i)<"0"){
			return false
		}
		if(passedVal.charAt(i)>"9"){
			return false
		}
	}
	return true
}

function checkFieldsRegistration(Output) {
	missinginfo = "";
	if (document.form.FullName.value == ""){
		missinginfo += "\n     -  Full name"
	}
	if (document.form.Company.value == ""){
		missinginfo += "\n     -  Company"
	}
	if (document.form.Phone.value == ""){
		missinginfo += "\n     -  Telephone Number"
	}
	if ((document.form.email.value == "") || 
	(document.form.email.value.indexOf('@') == -1) || 
	(document.form.email.value.indexOf('.') == -1)) {
		missinginfo += "\n     -  Email address";
	}
	if (document.form.BillAddress.value == ""){
		missinginfo += "\n     -  Billing address"
	}
	if (document.form.BillZipCity.value == ""){
		missinginfo += "\n     -  Billing post code and city"
	}
	if (document.form.BillCountry.value == ""){
		missinginfo += "\n     -  Billing country"
	}
	if (document.form.PaymentMethod.value == "Credit Card"){
		if (document.form.CCHolder.value == ""){
			missinginfo += "\n     -  Credit Card Holder"
		}
		if (document.form.CCExpire.value == ""){
			missinginfo += "\n     -  Credit Card Expiration Date"
		}
		if (Output == "print"){
			if ((document.form.CCNo.value == "")||(!isNum(document.form.CCNo.value))){
				missinginfo += "\n     -  Credit Card Number"
			}
		}
		if (Output == "email"){
			if (document.form.CCNo.value != ""){
				missinginfo += "\n     -  Do not send Credit Card Number by insecure email - it has been removed. Please resubmit this form, then call us.";
				document.form.CCNo.value = "";
			}
		}
	}
	if (missinginfo != "") {
		missinginfo ="_____________________________\n" +
		"There was a problem with the following:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease alter and re-submit!";
		alert(missinginfo);
		return false
	}
		else return true
	}

function checkMailingFields() {
	missinginfo = "";
	if (document.form.realname.value == ""){
		missinginfo += "\n     -  Full name"
	}
	if (document.form.company.value == ""){
		missinginfo += "\n     -  Company"
	}
	if ((document.form.email.value == "") || 
	(document.form.email.value.indexOf('@') == -1) || 
	(document.form.email.value.indexOf('.') == -1)) {
		missinginfo += "\n     -  Email address";
	}
	if (missinginfo != "") {
		missinginfo ="_____________________________\n" +
		"There was a problem with the following:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease alter and re-submit!";
		alert(missinginfo);
		return false
	}
		else return true
	}
	
function checkFields(Output) {
	missinginfo = "";
	if (!isNum(document.form.QTY_IPG_EN2.value)) {
		missinginfo += "\n     -  Quantity of Inspection Planning guides (Second Edition) in English"
	}if (!isNum(document.form.QTY_TFDG_EN2.value)) {
		missinginfo += "\n     -  Quantity of Tube Failure guides (Second Edition) in English"
	}
	if (!isNum(document.form.QTY_TFDG_DE.value)) {
		missinginfo += "\n     -  Quantity of Tube Failure guides in German"
	}
	if (document.form.FullName.value == ""){
		missinginfo += "\n     -  Full name"
	}
	if (document.form.Company.value == ""){
		missinginfo += "\n     -  Company"
	}
	if (document.form.Phone.value == ""){
		missinginfo += "\n     -  Telephone Number"
	}
	if (document.form.ShipAddress.value == ""){
		missinginfo += "\n     -  Shipping address"
	}
	if (document.form.ShipZipCity.value == ""){
		missinginfo += "\n     -  Shipping post code and city"
	}
	if (document.form.ShipCountry.value == ""){
		missinginfo += "\n     -  Shipping country"
	}
	if (document.form.BillAddress.value == ""){
		missinginfo += "\n     -  Billing address"
	}
	if (document.form.BillZipCity.value == ""){
		missinginfo += "\n     -  Billing post code and city"
	}
	if (document.form.BillCountry.value == ""){
		missinginfo += "\n     -  Billing country"
	}
	if ((Output == "ccprint")||(Output == "ccemail")){
		if (document.form.CCHolder.value == ""){
			missinginfo += "\n     -  Credit Card Holder"
		}
		if (document.form.CCExpire.value == ""){
			missinginfo += "\n     -  Credit Card Expiration Date"
		}
	}
	if (Output == "ccprint"){
		if ((document.form.CCNo.value == "")||(!isNum(document.form.CCNo.value))){
			missinginfo += "\n     -  Credit Card Number"
		}
	}
	if (Output == "ccemail"){
		if (document.form.CCNo.value != ""){
			missinginfo += "\n     -  Do not send Credit Card Number by insecure email - it has been removed. Please resubmit this form, then call us.";
			document.form.CCNo.value = "";
		}
	}
	if (missinginfo != "") {
		missinginfo ="_____________________________\n" +
		"There was a problem with the following:\n" +
		missinginfo + "\n_____________________________" +
		"\nPlease alter and re-submit!";
		alert(missinginfo);
		return false
	}
		else return true
	}