//  Copyright (c) Golden Software Engineers Pty Ltd, 1997-2004, All rights reserved
function fnControlMark(oControl, bState){
if (bState)
{oControl.style.background = "#FFAAAA";
oControl.focus();
}
else
{oControl.style.background = "white";
}return true;
};
function fnValidateLength(oControl, nLength){
var sControl = oControl.value;
if (nLength <= sControl.length)
{fnControlMark(oControl, false);
return true;
}
else
{fnControlMark(oControl, true);
alert("The current field has too few characters. Minimum length is: " + nLength);
return false;
}};
function fnValidateEmail(oEmail){
var sEmail = oEmail.value;
var oGood = sEmail.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (oGood)
{fnControlMark(oEmail, false);
return true;
}fnControlMark(oEmail, true);
alert("An unrecognised email format.\n\nMake sure:\n  - There are no appending/trailing spaces.\n  - You use the '@' character once.  - You provide a valid email domain name.\n  - This field has some valid text and is not blank.");
return false;
};
function fnValidateText(oText){
var sText = oText.value;
var oGood = sText.match(/^[^\'\"\*\?\/\\\:\`\<\>\|\s]+[^\'\"\*\?\/\\\:\`\<\>\|]+[^\'\"\*\?\/\\\:\`\<\>\|\s]+$/gi);
if (oGood)
{fnControlMark(oText, false);
return true;
}fnControlMark(oText, true);
alert("Invalid Text Syntax.\n\nMake sure:\n  - There are no appending/trailing spaces.\n  - You do not use the characters ''', '\"', '*', '?', '/', '\\', ':', '`', '<', '>' and '|'.\n  - This field has some valid text (at least 3 characters) and is not blank.");
return false;
};
function fnValidatePhoneNumber(oPhoneNumber){
var sPhoneNumber = oPhoneNumber.value;
var oGood = sPhoneNumber.match(/^\+\d+(\d|\s|\(|\)|\-)*\d+$/gi);
if (oGood)
{fnControlMark(oPhoneNumber, false);
return true;
}fnControlMark(oPhoneNumber, true);
alert("Phone numbers must be provided in International format. For example: To phone Melbourne, Australia\nyour phone number would be written as +613 9886 6682.\n\nMake sure:\n  - There are no appending/trailing spaces.\n  - You use only characters '0'-'9', '-', '(', ')' and '<space>'.\n  - Your phone number begins with a '+' followed by country code and ends with a phone digit.\n  - This field has some valid text and is not blank.");
return false;
}