function ENIGMA()
{
	// Debug the wiring.
	this.debug_wiring = 1; // 0 = off, 1 = on
	this.debug_string = "Kb  Pb  R   M   L   Rf  L   M   R   Pb\n"; // Init debug content string

	// Plaintext Alphabet
	this.plaintext = ".ABCDEFGHIJKLMNOPQRSTUVWXYZ";

	// Rotor Wiring
	this.arrRotors = new Array();
		this.arrRotors[1] = ".EKMFLGDQVZNTOWYHXUSPAIBRCJ"; // Rotor I
		this.arrRotors[2] = ".AJDKSIRUXBLHWTMCQGZNPYFVOE"; // Rotor II
		this.arrRotors[3] = ".BDFHJLCPRTXVZNYEIWGAKMUSQO"; // Rotor III
		this.arrRotors[4] = ".ESOVPZJAYQUIRHXLNFTGKDCMWB"; // Rotor IV
		this.arrRotors[5] = ".VZBRGITYUPSDNHLXAWMJQOFECK"; // Rotor V
		this.arrRotors[6] = ".JPGVOUMFYQBENHZRDKASXLICTW"; // Rotor VI
		this.arrRotors[7] = ".NZJHGRCXMYSWBOUFAIVLPEKQDT"; // Rotor VII
		this.arrRotors[8] = ".FKQHTLXOCBJSPDZRAMEWNIUYGV"; // Rotor VIII
		this.arrRotors["b"] = ".LEYJVCNIXWPBQMDRTAKZGFUHOS"; // M4 Greek Rotor "b" (beta)
		this.arrRotors["g"] = ".FSOKANUERHMBTIYCWLQPZXVGJD"; // M4 Greek Rotor "g" (gama)

	this.arrKnockpoints = new Array();
		this.arrKnockpoints[1] = new Array(17, 17); //   Q - one knockpoint (R I)
		this.arrKnockpoints[2] = new Array(5, 5);   //   E - one knockpoint (R II)
		this.arrKnockpoints[3] = new Array(22, 22); //   V - one knockpoint (R III)
		this.arrKnockpoints[4] = new Array(10, 10); //   J - one knockpoint (R IV)
		this.arrKnockpoints[5] = new Array(26, 26); //   Z - one knockpoint (R V)
		this.arrKnockpoints[6] = new Array(26, 13); // Z/M - two knockpoints (R VI)
		this.arrKnockpoints[7] = new Array(26, 13); // Z/M - two knockpoints (R VII)
		this.arrKnockpoints[8] = new Array(26, 13); // Z/M - two knockpoints (R VIII)

	// Reflectors "B" and "C" (inc M4 thin reflectors) Wiring
	this.arrReflector = new Array();
		this.arrReflector["b"] = ".YRUHQSLDPXNGOKMIEBFZCWVJAT"; // M3 B
		this.arrReflector["c"] = ".FVPJIAOYEDRZXWGCTKUQSBNMHL"; // M3 C
		this.arrReflector["b_thin"] = ".ENKQAUYWJICOPBLMDXZVFTHRGS"; // M4 thin B
		this.arrReflector["c_thin"] = ".RDOBJNTKVEHMLFCWZAXGYIPSUQ"; // M4 thin C

	this.usedletters = ""; // Used letters in the steckerbrett
	this.lastkeypressed = ""; // Keyboard key pressed
	this.counter = 0; // Number of letters entered for grouping

	this.inputmethod = "single";
}
/* OBJECT ----------------------------------------------------------
	Stores global variables and machine settings
   ----------------------------------------------------------------- */
OBJECT
Stores global variables and machine settings
OBJECT Stores global variables and machine settings
function ENIGMA()
{
	this.debug_wiring = 1; 
	this.debug_string = "Kb  Pb  R   M   L   Rf  L   M   R   Pb\n"; 
	this.plaintext = ".ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	this.arrRotors = new Array();
		this.arrRotors[1] = ".EKMFLGDQVZNTOWYHXUSPAIBRCJ"; 
		this.arrRotors[2] = ".AJDKSIRUXBLHWTMCQGZNPYFVOE"; I
		this.arrRotors[3] = ".BDFHJLCPRTXVZNYEIWGAKMUSQO"; II
		this.arrRotors[4] = ".ESOVPZJAYQUIRHXLNFTGKDCMWB"; V
		this.arrRotors[5] = ".VZBRGITYUPSDNHLXAWMJQOFECK"; 
		this.arrRotors[6] = ".JPGVOUMFYQBENHZRDKASXLICTW"; I
		this.arrRotors[7] = ".NZJHGRCXMYSWBOUFAIVLPEKQDT"; II
		this.arrRotors[8] = ".FKQHTLXOCBJSPDZRAMEWNIUYGV"; III
		this.arrRotors["b"] = ".LEYJVCNIXWPBQMDRTAKZGFUHOS"; 
		this.arrRotors["g"] = ".FSOKANUERHMBTIYCWLQPZXVGJD"; 
	this.arrKnockpoints = new Array();
		this.arrKnockpoints[1] = new Array(17, 17); 
		this.arrKnockpoints[2] = new Array(5, 5);   
		this.arrKnockpoints[3] = new Array(22, 22); 
		this.arrKnockpoints[4] = new Array(10, 10); 
		this.arrKnockpoints[5] = new Array(26, 26); 
		this.arrKnockpoints[6] = new Array(26, 13); 
		this.arrKnockpoints[7] = new Array(26, 13); 
		this.arrKnockpoints[8] = new Array(26, 13); 
	this.arrReflector = new Array();
		this.arrReflector["b"] = ".YRUHQSLDPXNGOKMIEBFZCWVJAT"; 
		this.arrReflector["c"] = ".FVPJIAOYEDRZXWGCTKUQSBNMHL"; 
		this.arrReflector["b_thin"] = ".ENKQAUYWJICOPBLMDXZVFTHRGS"; 
		this.arrReflector["c_thin"] = ".RDOBJNTKVEHMLFCWZAXGYIPSUQ"; 
	this.usedletters = ""; 
	this.lastkeypressed = ""; 
	this.counter = 0; 
	this.inputmethod = "single";
}
function ENIGMA ( ) { this . debug_wiring = 1 ; this . debug_string = "Kb  Pb  R   M   L   Rf  L   M   R   Pb\n" ; this . plaintext = ".ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; this . arrRotors = new Array ( ) ; this . arrRotors [ 1 ] = ".EKMFLGDQVZNTOWYHXUSPAIBRCJ" ; this . arrRotors [ 2 ] = ".AJDKSIRUXBLHWTMCQGZNPYFVOE" ; this . arrRotors [ 3 ] = ".BDFHJLCPRTXVZNYEIWGAKMUSQO" ; this . arrRotors [ 4 ] = ".ESOVPZJAYQUIRHXLNFTGKDCMWB" ; this . arrRotors [ 5 ] = ".VZBRGITYUPSDNHLXAWMJQOFECK" ; this . arrRotors [ 6 ] = ".JPGVOUMFYQBENHZRDKASXLICTW" ; this . arrRotors [ 7 ] = ".NZJHGRCXMYSWBOUFAIVLPEKQDT" ; this . arrRotors [ 8 ] = ".FKQHTLXOCBJSPDZRAMEWNIUYGV" ; this . arrRotors [ "b" ] = ".LEYJVCNIXWPBQMDRTAKZGFUHOS" ; this . arrRotors [ "g" ] = ".FSOKANUERHMBTIYCWLQPZXVGJD" ; this . arrKnockpoints = new Array ( ) ; this . arrKnockpoints [ 1 ] = new Array ( 17 , 17 ) ; this . arrKnockpoints [ 2 ] = new Array ( 5 , 5 ) ; this . arrKnockpoints [ 3 ] = new Array ( 22 , 22 ) ; this . arrKnockpoints [ 4 ] = new Array ( 10 , 10 ) ; this . arrKnockpoints [ 5 ] = new Array ( 26 , 26 ) ; this . arrKnockpoints [ 6 ] = new Array ( 26 , 13 ) ; this . arrKnockpoints [ 7 ] = new Array ( 26 , 13 ) ; this . arrKnockpoints [ 8 ] = new Array ( 26 , 13 ) ; this . arrReflector = new Array ( ) ; this . arrReflector [ "b" ] = ".YRUHQSLDPXNGOKMIEBFZCWVJAT" ; this . arrReflector [ "c" ] = ".FVPJIAOYEDRZXWGCTKUQSBNMHL" ; this . arrReflector [ "b_thin" ] = ".ENKQAUYWJICOPBLMDXZVFTHRGS" ; this . arrReflector [ "c_thin" ] = ".RDOBJNTKVEHMLFCWZAXGYIPSUQ" ; this . usedletters = "" ; this . lastkeypressed = "" ; this . counter = 0 ; this . inputmethod = "single" ; }
OBJECT
Stores global variables and machine settings
OBJECT Stores global variables and machine settings
// Debug the wiring. // 0 = off, 1 = on // Init debug content string // Plaintext Alphabet // Rotor Wiring // Rotor I // Rotor II // Rotor III // Rotor IV // Rotor V // Rotor VI // Rotor VII // Rotor VIII // M4 Greek Rotor "b" (beta) // M4 Greek Rotor "g" (gama) //   Q - one knockpoint (R I) //   E - one knockpoint (R II) //   V - one knockpoint (R III) //   J - one knockpoint (R IV) //   Z - one knockpoint (R V) // Z/M - two knockpoints (R VI) // Z/M - two knockpoints (R VII) // Z/M - two knockpoints (R VIII) // Reflectors "B" and "C" (inc M4 thin reflectors) Wiring // M3 B // M3 C // M4 thin B // M4 thin C // Used letters in the steckerbrett // Keyboard key pressed // Number of letters entered for grouping