 
 /* GenerateType: ManualInput/AutoGenerate */
var Barcodes ='{DutNo:"DUT0",Barcodes:[{"Name": "SN1", "Enable": 1, "MaxLength": 17, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "SN2", "Enable": 1, "MaxLength": 17, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "IMEI1", "Enable": 1, "MaxLength": 15, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "IMEI2", "Enable": 1, "MaxLength": 15, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "WIFI", "Enable": 1, "MaxLength": 12, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "BT", "Enable": 1, "MaxLength": 12, "Validation": "", "GenerateType": "ManualInput", "Prefix": "", "InitBarCode": "", "EnableInputCheck": 1},' +
	'{"Name": "CU", "Enable": 0, "MaxLength": 16, "Validation": "", "GenerateType": "ManualInput", "Prefix": "123456", "InitBarCode": "", "EnableInputCheck": 1}' +
	']}';

 
var Settings = new Object();

function Init() {
	$('#DutNo').html(Settings.DutNo);
    for (var i=Settings.Barcodes.length-1; i>=0; i--) {
		if(Settings.Barcodes[i].Enable){

			$(".inputWrapper").prepend('<tr class="inputGroup">' +
				'<td class="BarcodeName">' + Settings.Barcodes[i].Name + ':</td>' +
				'<td>' +
					'<input type="text" class="BarcodeInputBox" id="' + Settings.Barcodes[i].Name + '" ' +
					'name="' + Settings.Barcodes[i].Name + '" ' +
					'sort="' + i +'" ' +
					//'Format="' + Settings.Barcodes[i].Format + '"' + 
					//'disabled=' + !bManualInput +
					'>' +
					/*'<span class="errorWrapper" id="' + Settings.Barcodes[i].Name + 'Error"></span>' +*/
				'</td>' +
			'</tr>');
			if(-1 == Settings.Barcodes[i].Name.search(/SN/g)){
				$("#"+ Settings.Barcodes[i].Name).attr("maxlength", Settings.Barcodes[i].MaxLength);
			}
			if(Settings.Barcodes[i].GenerateType == "ManualInput"){
				$("#"+ Settings.Barcodes[i].Name).attr("disabled", false);
				$("#"+ Settings.Barcodes[i].Name).focus();
			}
			else{
				$("#"+ Settings.Barcodes[i].Name).attr("disabled", true);
			}
		}
    }
}



$(function() {
	if (debug.DEBUG_IN_BROWSER) {
			Settings = eval("(" + Barcodes + ")");
        }
        else {
			Settings = AppHelp.LoadJson();
        }

	//Create input box
    Init();
});