// --------------------- ENCRYPT1 ---------------------
// this is the function that will be used to encrypt the password entered by the user
//it takes 1 argument: the password 
// returns output: the encrypted password.
// Description: For each character in the password 
//1- get the corresponding code value using "charCodeAt() "
//2- generate a random number(rnd) .
//3- calculate: code + rnd + 999 and store the result in Temp
//4- store the square of the random number in Temp1
//5- In the end, store Temp and Temp1 values alternatively into a single array Temp2 
//6- make a string output from the array Temp2. This will be the encrypted password.

var output= new String;
function Encrypt1(thePassword) {
if(!thePassword)
{alert ('you must enter your password')
exit}
Temp = new Array();
Temp1 = new Array();
Temp2 = new Array();
PassSize = thePassword.length;
for (i = 0; i < PassSize; i++) {
rnd = Math.round(Math.random() * 930) + 89;	// generate a random value
Temp[i] = thePassword.charCodeAt(i) + rnd + 999;	
Temp1[i] = rnd * rnd;
}
for (j = 0; j < PassSize; j++){
Temp2[2*j] = Temp[j];
Temp2[2*j+1] = Temp1[j];
}
output = Temp2.join(",");
return output;
}