/* This function checks the input fields prior to submitting form
   if there is a problem, the form will not be submitted until errors
   are corrected */

function check_form()
{
var d = contact;
var comment_ok = true;

var atsign = d.email.value.indexOf("@");
var dotsign = d.email.value.lastIndexOf(".");

if(d.fname.value == "" || d.fname.value.length < 2)
{
	comment_ok = false;
	alert("Please provide your first name");
}
else if(d.lname.value == "" || d.lname.value.length < 2)
{
	comment_ok = false;
	alert("Please provide your last name");
}

else if(d.email.value == "")
{
    alert("Please provide an email address");
    comment_ok = false;
}
else if(atsign == -1 || dotsign == -1 || d.email.value.length < 2)
{
        alert("Please provide a valid email address");
        comment_ok = false;
}


return comment_ok;
}

/* this function places cursor within the First Name textbox */
function FirstNameFocus()
{
    contact.firstname.focus();
}

/* This function clears the default text inside the comments box */

function cleartext(id)
{
    //var item = id;
    var d = document.getElementById(id);
    if(d.value != "")
    {
        d.value="";
    }
    
}

function ValidateLucille()
{
var ask = asklucille;
var comment_ok = true;

if(ask.fname.value == "")
{
	comment_ok = false;
	alert("Please provide your first name");
}
else if(ask.lname.value == "")
{
	comment_ok = false;
	alert("Please provide your last name");
}

else if(ask.myemail.value == "")
{
    alert("Please provide an email address");
    comment_ok = false;
}

else if(ask.myemail.value.indexOf("@") == -1 || ask.myemail.value.lastIndexOf(".") == -1)
{
    alert("Please provide a valid email address");
    comment_ok = false;
}

else if(ask.myquestion.value == "" || ask.myquestion.value == "ask your question here...")
{
    comment_ok = false;
    alert("Please provide a question or comment for Lucille to respond");
}

return comment_ok;
}

