
function valid_contact() {
  var error_message = "Errors have occured during the process of your form.\n\nPlease make the following corrections:\n\n";
  var error_found = false;
  var error_special_found = false;
  var error_special_to = false;
  var error_field;
  var error_highlight;
  var checked = false;
	

  var first_name = document.contact.first_name.value;
  var last_name = document.contact.last_name.value;
  
  //var company = document.contact.company.value;//Added
  var subject = document.contact.subject.value;//Added
  
  var email = document.contact.email.value;
  var day_phone_a = document.contact.day_phone_a.value;
  var day_phone_b = document.contact.day_phone_b.value;
  var day_phone_c = document.contact.day_phone_c.value;
  var index = document.contact.hear.selectedIndex;
  var hear = document.contact.hear[index].value;
  var other = document.contact.other.value;
  var feedback = document.contact.feedback.value;
  


/* Required Field Check */
  
  /////////////////////////////////////////////////////////////////////////////////////////
  //// 								BILLING INFORMAYION 							   ////
  /////////////////////////////////////////////////////////////////////////////////////////
  //alert(document.contact.other.value);
  if ( hear!="I am currently a client" && hear!="Flyer" && hear!="Google" && hear!="Yahoo" && hear!="Referral" && hear!="none" && other != "") {
  	document.contact.hear[index].value = other;
  }
  
  if ( (first_name == '') || (first_name.length < 2) ) {
    error_message = error_message + "* First Name is Required\n";
	error_field = document.contact.first_name;
	document.contact.first_name.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.first_name.style.backgroundColor = "#FFFFFF";
  }
  
  if ( (last_name == '') || (last_name.length < 2) ) {
    error_message = error_message + "* Last Name is Required\n";
	error_field = document.contact.last_name;
	document.contact.last_name.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.last_name.style.backgroundColor = "#FFFFFF";
  }

  /*if ( (company == '') || (company.length < 2) ) {
    error_message = error_message + "* Company is Required\n";
	error_field = document.contact.company;
	document.contact.company.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.company.style.backgroundColor = "#FFFFFF";
  }*/
  
  if ( (subject == '') || (subject.length < 2) ) {
    error_message = error_message + "* Subject is Required\n";
	error_field = document.contact.subject;
	document.contact.subject.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.subject.style.backgroundColor = "#FFFFFF";
  }
  
  if ( (email == '') || (email.length < 2) ) {
    error_message = error_message + "* Email is Required\n";
	error_field = document.contact.email;
	document.contact.email.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.email.style.backgroundColor = "#FFFFFF";
  }
  
  if ( ((day_phone_a == '') || (day_phone_a.length != 3)) ||
  	   ((day_phone_b == '') || (day_phone_b.length != 3)) ||
	   ((day_phone_c == '') || (day_phone_c.length != 4))  ) {
    error_message = error_message + "* Contact Phone# is Required\n";
	error_field = document.contact.day_phone_a;
	document.contact.day_phone_a.style.backgroundColor = "#FF0000";
	document.contact.day_phone_b.style.backgroundColor = "#FF0000";
	document.contact.day_phone_c.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.day_phone_a.style.backgroundColor = "#FFFFFF";
	document.contact.day_phone_b.style.backgroundColor = "#FFFFFF";
	document.contact.day_phone_c.style.backgroundColor = "#FFFFFF";
  }
  
  if ( hear == "none" ) {
    error_message = error_message + "* How did you hear about us, is Required\n";
	error_field = document.contact.hear;
	document.contact.hear.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.hear.style.backgroundColor = "#FFFFFF";
  }
  //alert(hear);
  if ( hear!="I am currently a client" && hear!="Flyer" && hear!="Google" && hear!="Yahoo" && hear!="Referral" && hear!="none" ) {
	  if ( (other == '') || (other.length < 2) ) {
		error_message = error_message + "* Other is Required\n";
		error_field = document.contact.other;
		document.contact.other.style.backgroundColor = "#FF0000";
		error_found = true;
	  } else {
		document.contact.other.style.backgroundColor = "#FFFFFF";
	  }
  }
  
  if ( (feedback == '') || (feedback.length < 1) ) {
    error_message = error_message + "* Message field is Required\n";
    if(error_found == true) {
		error_field = document.contact.feedback;
	} else {
    	error_field = document.contact.feedback;
	}
	document.contact.feedback.style.backgroundColor = "#FF0000";
    error_found = true;
  } else {
  	document.contact.feedback.style.backgroundColor = "#FFFFFF";
  }
/* Required Field Check */

/* Validate Email */
  if(error_found){
  	error_special_message = "\nThe following are special validations:\n";
  } else {
 	error_special_message = "Errors have occured during the process of your form.\n\nPlease make the following corrections:\n\nThe following are special validations:\n";
  }

  /*
  reg1 = /[a-zA-Z]/; // not valid
  reg2 = /^[0-9]+(\.[0-9]{2})?$/; // valid
  if ( (reg1.test(amount)) || (!reg2.test(amount)) ) {
    error_special_message = error_special_message + "* Amount is not valid\n";
    if(error_found) {
		error_field = document.contact.amount;
	} else {
    	error_field = document.contact.amount;
	}
	document.contact.amount.style.backgroundColor = "#FF0000";
    error_special_found = true;
  } else {
  	document.contact.amount.style.backgroundColor = "#FFFFFF";
  }
  
  reg2 = /[0-9]/; // valid
  if ( (reg1.test(zip)) || (!reg2.test(zip)) ) {
    error_special_message = error_special_message + "* Zip Code is not valid\n";
    if(error_found) {
		error_field = document.contact.zip;
	} else {
    	error_field = document.contact.zip;
	}
	document.contact.zip.style.backgroundColor = "#FF0000";
    error_special_found = true;
  } else {
  	document.contact.zip.style.backgroundColor = "#FFFFFF";
  }
  */
 



  reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
  reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
  if ( (reg1.test(email)) || (!reg2.test(email)) ) {
    error_special_message = error_special_message + "* E-mail is not valid\n";
    if(error_found) {
		error_field = document.contact.email;
	} else {
    	error_field = document.contact.email;
	}
	document.contact.email.style.backgroundColor = "#FF0000";
    error_special_found = true;
  } else {
  	document.contact.email.style.backgroundColor = "#FFFFFF";
  }

/* Validate Email */

  if (error_found && !error_special_found) {
    alert(error_message);
    error_field.focus();
    return false;
  } else if (!error_found && error_special_found) {
    alert(error_special_message);
    error_field.focus();
    return false;
  } else if (error_found && error_special_found) {
    alert(error_message+error_special_message);
    error_field.focus();
    return false;
  } else {
    return true;
  }


}/* End Of Validate */
function enabledctrl() {
	var x=document.getElementById("hear")
	var option = x.selectedIndex;
	//alert(x.selectedIndex);
	if(document.contact.other.disabled == true && option == 6) {
		document.contact.other.disabled=false;
		document.contact.other.style.backgroundColor = "#fff";
		document.contact.other.style.color = "#000";
	} else {
		document.contact.other.style.backgroundColor = "#eee";
		document.contact.other.style.color = "#222";
		document.contact.other.disabled=true;
	}
}

/*function otherenabled() {
	if(document.contact.other.disabled) {
		document.contact.other.disabled=false;
		document.contact.other.style.backgroundColor = "#fff";
		document.contact.other.style.color = "#000";
	} 
}

function disableothers() {
 	if(!document.contact.other.disabled) {
		document.contact.other.style.backgroundColor = "#eee";
		document.contact.other.style.color = "#222";
		//document.contact.other.style.border = none;
		document.contact.other.disabled=true;
	}
}*/
