function ClearForm() {
	document.FLA.value = "";
	document.CPK.value = "";
	document.HRS.value = "";
	document.V.value = "";
	return true;
}



function process(oForm) {	
	for (var i=0; i < oForm.method.length; i++) {
	   if (oForm.method[i].checked) {
	      var rad_val = oForm.method[i].value;
	   }
	}
	var why = "";
	why += checkloadNAME(oForm.loadNAME.value);
	why += checkloadQTY(oForm.loadQTY.value);
	why += checkmethod(rad_val);
		if (rad_val == 'KW') {
			why += checkKW(oForm.KW.value);
		} else if (rad_val == 'HP') {
			why += checkHP(oForm.HP.value);
		} else if (rad_val == 'VAP') {
			why += checkP(oForm.P.value);
			why += checkAMPS(oForm.AMPS.value);
			why += checkVOLTS(oForm.VOLTS.value);
		}
	why += checkHRS(oForm.HRS.value);
	why += checkeCost(oForm.eCost.value);
	why += checkSavings(oForm.Savings.value);

    if (why != "") {
       alert(why);
       return false;
    }
}
function IsNumeric(sText) {
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
}


function checkloadNAME (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a Name for the load.\n";
	}
	return error;
}
function checkmethod (strng) {
	var error = "";
	if ((strng == "")||(strng == undefined)) {
		error = "You didn't select a load method.\n";
	}
	return error;
}
function checkloadQTY (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for the QTY of Loads.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The Load QTY must be a number.\n";
	}
	return error;
}
function checkSavings (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Percentage Savings.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The Percentage Savings must be a number.\n";
	}
	return error;
}
function checkeCost (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Cost per Kilowatt.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The Cost per Kilowatt must be a number.\n";
	}
	return error;
}
function checkHRS (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Hrs / Week.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The HRS / Week must be a number.\n";
	}
	return error;
}
function checkKW (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Kilowatts.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The amount of Kilowatts must be a number.\n";
	}
	return error;
}
function checkHP (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for HP.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The amount of Horsepower must be a number.\n";
	}
	return error;
}
function checkP (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Phases.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The Phases must be a number.\n";
	}
	return error;
}
function checkVOLTS (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Volts.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The amount of Volts must be a number.\n";
	}
	return error;
}
function checkAMPS (strng) {
	var error = "";
	if (strng == "") {
		error = "You didn't enter a value for Amps.\n";
	} else if (IsNumeric(strng) == false) {
		error = "The amount of Amps must be a number.\n";
	}
	return error;
}
