//Registration validator
//Isuru Buddhike

//function validate_form(frm)
function validate(frm)
{
        if (frm.name.value == "" )
        {
                alert ( "Enter your Name" );
                frm.name.focus();
                return false;
        }
		if (frm.postal_address.value == "" )
        {
                alert ( "Enter your Postal Address" );
                frm.postal_address.focus();
                return false;
        }
		if (frm.contact_number.value == "" )
        {
                alert ( "Enter your Contact Number" );
                frm.contact_number.focus();
                return false;
        }
		var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
		if (frm.email.value == "" )
        {
                alert ( "Enter your Valid Email Address" );
				frm.email.focus();
                return false;
        }
		if (frm.email.value != "" )
        {
			if(frm.email.value.match(emailExp))
			{}
			else
			{
				alert("Email Address you entered is not valid!");
				frm.email.focus();
				return false;
			}
        }
		/*
		if (frm.country.selectedIndex == 0 )
        {
                alert ( "Please select your Country" );
                frm.country.focus();
                return false;
        }*/
		if (frm.comments.value == "" )
        {
                alert ( "Enter your Comment" );
                frm.comments.focus();
                return false;
        }
        return true;
}
