//Global variable set at start of script
var emptyString = "Please enter a valid "

function isChecked(object) {
    if (object.checked)
     {  return true }
    else
{
  alert("You have not read and agreed with the policies of FarsonsDirect.com. Please do so and then tick the checkbox at the begining of the form.")
  return false;
}
}

function validateString(myfield, s) {

 if (myfield.value.length > 0 )
   { return true }
	else {
		myfield.focus()
		alert(emptyString + s)
		return false
	}
}

function greaterthan3(myfield, s) {

 if (myfield.value.length > 3)
   { return true }
	else {
		myfield.focus()
		alert("The " + s + " must be more than 3 characters long")
		return false
	}
}

function is_nonEmpty_PhoneNum(theElement, theElementName)
{
  var s
  var l
  s = theElement.value;
  if ( (s == "") || (isNaN(Math.abs(s))) || (s.length < 6)  )
  {
    alert( theElementName +  " must be made up of at least 6 digits." );
    theElement.focus(); 
    return false;
  }
  return true;
}


function validateEmail(s)
{


if ((s == "" || s.value.indexOf('@', 0) == -1) || s.value.indexOf('.') == -1) 

     			{
                         s.focus()
		         alert("Please enter a valid E-mail Address")
		         return false
			}
         else {
      		return true
              }
}


function checkTheSame(s1,s2,comment)
{

if (s1.value == s2.value)

{
     return true
} 

else {
       s1.focus()
       alert(comment)
       return false
      }
}


function is_nonEmpty_CardNum(theElement, theElementName)
{
  var s
  var l
  s = theElement.value;
  if ((s == "") || (isNaN(Math.abs(s))))
  {
    alert(theElementName +  " must be made up of digits only.");
    theElement.focus(); 
    return false;
  }
  return true;
}
