
function validate(theform){
	//return true;
	if(!isValidDate(theform.frm_from_date.value)){
		theform.frm_from_date.focus();
		return false;
	}
	if(!isValidDate(theform.frm_to_date.value)){
		theform.frm_to_date.focus();
		return false;
	}
	if(isEmpty(theform.frm_comment.value)){
		alert("Please enter Comment.");
		theform.frm_comment.focus();
		return false;
	}
}
function user_validate(form){
	if(isEmpty(form.frm_username.value)){
		alert("Please enter User name.");
		form.frm_username.focus();
		return false;
	}
	if(isEmpty(form.frm_password.value)){
		alert("Please enter Password.");
		form.frm_password.focus();
		return false;
	}
}
function autoFocus(){
	here:
	for(j=0;document.forms[j]!= null;j++){ 
		for(i=0;i<document.forms[j].elements.length;i++){
			var inputType = document.forms[j].elements[i].type;
			if(inputType == 'text' || inputType == 'select-one' || inputType == 'password' || inputType == 'textarea' || inputType == 'file' ){
				document.forms[j].elements[i].focus(); break here;
			}
		} 
	}
}		
