function trim_all(strObjName){ 
	//this function removes the spaces from the variables
        var strObj = strObjName;
        var strRet = "";
        for (i = 0;i < strObj.length;i++)
        {
                if(strObj.charAt(i) != " " && strObj.charAt(i) != "")
                        strRet = strRet+strObj.charAt(i);
        }
        return strRet;
}

function checkform()
{
	var pEMAIL  = document.userlogin.username;
	var password = document.userlogin.loginpassword;
	var reEmail         = /^[0-9a-zA-Z_\.-]+\@[0-9a-zA-Z_\-]+\.[0-9a-zA-Z_\.-]*$/;
	
	
	if(trim_all(pEMAIL.value) == ""){
		document.getElementById('pEMAILalert').style.display='block';
		pEMAIL.focus();
		return false;
		
	}else if(!reEmail.test(pEMAIL.value)){
		document.getElementById('pEMAILalert').style.display='none';
		document.getElementById('pEMAILalert1').style.display='block';
		pEMAIL.focus();
		return false;	
	}else{
		document.getElementById('pEMAILalert').style.display='none';
		document.getElementById('pEMAILalert1').style.display='none';
	}
	if(trim_all(password.value) == ""){
		document.getElementById('passwordalert').style.display = 'block';
		password.focus();
		return false;
	}else{
		document.getElementById('passwordalert').style.display = 'none';
		}
	
	
	document.userlogin.updte.value = 1;
	
	return true;
	

}