<!--
/*
Description : Form validation...
Date		 : 15/05/2002
Author		 : mandogroup ltd ©
History     : JR - Initial Build
Version     : V1.01 - original release
*/

//check for empty fields...
function EmptyField(aFields) {
var bRet = false;
var i = 0;

	for (i=0;i<=aFields.length;i++) {
		if (aFields[i]=='') {
			bRet = true;
			break;
		}
	}
	return(bRet);
}
// Check if the email address is valid...
function ValidateEmail(strEmail){
	var strAt = strEmail.indexOf('@')
	var strDot = strEmail.lastIndexOf('.') 
	var intLength = strEmail.length - 1 
	if ((strAt < 1) || (strDot <= strAt+1) || (strDot == intLength ))
	{ 
		return(false);
	} 
	else
	{
		return(true);
	}
}
// Check if a price is valid...(AL P - 06/08/2003)
function ValidateMoney(price){
var re = /^\£?[0-9]+(\.[0-9]{1,2})?$/.exec(price);
	if (re == null){
		alert("Price or Discount are not in a valid currency format")
		return (false);
    }else{
		return(true);
	}
}
// Check if the date is valid...(AL P - 06/08/2003)
function ValidateDate(dteDate){
var bValid = false; 
var aMatch = /^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/.exec(dteDate); 

	if(aMatch == null){
		alert(dteDate + " is not in dd/mm/yy or dd/mm/yyyy format."); 
	}else{ 
		var oDate = new Date(aMatch[3], --aMatch[2], aMatch[1]); 
		if (aMatch[3] != oDate.getYear() && aMatch[3] != oDate.getFullYear() || aMatch[2] != oDate.getMonth()){
			alert(dteDate + " has the right format, \n" + "but is not a valid calendar date."); 
		}else{
			bValid = true; 
		} 
	}
	return bValid; 
}

//-->
