function validate_password()
{
	var old_password = document.getElementById('old_password');
	var new_password = document.getElementById('new_password');
	var confirm_password = document.getElementById('confirm_password');
	var get_old_password = document.getElementById('get_old_password');
	
	
	valid = true;
	
	if( isConfirmPassword(confirm_password, "Required") )valid = false;
	if( isNewPassword(new_password, "Required") )valid = false;
	if( isOldPassword(old_password, "Required") )valid = false;
	if( isMatchOld(get_old_password,old_password, "- Old Password Incorrect") )valid = false;
	if( isMatchPassword(new_password,confirm_password, "Password do not match") )valid = false;
	
    return valid;
	
}

function validate_email()
{
	var email = document.getElementById('email');

	valid = true;
	
	if( isEmail(email, "Required") )valid = false;
	
    return valid;
	
}

function isEmail(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('email_validate').innerHTML = helperMsg;
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('email_validate').innerHTML = '';
	}
	
}

function isOldPassword(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('old_password_validate').innerHTML = helperMsg;
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('old_password_validate').innerHTML = '';
	}
	
}


function isNewPassword(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('new_password_validate').innerHTML = helperMsg;
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('new_password_validate').innerHTML = '';
	}
	
}

function isConfirmPassword(elem, helperMsg){
	if(elem.value.length == 0){
		document.getElementById('confirm_password_validate').innerHTML = helperMsg;
		elem.focus(); // set the focus to this input
		return true;
	}else {
		document.getElementById('confirm_password_validate').innerHTML = '';
	}
	
}

function isMatchOld(get_p, p, helperMsg)
{
	if(get_p.value != p.value){
		document.getElementById('get_old_password_validate').innerHTML = helperMsg;
		p.focus(); // set the focus to this input
		return true;
	}
	else {
		document.getElementById('get_old_password_validate').innerHTML = '';
	}
	
}

function isMatchPassword(new_p, confirm_p, helperMsg)
{
	if(new_p.value != confirm_p.value){
		document.getElementById('confirm_password_validate').innerHTML = helperMsg;
		confirm_p.focus(); // set the focus to this input
		return true;
	}
	else {
		document.getElementById('confirm_password_validate').innerHTML = '';
	}
	
}