function isNotEmpty(pString){
	var sCrit = /.+/;
	if(!pString.match(sCrit)){
		return false;	
	}else{
		return true;
	}
}
function isNumeric(pString){
	var iPrice = parseFloat(pString);
	if(isNaN(iPrice)){
		return false;
	}else{
		return true;
	}
}
function validate_form(){
	var sError = "";
// Get Elements
	var amount = document.getElementById("amount");
	var ref = document.getElementById("ref");
	var sref = ref.value.toString();	
// Validate
	if(!isNotEmpty(amount.value)){
		sError += "* Amount\n\n";	
	}else if(!isNumeric(amount.value)){
		sError += "* Amount\n\n";
	}
	if(!isNotEmpty(ref.value)){
		sError += "* Reference Number \n\n";	
	}else if(sref.length > 12){
		sError += "* Reference Number Invalid\n\n";	
	}	
// Check for Error	
	if(sError){
		alert(CreateMessage(sError));
		return false;
	}else{
		return true;	
	}
}
function CreateMessage(pString){
	var sMsg="The form cannot be submited because the following fields are either mandatory or invalid\n\n";
	sMsg+=pString;
	sMsg+="\n\nPlease correct the above fields and re-submitted the form";
	return sMsg;
}