function checkForm() {
 spattern = /^[\s]+$/        	

// User name
str=document.form2.txtUser.value	
	if (isEmpty(str)){
	    alert("Please enter a Username")
		document.form2.txtUser.focus();
		return false;
	}
	
	if (!isUName(str)){
		alert("Please enter your Username.")
		document.form2.txtUser.focus();
		return false;
	}     
	if (str.match(spattern)) {
		alert("Spaces are invalid. Please re-enter a Username")
		document.form2.txtUser.focus();
		return false;
	}
	

// Password
str=document.form2.txtPwd.value	
	if (isEmpty(str)){
	    alert("Please enter your Password")
		document.form2.txtPwd.focus();
		return false;
	}    
	
	if (!isValidPwd(str)) {
		alert("Please enter your Password.")
		document.form2.txtPwd.focus();
		return false;
	} 
	
return true;
}

function isEmpty(inputStr) {
	if ((inputStr == null) || (inputStr=="")) return true
	else return false
}


function isValidPwd(str) {
	if (str.lastIndexOf(" ") == -1) {
				return true;
	} else {
				return false;
	}
}

function isUName(str) {
	pattern = /^[a-zA-Z0-9_\.\,\-\s]+$/
	if (!str.match(pattern)) return false
	else return true;
}