// Developed and coded by SML Design
// Copyright © www.smldesign.com
// This code was tested and revised in 2005

function validateForm(){
  var RtnVal = true
  var x = 0
  
if(document){
  while (x < document.CustomerData.elements.length) {
  
    if(document.CustomerData.elements[x].type == 'text' || document.CustomerData.elements[x].type == 'select-one')
    document.CustomerData.elements[x].style.backgroundColor = "#FFFFFF";
    x++;
    }
}

if(!IsFieldComplete(document.CustomerData.elements["FirstName"]))  RtnVal = false;
if(!IsFieldComplete(document.CustomerData.elements["LastName"]))  RtnVal = false;						   									  
if(!IsFieldComplete(document.CustomerData.elements["Email"]))  RtnVal = false;
if(!IsFieldComplete(document.CustomerData.elements["PhoneA"]))  RtnVal = false;
if(!IsFieldComplete(document.CustomerData.elements["PhoneB"]))  RtnVal = false;
if(!IsFieldComplete(document.CustomerData.elements["PhoneC"]))  RtnVal = false;				   

				   
if (!RtnVal){
  if (document)
  alert('Please complete all fields indicated in red!');
  return RtnVal;
}
  
if (document.CustomerData.State.value=="Select") {
  alert("Your warning mesage goes here.");
  RtnVal = false;
  document.CustomerData.State.focus();
  return RtnVal;
  }
}


function IsFieldComplete(thisField){
  if (thisField.value == '' || thisField.value == ' '){
    if (document){
    thisField.style.borderStyle = "solid";
    thisField.style.borderWidth  = "1pt";
    thisField.style.borderColor = "#FF0000";
    thisField.style.color = "#000000";
  }
  return false;
}

if (document){
  thisField.style.borderStyle = "solid";
  thisField.style.borderWidth  = "1pt";
  thisField.style.borderColor = "#336699";
  thisField.style.color = "#000000";
  }
  return true;
}
