function validate_contactform ( )
{
    valid = true;

    if ( document.contact_form.name.value == "" || document.contact_form.message.value == "" || document.contact_form.email.value == "" )
    {
        alert ( "Please make sure all details marked with * are complete." );
        valid = false;
    }   
    
    if(document.contact_form.message.value.length>400)
    {
        alert ( "Your message must be less than 400 characters." );
        valid = false;
    }
    

    return valid;
}

function isEmailValid(email)
{
	valid = true;
	
	apos = email.indexOf("@");
	dotpos = email.lastIndexOf(".");
	
	if (apos<1||dotpos-apos<2) 
	{
        valid = false;		
	}		
	
	return valid;
	
}


function validate_demo_form ( )
{
    valid = true;

    if ( document.demo_form.name.value == "" || document.demo_form.schoolname.value == "" || document.demo_form.schooltel.value == "" || document.demo_form.email.value == "" || document.demo_form.email2.value == "" || !isEmailValid(document.demo_form.email.value) || !isEmailValid(document.demo_form.email.value) || (document.demo_form.email.value != document.demo_form.email2.value) )
    {
        alert ( "There was a problem with your information...\n\nPlease make sure all details marked with * are complete, that your email address is correct, and the email address fields match." );
        valid = false;
    }       

    return valid;
}