var strDomain = "yahoo.com"
var strTag1 = "mail"
var strTag2 = "to:"

function create_email_link(strName, strEmail) {
	document.write("<a href='" + strTag1 + strTag2 + strEmail + "@" + strDomain + "'>" + strName + "</a>");
}

function validate(form){

var why = "";


    why += checkName(form.name.value);
    why += checkPhone(form.phone.value);
    why += checkEmail(form.email.value);
    why += checkMessage(form.message.value);


if (why != "") {
       alert(why);
       return false;
    } 
return true;


}



// phone number - strip out delimiters and check for 10 digits

function checkPhone (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a phone number.\n";

}

var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
    if (isNaN(parseInt(stripped))) {
       error = "The phone number contains illegal characters.";
if (strng == "") {
   error = "You didn't enter a phone number.\n";

}
  
    }
    if (stripped.length < 10) {
	error = "The phone number is the wrong length. Please include an area code.\n";
    } 

return error;
}

function checkEmail (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a valid email address.\n";
}
return error;
}

function checkMessage (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter message.\n";
}
return error;
}



function checkName (strng) {
var error = "";
if (strng == "") {
   error = "You didn't enter a name.\n";
}

return error;
}     


