// JavaScript Document
function check_form (form_name) {
    form = document.forms[form_name];
	//alert(form);
    
	tmp = form.elements['username'];
    if (tmp.value.length == 0) {
         alert ('User Name is empty');
         tmp.focus();
         return false;
    }
	
	tmp = form.elements['password'];
    if (tmp.value.length == 0) {
         alert ('Password is empty');
         tmp.focus();
         return false;
    }
	
	tmp = form.elements['cpassword'];
    if (tmp.value.length == 0) {
         alert ('Confirm Password is empty');
         tmp.focus();
         return false;
    }
	
	tmp = form.elements['firstname'];
    if (tmp.value.length == 0 || tmp.value.search (/^\s*$/) != -1) {
        alert ('Please fill firstname field correctly');
        tmp.focus();
        return false;
    }
    tmp = form.elements['lastname'];
    if (tmp.value.length == 0 || tmp.value.search (/^\s*$/) != -1) {
        alert ('Please fill lastname field correctly ');
        tmp.focus ();
        return false;
    }
   
    tmp = form.elements['email'];
    if ( (tmp.value.length == 0) || (tmp.value.search(/^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,3}$/) == -1 )){
        alert ('Incorrect email address');
        tmp.focus ();
        return false;
    }
    tmp = form.elements['parentname'];
    if (tmp.value.length == 0) {
         alert ('Parent Name is empty');
         tmp.focus();
         return false;
    }
	
	
    return true;
}