function encrypt(str, pwd) {  if(pwd == null || pwd.length <= 0) {    alert("Please complete all required fields!");    return null;	}  var prand = "";  for(var i=0; i<pwd.length; i++) {    prand += pwd.charCodeAt(i).toString();	}  var sPos = Math.floor(prand.length / 5);  var mult = parseInt(prand.charAt(sPos) + prand.charAt(sPos*2) + prand.charAt(sPos*3) + prand.charAt(sPos*4) + prand.charAt(sPos*5));  var incr = Math.ceil(pwd.length / 2);  var modu = Math.pow(2, 31) - 1;  if(mult < 2) {    alert("Please complete all required fields!");    return null;	}  var salt = Math.round(Math.random() * 1000000000) % 100000000;  prand += salt;  while(prand.length > 10) {    prand = (parseInt(prand.substring(0, 10)) + parseInt(prand.substring(10, prand.length))).toString();	}  prand = (mult * prand + incr) % modu;  var enc_chr = "";  var enc_str = "";  for(var i=0; i<str.length; i++) {    enc_chr = parseInt(str.charCodeAt(i) ^ Math.floor((prand / modu) * 255));    if(enc_chr < 16) {      enc_str += "0" + enc_chr.toString(16);    } else enc_str += enc_chr.toString(16);    prand = (mult * prand + incr) % modu;	}  salt = salt.toString(16);  while(salt.length < 8)salt = "0" + salt;  enc_str += salt;  return enc_str;	}var EarlyDate 
		var NormDate 
		var RegNumber
		var RegFee
		var MyDate
		var TotalDue
		var GuestCt
		
		function Initalize(){
			NormDate = new Date();
			EarlyDate = new Date();
			NormDate.setFullYear(2003,3,15)
			EarlyDate.setFullYear(2003,1,15)
			MyDate = new Date();
			if (MyDate <= EarlyDate)
				RegFee = 500;
			else
				RegFee = 600;
			
			window.RegForm.RegDue.value = RegFee;
			RegNumber = MyDate.getDate() + "" + (MyDate.getMonth() + 1) + "" + MyDate.getFullYear() + "" + MyDate.getHours() + "" + MyDate.getMinutes() + "" + MyDate.getSeconds();
			window.RegForm.RegNum.value = RegNumber;
		}
		
		function SendForm(){
			if (ValidTransport() && ValidGuest() && ValidOther() && ValidRequired()){
				alert ("Registration is being submitted");
				RegForm.CardNumber1.value = encrypt(RegForm.CardNumber1.value, RegNumber)
				RegForm.CardNumber2.value = encrypt(RegForm.CardNumber2.value, RegNumber)
				RegForm.AnyFormCC.value = RegForm.Email.value
				alert(RegForm.AnyFormCC.value)
				TotalDue = (RegFee + ((RegForm.GuestCount.value) * 75));
				GuestCt = RegForm.GuestCount.value 
				RegForm.submit();
				ConfirmationPage();
				}		
		}
		
		function ValidTransport(){
			var Valid;
			Valid = true;				//Innocent until proven guilty
			if (!RegForm.Flying.checked && !RegForm.Driving.checked && !RegForm.Other.checked){
				Valid = false;
				alert ("You must specify a type of transportation");
				}
			return Valid
		}
		
		function ValidGuest(){
			var Valid;
			Valid = true;				//Innocent until proven guilty
			if (!RegForm.HasGuest.checked && !RegForm.NoGuest.checked && !RegForm.SeperatePay.checked){
				Valid = false;
				alert ("Guest information must be specified");
				}
			else if (RegForm.HasGuest.checked){
				if((parseInt(RegForm.GuestCount.value) <= 0) || (RegForm.GuestCount.value == "")){
					Valid = false;
					alert ("You have selected that you are bringing guests, but have not specified a valid number!")
					}
				}			
			return Valid;
		}
		
		function ValidOther(){
			var Valid;
			Valid = true;				//Innocent until proven guilty
			
			if (RegForm.Other.checked){
				if (RegForm.OtherDesc.value == ""){
					Valid = false;
					alert ("You must specify your other form of transportation!");
					}
				}
			return Valid;
		}
		
		function ValidRequired(){
			var Valid;
			Valid = true;				//Innocent until proven guilty
			if ((RegForm.LastName.value == "") || (RegForm.FirstName.value == "") || (RegForm.Address1.value == "") ||
				(RegForm.Organization.value == "") || (RegForm.City.value == "") || (RegForm.State.value == "") ||
				(RegForm.Country.value == "") || (RegForm.WorkPhone.value == "") || (RegForm.HomePhone.value == "") ||
				(RegForm.Email.value == "")){
					Valid = false;
					alert ("All fields indicated with (*) are required!");
				}
			return Valid;
		}
		
		function ResetNum(){
			window.RegForm.RegNum.value = RegNumber;
			alert("Registration Number should not be changed!");
		}
		
		function ResetReg(){
				window.RegForm.RegDue.value = RegFee;
				alert ("Registration Fee should not be changed!");
		}
		
		function Calculate(){
			if (RegForm.TotDue.value != (RegFee + ((RegForm.GuestCount.value) * 75))){
				alert ("Your total due has been recalculated based on your selections!");
			}				
			RegForm.TotDue.value = (RegFee + ((RegForm.GuestCount.value) * 75));
			RegForm.Authorized1.value = RegForm.TotDue.value; 
		}				function ConfirmationPage(){			document.write("<html><title>Confirmation Page</title><body>")			document.write("<center><b>Your Registration has been submitted!  You should receive confirmation soon</b></center><br>")			document.write("<table border=0 align=center><tr><td>You Registered on: </td><td>" + Date() + "</td></tr>")			document.write("<tr><td>Your Registration Fee is: </td><td>" + RegFee + "</td></tr>")			document.write("<tr><td>Guest Fees: </td><td>" + GuestCt * 75 + "</td></tr>")			document.write("<tr></tr>")			document.write("<tr><td>Total Fees: </td><td>" + TotalDue + "</td></tr></table>")			document.write("<center><br> Thank you for registering with Tri-Delta <br></center></body></html>")		}