// VALIDATE THE FORM

function ChkPfContact(x) {

	if (x == 1)
	{
		document.myForm.time_to_call.disabled = false
	        document.myForm.name.style.backgroundColor = InputFormTextBoxInitialState
	}
	else
	{
		document.myForm.time_to_call.disabled = true
	        document.myForm.name.style.backgroundColor = InputFormTextBoxDisabledState
	}
};


// VALIDATE THE FORM
function ValidateContactMeForm() {

    document.myForm.name.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.title.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.address1.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.address2.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.city.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.state.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.postal.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.phone.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.fax.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.country.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.relationship.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.industry.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.how_did_you_hear.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.country.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.time_to_call.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.comments.style.backgroundColor = InputFormTextBoxInitialState
    document.myForm.email.style.backgroundColor = InputFormTextBoxInitialState

// VALIDATE NAME
  if (isWhitespace(document.myForm.name.value)==true) {
    document.myForm.name.style.backgroundColor = InputFormTextBoxHighight
    alert("Name can not be blank.  Please enter your Name.")
    document.myForm.name.focus()
    return false
  }

// VALIDATE TITLE
  if (document.myForm.title.value=="0") {
    document.myForm.title.style.backgroundColor = InputFormTextBoxHighight
    alert("Please select your title.")
    document.myForm.title.focus()
    return false
  }


// VALIDATE ADDRESS 1
  if (isWhitespace(document.myForm.address1.value)==true) {
    document.myForm.address1.style.backgroundColor = InputFormTextBoxHighight
    alert("Address can not be blank.  Please enter your Address.")
    document.myForm.address1.focus()
    return false
  }

// VALIDATE CITY
  if (isWhitespace(document.myForm.city.value)==true) {
    document.myForm.city.style.backgroundColor = InputFormTextBoxHighight
    alert("City can not be blank.  Please enter your City.")
    document.myForm.city.focus()
    return false
  }

// VALIDATE STATE
  if (isWhitespace(document.myForm.state.value)==true) {
    document.myForm.state.style.backgroundColor = InputFormTextBoxHighight
    alert("State can not be blank.  Please enter your State / Province.")
    document.myForm.state.focus()
    return false
  }

// VALIDATE country
  if (document.myForm.country.value == "0") {
    document.myForm.country.style.backgroundColor = InputFormTextBoxHighight
    alert("Country can not be blank.  Please enter your Country.")
    document.myForm.country.focus()
    return false
  }


// VALIDATE postal
  if (isWhitespace(document.myForm.postal.value)==true) {
    document.myForm.postal.style.backgroundColor = InputFormTextBoxHighight
    alert("Postal Code can not be blank.  Please enter your Postal Code.")
    document.myForm.postal.focus()
    return false
  }

// VALIDATE phone
  if (isWhitespace(document.myForm.phone.value)==true) {
    document.myForm.phone.style.backgroundColor = InputFormTextBoxHighight
    alert("Phone can not be blank.  Please enter your Phone number.")
    document.myForm.phone.focus()
    return false
  }


// VALIDATE EMAIL
  if (isWhitespace(document.myForm.email.value)==true) {
       	document.myForm.email.style.backgroundColor = InputFormTextBoxHighight
        alert("Email Address can not be blank.  Please enter a valid Email Address.")
       	document.myForm.email.focus()
        return false
  }

  if (isEmail(document.myForm.email.value)==false) {
	document.myForm.email.style.backgroundColor = InputFormTextBoxHighight
	alert("Email Address is invalid.  Please enter a valid Email Address.")
	document.myForm.email.focus()
	return false
     }


// VALIDATE relationship
  if (document.myForm.relationship.value=="0") {
    document.myForm.relationship.style.backgroundColor = InputFormTextBoxHighight
    alert("Relationship can not be blank.  Please enter your Relationship.")
    document.myForm.relationship.focus()
    return false
  }

// VALIDATE industry
  if (document.myForm.industry.value=="0") {
    document.myForm.industry.style.backgroundColor = InputFormTextBoxHighight
    alert("Industry can not be blank.  Please enter your Industry.")
    document.myForm.industry.focus()
    return false
  }

  if (document.myForm.time_to_call.disabled == false) {
	// VALIDATE time_to_call
	  if (document.myForm.time_to_call.value=="0") {
	    document.myForm.time_to_call.style.backgroundColor = InputFormTextBoxHighight
	    alert("Please specify the best time to call you.")
	    document.myForm.time_to_call.focus()
	    return false
	    }
  }

// VALIDATE how_did_you_hear
  if (document.myForm.how_did_you_hear.value=="0") {
    document.myForm.how_did_you_hear.style.backgroundColor = InputFormTextBoxHighight
    alert("Please tell us how you heard of Biondo Communications.")
    document.myForm.how_did_you_hear.focus()
    return false
  }

// VALIDATE SERVICES

    var checkbox_choices = 0;

    // Loop from zero to the one minus the number of checkbox button selections
    for (counter = 0; counter < document.myForm.services.length; counter++)
    {

	if (document.myForm.services[counter].checked) 
	{ 
		checkbox_choices = checkbox_choices + 1; 
	}
    	
    }
	if (checkbox_choices == 0)
        {
		alert("Please select at least one service you are intested in.")
		return false
	}


}



