// JavaScript Document
numero=Math.random().toString();

function replace(string,text,by) {
// Replaces text with by in string
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function calculaMD5() {
	var pw=replace(document.form1.Password.value, 'ñ', 'n');
//	var pw=document.form1.Password.value;
	pw += numero;
	return calcMD5(pw);
}
function enviaMD5(hash) {
	document.form1.elements["cifrado"].value=hash;
	document.form1.elements["numero"].value=numero;
	document.form1.submit();
}
