// JavaScript Document
function checkMandatory()
{
	
	var error_string = "";
	var path2form = "window.document.getElementById('the_form')";
    // check the name field
    if (window.document.getElementById('the_form').name.value == "")
    {
        error_string += "-You must give your name.\n";
    }

	//check email
	var the_email = window.document.getElementById('the_form').email.value;
	var the_at = the_email.indexOf("@");
    var the_dot = the_email.lastIndexOf(".");
    var a_space = the_email.indexOf(" ");
    if ((the_at != -1) &&  // if there's an '@'
        (the_at != 0) &&  // and it's not at position 0
        (the_dot != -1) && // and there's a '.'
        (the_dot > the_at + 1) &&  // and something between the '@' and '.'
        (the_dot < the_email.length - 1) && // and something after the '.'
        (a_space  == -1))  // and there're no spaces
    	{
			
    	}  else {
        	    //alert("sorry, your email address is invalid!");
				error_string += "-You must enter a valid email address.\n";
    	}
		
	//check phone
	/*if (window.document.getElementById('the_form').phone.value.length < 10)
		{
			error_string += "-You must enter a 10-digit phone number.\n";
		}
	   */ 
	/*
	// check the message field
    if (window.document.the_form.message.value == "")
    {
        error_string += "-Please enter a message.\n";
    }*/
    if (error_string == "")
    {
		return true;
    } else {
        error_string = "We found the following ommisions in your form: \n\n" + error_string;
        alert(error_string);
        return false;
    } 
}
