// JavaScript Document

function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}

//VALIDATION FORM

function getInfo(form) {

customerInfoForm.info.value = "Browser Information: " + navigator.userAgent;

}

function fixElement(element, message) {

alert(message);

element.focus();

}


function isMailReady(customerInfoForm) {

var passed = false;

if (customerInfoForm.userName.value == "" || customerInfoForm.userName.value == "* Name") {

	fixElement(customerInfoForm.userName, "Please fill your name");

}

else if (customerInfoForm.userPhone.value == "* Phone") {

	fixElement(customerInfoForm.userPhone, "Please fill your phone number");

}

else if (customerInfoForm.userEmail.value.indexOf("@") == -1 || customerInfoForm.userEmail.value.indexOf(".") == -1) {

	fixElement(customerInfoForm.userEmail, "Please add a valid email address");

}



else {

getInfo(customerInfoForm);

passed = true;

}

return passed;

}