﻿function CheckForm()
{
    var error = false;
    //check the required fields
    if ($("txtName").value == "")
    {
        $("nameError").className = "error";
        new Effect.Highlight("txtName");// {startcolor: '#003399', endcolor: '#ffffff'});
        $("txtName").focus();
        error = true;
    }
    else
    {
        $("nameError").className = "error hide";
    }
	
	//PracticeName
    if ($("txtPracticeName").value == "")
    {
        $("txtPracticeNameError").className = "error";
        new Effect.Highlight("txtPracticeName");// {startcolor: '#003399', endcolor: '#ffffff'});
        $("txtPracticeName").focus();
        error = true;
    }
    else
    {
        $("txtPracticeNameError").className = "error hide";
    }	
	
	//Phone number
    if ($("txtPhone").value == "")
    {
        $("txtPhoneError").className = "error";
        new Effect.Highlight("txtPhone");// {startcolor: '#003399', endcolor: '#ffffff'});
        $("txtPhone").focus();
        error = true;
    }
    else
    {
        $("txtPhoneError").className = "error hide";
    }		
	
    //email
    if ($("SentByPerson").value == "")
    {
        $("emailError").className = "error";        
        new Effect.Highlight("SentByPerson");//, {startcolor: '#003399', endcolor: '#ffffff'});
        $("SentByPerson").focus();
        error = true;
    }
    else
    {
        $("emailError").className = "error hide";
    }
    //check email validity
    if (!IsEmailValid($("SentByPerson").value))
    {
        $("emailNotValidError").className = "error";        
        new Effect.Highlight("SentByPerson");//, {startcolor: '#003399', endcolor: '#ffffff'});
        $("SentByPerson").focus();
        error = true;
    }
    else
    {
        $("emailNotValidError").className = "error hide";
    }
    //department - will never happen unless the dropdown list changes
    if ($("drpDepartment").value == "")
    {
        $("departmentError").className = "error";
        new Effect.Highlight("drpDepartment");//, {startcolor: '#003399', endcolor: '#ffffff'});
        $("drpDepartment").focus();
        error = true;
    }
    else
    {
        $("departmentError").className = "error hide";
    }
	
    //message
    if ($("txtMessage").value == "")
    {
        $("messageError").className = "error";
        new Effect.Highlight("txtMessage");//, {startcolor: '#003399', endcolor: '#ffffff'});
        $("txtMessage").focus();
        error = true;
    }
    else
    {
        $("messageError").className = "error hide";
    }
    return error;
}