function validateRegisterUser(){
	
	var root = document.register_user;
	var username = root.username.value;
	var full_name = root.full_name.value;
	var email = root.email.value;
	var country_id = root.country_id.value;
	var city = root.city.value;
	var address = root.address.value;
	var password = root.password.value;
	var confirm_password = root.confirm_password.value;
	var zip_code = root.zip_code.value;
	
	if (username == '' || full_name == '' || email == '' || country_id == '' || city == '' || address == '' || password == '' || confirm_password == ''){
		alert('Please fill up all the required fields');
		return false;
	}
	
	var pass_length = root.password.value.length;
	
	if (pass_length < 6){
		alert('Your password must be a minimum of 6 characters.');
		root.password.focus();
		return false;
	}
	
	if (zip_code != '' && isNaN(zip_code)){
		alert('Please give a valid Zip Code');
		root.zip_code.focus();
		return false;
	}
	
	if (!isNaN(password)){
		alert('Your password must contain characters.');
		root.password.focus();
		return false;
	}
	
	if (password != confirm_password){
		alert('Your password and its confirmation do not match.');
		root.password.focus();
		return false;
	}
	password = hex_md5(password);
	confirm_password = hex_md5(confirm_password);
	root.password.value = password;
	root.confirm_password.value = confirm_password;
	root.hashed.value = '1';
	return true;
}

function validateEditProfile(){
	
	var root = document.edit_profile;
	var full_name = root.full_name.value;
	var email = root.email.value;
	var country_id = root.country_id.value;
	var city = root.city.value;
	var address = root.address.value;
	var zip_code = root.zip_code.value;
	
	
	if (full_name == '' || email == '' || country_id == '' || city == '' || address == ''){
		alert('Please fill up all the required fields');
		return false;
	}
	
	if(zip_code != '' && isNaN(zip_code)){
		alert('Please give a valid zip code');
		root.zip_code.focus();
		return false;
	}
	return true;
}
