function loadPreset(strPre)
{
	if ( strPre.length > 0 ) {
		// Str format: m3;b;b123;AAAA;AAAA
		
		var strBeg = 0;
		var strEnd = strPre.length;
		var strVar = strPre.substring(strBeg,strEnd);

		var arrVars = strVar.split(";");

		var mac = arrVars[0]
		var ukw = arrVars[1];
		var rotors = arrVars[2];
		var rings = arrVars[3];
		var ground = arrVars[4];
	
		document.getElementById('enigma_type').value = mac;

		if (mac == "m4") {
			document.getElementById('use_reflector_thin').value = ukw;
		} else {
			document.getElementById('use_reflector').value = ukw;
		}

		document.getElementById('greek_no').value = rotors.charAt(0);
		document.getElementById('leftw_no').value = rotors.charAt(1);
		document.getElementById('middlew_no').value = rotors.charAt(2);
		document.getElementById('rightw_no').value = rotors.charAt(3);

		document.getElementById('greek_ring').value = rings.charAt(0);
		document.getElementById('leftw_ring').value = rings.charAt(1);
		document.getElementById('middlew_ring').value = rings.charAt(2);
		document.getElementById('rightw_ring').value = rings.charAt(3);

		document.getElementById('greek_set').value = ground.charAt(0);
		document.getElementById('leftw_set').value = ground.charAt(1);
		document.getElementById('middlew_set').value = ground.charAt(2);
		document.getElementById('rightw_set').value = ground.charAt(3);

		var n = 1;
		while (n <= 26) {
			document.getElementById('plug'+n).value = ""; 
			n++;
		}

		if (arrVars.length > 5) {
			var arrStecker = arrVars[5].split("-");
			var i = 0;
			while (i < arrStecker.length) {
				var a = arrStecker[i].charAt(0).toUpperCase();
				var b = arrStecker[i].charAt(1).toUpperCase();
				var an = ENIGMA.plaintext.indexOf(a);
				var bn = ENIGMA.plaintext.indexOf(b);
				document.getElementById('plug'+an).value = b;
				document.getElementById('plug'+bn).value = a;
				i++;
			}
		}
	}
}
/* FUNCTION --------------------------------------------------------
	Load a saved user preset
   ----------------------------------------------------------------- */
FUNCTION
Load a saved user preset
FUNCTION Load a saved user preset
function loadPreset(strPre)
{
	if ( strPre.length > 0 ) {
		var strBeg = 0;
		var strEnd = strPre.length;
		var strVar = strPre.substring(strBeg,strEnd);
		var arrVars = strVar.split(";");
		var mac = arrVars[0]
		var ukw = arrVars[1];
		var rotors = arrVars[2];
		var rings = arrVars[3];
		var ground = arrVars[4];
		document.getElementById('enigma_type').value = mac;
		if (mac == "m4") {
			document.getElementById('use_reflector_thin').value = ukw;
		} else {
			document.getElementById('use_reflector').value = ukw;
		}
		document.getElementById('greek_no').value = rotors.charAt(0);
		document.getElementById('leftw_no').value = rotors.charAt(1);
		document.getElementById('middlew_no').value = rotors.charAt(2);
		document.getElementById('rightw_no').value = rotors.charAt(3);
		document.getElementById('greek_ring').value = rings.charAt(0);
		document.getElementById('leftw_ring').value = rings.charAt(1);
		document.getElementById('middlew_ring').value = rings.charAt(2);
		document.getElementById('rightw_ring').value = rings.charAt(3);
		document.getElementById('greek_set').value = ground.charAt(0);
		document.getElementById('leftw_set').value = ground.charAt(1);
		document.getElementById('middlew_set').value = ground.charAt(2);
		document.getElementById('rightw_set').value = ground.charAt(3);
		var n = 1;
		while (n <= 26) {
			document.getElementById('plug'+n).value = ""; 
			n++;
		}
		if (arrVars.length > 5) {
			var arrStecker = arrVars[5].split("-");
			var i = 0;
			while (i < arrStecker.length) {
				var a = arrStecker[i].charAt(0).toUpperCase();
				var b = arrStecker[i].charAt(1).toUpperCase();
				var an = ENIGMA.plaintext.indexOf(a);
				var bn = ENIGMA.plaintext.indexOf(b);
				document.getElementById('plug'+an).value = b;
				document.getElementById('plug'+bn).value = a;
				i++;
			}
		}
	}
}
function loadPreset ( strPre ) { if ( strPre . length > 0 ) { var strBeg = 0 ; var strEnd = strPre . length ; var strVar = strPre . substring ( strBeg , strEnd ) ; var arrVars = strVar . split ( ";" ) ; var mac = arrVars [ 0 ] var ukw = arrVars [ 1 ] ; var rotors = arrVars [ 2 ] ; var rings = arrVars [ 3 ] ; var ground = arrVars [ 4 ] ; document . getElementById ( 'enigma_type' ) . value = mac ; if ( mac == "m4" ) { document . getElementById ( 'use_reflector_thin' ) . value = ukw ; } else { document . getElementById ( 'use_reflector' ) . value = ukw ; } document . getElementById ( 'greek_no' ) . value = rotors . charAt ( 0 ) ; document . getElementById ( 'leftw_no' ) . value = rotors . charAt ( 1 ) ; document . getElementById ( 'middlew_no' ) . value = rotors . charAt ( 2 ) ; document . getElementById ( 'rightw_no' ) . value = rotors . charAt ( 3 ) ; document . getElementById ( 'greek_ring' ) . value = rings . charAt ( 0 ) ; document . getElementById ( 'leftw_ring' ) . value = rings . charAt ( 1 ) ; document . getElementById ( 'middlew_ring' ) . value = rings . charAt ( 2 ) ; document . getElementById ( 'rightw_ring' ) . value = rings . charAt ( 3 ) ; document . getElementById ( 'greek_set' ) . value = ground . charAt ( 0 ) ; document . getElementById ( 'leftw_set' ) . value = ground . charAt ( 1 ) ; document . getElementById ( 'middlew_set' ) . value = ground . charAt ( 2 ) ; document . getElementById ( 'rightw_set' ) . value = ground . charAt ( 3 ) ; var n = 1 ; while ( n <= 26 ) { document . getElementById ( 'plug' + n ) . value = "" ; n ++ ; } if ( arrVars . length > 5 ) { var arrStecker = arrVars [ 5 ] . split ( "-" ) ; var i = 0 ; while ( i < arrStecker . length ) { var a = arrStecker [ i ] . charAt ( 0 ) . toUpperCase ( ) ; var b = arrStecker [ i ] . charAt ( 1 ) . toUpperCase ( ) ; var an = ENIGMA . plaintext . indexOf ( a ) ; var bn = ENIGMA . plaintext . indexOf ( b ) ; document . getElementById ( 'plug' + an ) . value = b ; document . getElementById ( 'plug' + bn ) . value = a ; i ++ ; } } } }
FUNCTION
Load a saved user preset
FUNCTION Load a saved user preset
// Str format: m3;b;b123;AAAA;AAAA