function trimstr(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


function ValidatePassword(){

	old_password = trimstr(document.getElementById("old_password").value);
	new_password = trimstr(document.getElementById("new_password").value);
	conf_password = trimstr(document.getElementById("conf_password").value);

	if(old_password ==""){
		alert("Old password field is required");
		return false;
	}else if(new_password ==""){
		alert("New password field is required");
		return false;
	}else if(conf_password ==""){
		alert("Confirm password field is required");
		return false;
	}else if(new_password != conf_password){
		alert("New and confirm password does not matched");
		return false;
	}else{
		return true;
	}
	
}
