function isFieldBlank(fValue,fName)
{

	if (fValue.value == "")
		{
		    alert("Please enter your "+fName+".");
			fValue.focus();
			return (true);
		}
}

function isString(fValue,fName)
{
	
	var checkOK = "-'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzӨՀыʬۘęæ܃Ώ泝 \t\r\n\f";
		var checkStr = fValue.value;
		var allValid = true;
		
		for (var i = 0;  i < checkStr.length;  i++)
		{
			ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
				if (ch == checkOK.charAt(j))
					break;
	    
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
		}
		
		if (!allValid)
		{
		    alert("Please enter only letter and whitespace characters in the '"+fName+"' field.");
			fValue.focus();
			return (true);
		}
}

function isNumber(fValue,fName)
{
	if (fValue.value.length < 8)
		{
		    alert("Please enter "+fName+".");
			fValue.focus();
			return (true);
		}
		
		var checkOK = "0123456789-+- \t\r\n\f";
		var checkStr = fValue.value;
		var allValid = true;
		
		for (i = 0;  i < checkStr.length;  i++)
		{
		    ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
				if (ch == checkOK.charAt(j))
					break;
					
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
		}

		if (!allValid)
		{
		    alert("Please enter "+fName+".");
			fValue.focus();
			return (true);
		}

}

function isEmail(fValue)
{

		var EmailOk  = true;
		var Temp     = fValue;
		var AtSym    = Temp.value.indexOf('@')
		var Period   = Temp.value.lastIndexOf('.')
		var Space    = Temp.value.indexOf(' ')
		var Length   = Temp.value.length - 1   // Array is from 0 to length-1

		if ((AtSym < 1) ||                     // '@' cannot be in first position
			(Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
			(Period == Length ) ||             // Must be atleast one valid char after '.'
			(Space  != -1))                    // No empty spaces permitted
		{  
	      EmailOk = false
	      alert('Please enter a valid e-mail address!')
	      Temp.focus()
		  return (true);
		}
	
}

function isSelected(fValue,fName)
{
	if (fValue.selectedIndex <= 0)
		{
		    alert("Please enter "+fName+".");
			fValue.focus();
			return true;
		}    
}

function isRadioChecked(fValue,fName)
{
if (!((fValue[0].checked)||(fValue[1].checked)))
		{
		    alert("Please specify whether '"+fName+"'.");
			fValue[0].focus();
			return (true);
		}
}

function isSelectDepend(fValue,fValue2,fName)
{
if ((fValue.checked)&&(fValue2.selectedIndex < 0))
		{
		    alert("Please enter "+fName+ "Cheque Account Held.");
			fValue2.focus();
			return (true);
		} 
}

function isAgentNumberOLDVERSION_NOT_USED(fValue){
	if (fValue.value !=""){
		var myacc = fValue.value;
 		myacc = myacc.toUpperCase();
		if (myacc.length !=8)
		{
			alert("Please enter your Customer Number in the correct format (e.g 12345678, AB123456 or 12AB3456 without any special characters or spaces).");
			fValue.focus();
			return (true);
		}
		var frstchar = myacc.substr(0,1);
		if (frstchar < "A" || frstchar > "Z")
		{
			alert("Please enter your Customer Number in the correct format (e.g A1234567 or a1234567).");
			fValue.focus();
			return (true);
		}
		var dgtchars = myacc.substr(1,myacc.length);
		var checkOK = "0123456789-+- \t\r\n\f";
		var checkStr = dgtchars;
		var allValid = true;
		
		for (i = 0;  i < checkStr.length;  i++)
		{
		    ch = checkStr.charAt(i);
			for (j = 0;  j < checkOK.length;  j++)
				if (ch == checkOK.charAt(j))
								break;
			if (j == checkOK.length)
			{
				allValid = false;
				break;
			}
		}
		if (!allValid)
		{
			alert("Please enter your Customer Number in the correct format (e.g 12345678, AB123456 or 12AB3456 without any special characters or spaces).");
			fValue.focus();
			return (true);
		}
		else
		{
			return (false);
		}
	}		
}

function isAgentNumber(fValue){
	if (fValue.value !=""){
		var myacc = fValue.value;
		var valid = myacc.search(/^[A-Za-z]\d{9}$/);
		if (valid != "0")
		{
			alert("Please enter your Customer Number in the correct format\n(e.g A123456789)\nwithout any special characters or spaces.");
			fValue.focus();
			return (true);
		}
		else
		{
			return (false);
		}
	}		
}


function isComment(fValue)
{
	if (fValue.value=="")
 {
  	alert("Don't forget to tell us what you want!");
	fValue.focus();
	return (true);
  }
}

function isCardBlank(fValue)
{
 if (fValue.value.length < 12)
  {
    alert("Please enter a valid credit card number.");
    fValue.focus();
    return (true);
  }
}
function isItemBlank(fValue)
{
	if (fValue==""){return (true)}
}
