<!-- 
//cd3.js
function stopErrors() {
 return true;
}
window.onerror = stopErrors;

function selectAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}

defaultStatus = "Level 2"  

//*** THIS IS A HELP MESSAGE FUNCTION AND MUST NOT BE CHANGED ***
function help() {
  var m1,m2,m3,m4,m5,h;
  h="                	__________ Encrypt - Decrypt Help __________\n\n";
  m1="1) Enter text in the top text area."
  m2="2) Click the [Encrypt] button to encrypt it. Encrypted text will appear in the middle text area."
  m3="3) Copy the encrypted text and send or E-Mail it to your associate."
  m4="4) He must enter the encryped text in the bottom text area and click [Decrypt] to see the original message."
  m5="5) He can use the same method to send or E-Mail any message to you."
  alert(h+m1+"\n"+m2+"\n"+m3+"\n"+m4+"\n"+m5);
}
//*** HELP MESSAGE FUNCTION ENDS HERE ***//

var i,j;
var getc;
var len;
var num,alpha;

num=new Array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","00","##","$$");
/* BE CAREFUL, ADD NEW ITEM OF ONLY TWO CHARACTERS IN THE ARRAY ABOVE
YOU CAN CHANGE THE ITEMS ABOVE ACCORDINGLY YOURSELF,
BUT EACH ITEM SHOULD CONSIST OF TWO CHARACTERS ONLY */

alpha=new Array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"," ",".",",");


//********** ENCODER FUNCTION STARTS HERE ***********
function encode() {
  len=document.f1.ta1.value.length;
  document.f1.ta2.value="";
  for(i=0;i<len;i++) {
    getc=document.f1.ta1.value.charAt(i);
    getc=getc.toLowerCase();
    for(j=0;j<alpha.length;j++) {
      if(alpha[j]==getc) {
        document.f1.ta2.value+=num[j];
      }
    }
  }
}
//*******ENCODER FUNCTION ENDS HERE*******

//********* DECODER FUNCTION STARTS HERE *********

function decode() {
  len=document.f1.ta2.value.length;
  document.f1.ta3.value="";
  for(i=0;i<len;i++) {
    getc=document.f1.ta2.value.charAt(i)+document.f1.ta2.value.charAt(i+1);
    i=i+1;
    for(j=0;j<num.length;j++) {
      if(num[j]==getc) {
        document.f1.ta3.value+=alpha[j];
      }
    }
  }
}
//******* DECODER FUNCTION ENDS HERE *******

// -->
