// <!--


// validation script for new customers
function VetNew()
{
var failed;

strFName = document.New.strFName.value;
strEmailVal = document.New.strEmail.value.indexOf("@")

switch(parseInt(document.New.captchaNumber.value))
    {
      case 1:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "KN5G9Q")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 2:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "D8KMJ5")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;        
      case 3:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "V6KQ7T")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 4:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "4VZP5T")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 5:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "X9DKPT")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 6:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "6Z7WF3")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 7:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "DG5DNQ")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;        
      case 8:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "685NY9")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 9:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "42CBHN")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      case 10:
        if (!(document.New.srtCaptcha.value.toUpperCase() == "6MPZ9V")){
           window.alert("Security String does not match image"); 
           return failed;
        }
        break;
      default:
        window.alert("Unknown Error");
    }


if (checkpresence(document.New.strFName)==true)
    {
      window.alert ("Please enter your forename !");
      document.New.strFName.focus();            
      return failed;
    }
else if(document.New.strFName.value.toUpperCase().match("HTTP://") == "HTTP://"){
    window.alert("Invalid forename");
    return failed;
}
else if(document.New.strFName.value.toUpperCase().match("WWW.") == "WWW."){
    window.alert("Invalid forename");
    return failed;
}


if (checkpresence(document.New.strSName)==true)
    {
     window.alert (strFName + " - Please enter your surname !");
     document.New.strSName.focus();            
     return failed;
     }
else if(document.New.strSName.value.toUpperCase().match("HTTP://") == "HTTP://"){
    window.alert("Invalid surname");
    return failed;
}
else if(document.New.strSName.value.toUpperCase().match("WWW.") == "WWW."){
    window.alert("Invalid surname");
    return failed;
}     
     
if (checkpresence(document.New.strAddress)==true)
     {
      window.alert (strFName + " - Please enter your address !");
      document.New.strAddress.focus();             
      return failed;
    }
else if(document.New.strAddress.value.toUpperCase().match("HTTP://") == "HTTP://"){
    window.alert("Invalid address");
    return failed;
}
else if(document.New.strAddress.value.toUpperCase().match("WWW.") == "WWW."){
    window.alert("Invalid address");
    return failed;
}        
    
if (checkpresence(document.New.strPostcode)==true)
     {
      window.alert (strFName + " - Please enter your postcode / ZIP !");
      document.New.strPostcode.focus();             
      return failed;
    }
if (document.New.strAddress.value.length > 200)
    {
       window.alert (" Number of characters entered has exceeded the maximum required which is 200 !");
       document.New.strAddress.focus();            
       failed = true;
       return false;
    }
if (checkpresence(document.New.strEmail)==true)
   {
       window.alert (strFName + " - Please enter your Email address !");
       document.New.strEmail.focus();            
       return failed;
   }  
   
if (strEmailVal == -1)
   {
      window.alert ( strFName + " - The email address entered is not valid !");
      document.New.strEmail.focus();
      return failed;
   }

if (document.New.strCountry.options[document.New.strCountry.selectedIndex].value == 0)
   {
      window.alert ("Please select a country from the options provided !");
      document.New.strCountry.focus();
      return failed;
   }

document.New.submit();
return failed;
}


// validation script for existing customers

function VetExisting()
{
var failed;

strEmailVal = document.Existing.strEmail.value.indexOf("@")

if (checkpresence(document.Existing.strEmail)==true)
   {
      window.alert (" Please enter your Email address !");
      document.Existing.strEmail.focus();            
      return failed;
   }
if (strEmailVal == -1)
   {
      window.alert (" The email address entered is not valid !");
      document.Existing.strEmail.focus();
      return failed;
   }

document.Existing.submit();
return failed;
}



// function which ensures required fields are not empty

function checkpresence(element)
{
  if(element.value == "")
  {
	return true;
  }
return false;
}


// sets the new customer form focus
function gotoname()
{
  document.New.strFName.focus();
  return true;
}

// sets the existing customer form focus
function gotoemail(element)
{
  element.focus();
  return true;
}
//-->
