// JavaScript Document

function isEmail(val)
{
        // Return false if e-mail field does not contain a '@' and '.' .
        if (val.indexOf ('@',0) == -1 || val.indexOf ('.',0) == -1)
        {
                return 1;
        }
        else
        {
                return 0;
        }
}



function contact_us(){ 

var contact_name=document.contact.contact_us_name.value;
var contact_email=document.contact.contact_us_email.value;
var contact_subj=document.contact.contact_us_subject.value;
var contact_details=document.contact.contact_us_details.value;

var  error=0;
	var error_message="There are following errors while filling the \ncontact Information Form?\n";
	
//Validation  Name	
	if(contact_name==""||(contact_name.length<3)) {
		error_message=error_message+"Invalid Name\n";
		      error = 1;
	}		
// Validation for email
        if (contact_email== "" || isEmail(contact_email)) {
                error_message = error_message + "Enter the correct Email address\n";
                error = 1;
        }	
// Validation for Subject
        if (contact_subj== (-1)) {
                error_message = error_message + "Please Enter the subject of Contact\n";
                error = 1;
        }		
// Validation for Filling Details
        if (contact_details== "" ) {
                error_message = error_message + "Please fill the contact details in least 30 letters\n";
                error = 1;
        }		       
	if (error == 1) {
                alert(error_message);
               return false;
        } 
		else {
                return true;
        }

}


