function hash(string, key){
	return binl2b64(str2binl(des (key, string, 1, 0)));
}

function setHashPassword(hash, hashfield, passwordfield, controlPasswordField){
	document.getElementById(hashfield).value = hash;
	document.getElementById(passwordfield).value = '';
	document.getElementById(controlPasswordField).value = '';
}

function hashPassword(hashfield, passwordfield, controlPasswordField, key){
	var password = document.getElementById(passwordfield).value;
	setHashPassword(hash(password, key), hashfield, passwordfield, controlPasswordField);
}


function checkPassword(p1, p2, messagefield){
	var v1 = document.getElementById(p1).value;
	var v2 = document.getElementById(p2).value;

    if (v1 != v2 || (v1 == '' && v2 == ''))
    {
       document.getElementById('signupmessage').innerHTML = 'Je controle wachtwoord is niet hetzelfde als je wachtwoord';
	   return false;
    }

    return true;
}