
function setEditorScripts(name, div, editor){
	
	var eol = '\\r';
	ng[name] = {};

	$(div).find('.ip-button').click(function(){
		window.websocket.emit('message', {command: 'discover'}, noop);
	});
	
	$(div).find('.command-select')[0].onchange = function(){
		ng[name] = {};
		ng[name].textbox1 = ng[name].textbox2 =
		ng[name].textbox3 = false;
		ng[name].select1 = ng[name].select2 = 
		ng[name].select3 = ng[name].select4 = false;
		ng[name].file1 = false;
		$(div).find('.select1')[0].onchange = $(div).find('.select2')[0].onchange =
		$(div).find('.select3')[0].onchange = $(div).find('.select4')[0].onchange = noop;
		switch ($(div).find('.command-select').val()){
			case 'require':
				ng[name].select1 = [];
				for (var i=0; i<manufacturerlist.length; i++){
					ng[name].select1.push(
						{value: manufacturerlist[i], text: manufacturerlist[i]}
					);
				}
				$(div).find('.select1')[0].onchange = function(){
					ng[name].select2 = [];
					for (var i=0; i<modulelist.length; i++){
						if (modulelist[i].manufacturer == $(div).find('.select1').val())
							ng[name].select2.push(
								{value: modulelist[i].file, text: modulelist[i].make}
							);	
					}
					if (!ng[name].select2.length)
						ng[name].select2 = false;
				}
				setTimeout(function(){$(div).find('.select1')[0].onchange();},100);
				break;
			case 'gotopanel':
				ng[name].select1 = [];
				if (pb.ready) for (var i=0; i<pb.user.panels.length; i++){
					ng[name].select1.push(
						{value: i+1, text: i+1}
					);
				}
				else for (var i=0; i<wizardproject.panels.length; i++){
					ng[name].select1.push(
						{value: i+1, text: i+1}
					);
				}
				break;
			case 'module':
				ng[name].select1 = [];
				for (var i=0; i<manufacturerlist.length; i++){
					ng[name].select1.push(
						{value: manufacturerlist[i], text: manufacturerlist[i]}
					);
				}
				$(div).find('.select1')[0].onchange = function(){
					ng[name].select2 = [];
					for (var i=0; i<modulelist.length; i++){
						if (modulelist[i].manufacturer == $(div).find('.select1').val())
							ng[name].select2.push(
								{value: modulelist[i].file, text: modulelist[i].make}
							);	
					}
					if (!ng[name].select2.length) ng[name].select2 = false;
					setTimeout(function(){console.log('fire select2'); $(div).find('.select2')[0].onchange();},50);
					ngModel(ngmodel);
				}
				$(div).find('.select2')[0].onchange = function(){
					window.module_command_list = false;
					ng[name].select3 = [];
					ng[name].select3.push(
						{value: 'none', text: '[Function...]'}
					);
					pseudoRequire($(div).find('.select2').val(), function(){
						if (window.module_command_list){
							for (var i=0; i<window.module_command_list.length; i++){
								if (ng[name] && ng[name].select3)
									ng[name].select3.push(
										{value: i, text: window.module_command_list[i].name}
									);
							}
						}
						ngModel(ngmodel);
					});
					ngModel(ngmodel);
				}
				setTimeout(function(){$(div).find('.select1').change();$(div).find('.select2').change();},10);
				break;
			case 'tcpopen':
				ng[name].iptext = true;
				ng[name].porttext = true;
				break;
			case 'tcpsend':
				ng[name].iptext = true;
				ng[name].porttext = true;
				ng[name].msgtext = true;
				ng[name].select1 = [
					{value: 'ascii', text: 'ascii'},
					{value: 'hex', text: 'hex'}
				];
				ng[name].select2 = [
					{value: 'none', text: '[SVSi...]'},
					{value: 'ncommand', text: 'N-Command'},
					{value: 'nseriesdec', text: 'N-Series Decoder'},
					{value: 'nseriesenc', text: 'N-Series Encoder'},
					{value: 'vseriesdec', text: 'V-Series Decoder'},
					{value: 'vseriesenc', text: 'V-Series Encoder'},
					{value: 'wp', text: 'Windowing Processor'},
					{value: 'n4321', text: 'N-4321'},
					{value: 'n4000', text: 'N-4000'},
					{value: 'nvr', text: 'NVR'},
				];
				$(div).find('.select2')[0].onchange = function(){
					ng[name].select3 = false;
					switch ($(div).find('.select2').val()){
						case 'ncommand':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: '(ENC/DEC) Get Status'},
								{value: 'live', text: '(ENC/DEC) Live Play'},
								{value: 'local', text: '(ENC/DEC) Local Play'},
								{value: 'serial', text: '(ENC/DEC) Serial'},
								{value: 'serialhex', text: '(ENC/DEC) Serial Hex'},
								{value: 'readresponse', text: '(ENC/DEC) Read Response'},
								{value: 'sendir', text: '(ENC/DEC) Send IR'},
								{value: 'sendirraw', text: '(ENC/DEC) Send IR Raw'},
								{value: 'audioon', text: '(ENC/DEC) Audio On'},
								{value: 'audiooff', text: '(ENC/DEC) Audio Off'},
								{value: 'enablehdmiaudio', text: '(ENC/DEC) Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: '(ENC/DEC) Disable HDMI Audio'},
								{value: 'autohdmiaudio', text: '(ENC/DEC) Auto HDMI Audio'},
								
								{value: 'encenablecc', text: '(ENC) Enable CC'},
								{value: 'encdisablecc', text: '(ENC) Disable CC'},
								{value: 'encautocc', text: '(ENC) Auto CC'},
								{value: 'encmodeoff', text: '(ENC) Mode Off'},
								
								{value: 'decswitch', text: '(DEC) Set Stream'},
								{value: 'decswitchaudio', text: '(DEC) Set Audio Stream'},
								{value: 'decaudiofollow', text: '(DEC) Audio Follow'},
								{value: 'decdvion', text: '(DEC) DVI On'},
								{value: 'decdvioff', text: '(DEC) DVI Off'},
								{value: 'deccropref', text: '(DEC) Crop Ref'},
								
								{value: 'nvrrecord', text: '(NVR) Record'},
								{value: 'nvrdsrecord', text: '(NVR) Dual Sync Record'},
								{value: 'nvrdvrswitch1', text: '(NVR) DVR Switch 1'},
								{value: 'nvrdvrswitch2', text: '(NVR) DVR Switch 2'},
								{value: 'nvrmpeg', text: '(NVR) MPEG Convert Last'},
								{value: 'nvrmpegall', text: '(NVR) MPEG Convert All'},
								{value: 'nvrdeletempegfile', text: '(NVR) Delete MPEG File'},
								{value: 'nvrplay', text: '(NVR) Play'},
								{value: 'nvrstop', text: '(NVR) Stop'},
								{value: 'nvrpause', text: '(NVR) Pause'},
								{value: 'nvrfastforward', text: '(NVR) Fast Forward'},
								{value: 'nvrrewind', text: '(NVR) Rewind'},
								{value: 'nvrdeletefile', text: '(NVR) Delete File'},
								{value: 'nvrstepforward', text: '(NVR) Step Forward'},
								{value: 'nvrstepreverse', text: '(NVR) Step Reverse'},
								{value: 'nvrstoprecord', text: '(NVR) Stop Record'},
								{value: 'nvrrecordhold', text: '(NVR) Record Hold'},
								{value: 'nvrrecordrelease', text: '(NVR) Record Release'},
								{value: 'nvrplayhold', text: '(NVR) Play Hold'},
								{value: 'nvrplayrelease', text: '(NVR) Play Release'},
								{value: 'nvrdeleteallplaylist', text: '(NVR) Delete All Playlists'},
								{value: 'nvrdeleteallmpegs', text: '(NVR) Delete All MPEGs'},
								{value: 'nvrremotecopy', text: '(NVR) Remote Copy'},
								
								{value: 'wpset', text: '(WP) Set Stream'},
								{value: 'wpaudioin', text: '(WP) Audio In'},
								{value: 'wpactive', text: '(WP) Active'},
								{value: 'wpinactive', text: '(WP) Inactive'},
								{value: 'wpaudioon', text: '(WP) Audio On'},
								{value: 'wpaudiooff', text: '(WP) Set Stream'},
								{value: 'wpmodeon', text: '(WP) Set Stream'},
								{value: 'wpmodeoff', text: '(WP) Set Stream'},
								{value: 'wparrange', text: '(WP) Arrange'},
								{value: 'wpbackground', text: '(WP) Background'},
								{value: 'wpcrop', text: '(WP) Crop'},
								{value: 'wppriority', text: '(WP) Priority'},
								{value: 'wpbordon', text: '(WP) Border On'},
								{value: 'wpbordoff', text: '(WP) Border Off'},
								{value: 'wppreset', text: '(WP) Set Preset'},
								
								{value: 'atrset', text: '(ATR) Set Stream'},
								{value: 'atrmute', text: '(ATR) Mute'},
								{value: 'atrunmute', text: '(ATR) Unmute'},
								{value: 'atrxmute', text: '(ATR) Mute Transmit'},
								{value: 'atrxunmute', text: '(ATR) Unmute Transmit'},
								{value: 'atrhpvol', text: '(ATR) Headphone Volume'},
								{value: 'atrhpvolup', text: '(ATR) Headphone Volume Up'},
								{value: 'atrhpvoldown', text: '(ATR) Headphone Volume Down'},
								{value: 'atrlovol', text: '(ATR) Lineout Volume'},
								{value: 'atrlovolup', text: '(ATR) Lineout Volume Up'},
								{value: 'atrlovoldown', text: '(ATR) Lineout Volume Down'},
								
								{value: 'videowall', text: '(VW) Video Wall'},
								{value: 'videowallswitch', text: '(VW) Set Stream'},
								
								{value: 'script', text: '(MISC) Script'},
								{value: 'tcpclient', text: '(MISC) TCP Client'},
								{value: 'udpclient', text: '(MISC) UDP Client'},
								{value: 'reboot', text: '(MISC) Reboot'},
								{value: 'gcserial', text: '(MISC) Global Cache Serial'},
								{value: 'gcopenrelay', text: '(MISC) Global Cache Open Relay'},
								{value: 'gccloserelay', text: '(MISC) Global Cache Close Relay'},
								{value: 'gcir', text: '(MISC) Global Cache IR'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'live':
										$(div).find('.msgtextinput').val('live 169.254.104.1'+eol);
										break;
									case 'local':
										$(div).find('.msgtextinput').val('local 169.254.104.1 1'+eol);
										break;
									case 'encmodeoff':
										$(div).find('.msgtextinput').val('modeoff 169.254.104.1'+eol);
										break;
									case 'serial':
										$(div).find('.msgtextinput').val('serial 169.254.104.1 29'+eol);
										break;
									case 'serialhex':
										$(div).find('.msgtextinput').val('serialhex 169.254.104.1 4f 4d 41 4e'+eol);
										break;
									case 'readresponse':
										$(div).find('.msgtextinput').val('readresponse 169.254.104.1'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir 169.254.104.1 Play'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw 169.254.104.1 0000 006C'+eol);
										break;
									case 'audioon':
										$(div).find('.msgtextinput').val('audioon 169.254.104.1'+eol);
										break;
									case 'audiooff':
										$(div).find('.msgtextinput').val('audiooff 169.254.104.1'+eol);
										break;
									case 'encenablecc':
										$(div).find('.msgtextinput').val('enablecc 169.254.104.1'+eol);
										break;
									case 'encdisablecc':
										$(div).find('.msgtextinput').val('disablecc 169.254.104.1'+eol);
										break;
									case 'encautocc':
										$(div).find('.msgtextinput').val('autocc 169.254.104.1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('enablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('disablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'decswitch':
										$(div).find('.msgtextinput').val('switch 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decswitchaudio':
										$(div).find('.msgtextinput').val('switchaudio 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decaudiofollow':
										$(div).find('.msgtextinput').val('audiofollow 169.254.104.1'+eol);
										break;
									case 'decdvion':
										$(div).find('.msgtextinput').val('dvion 169.254.104.1'+eol);
										break;
									case 'decdvioff':
										$(div).find('.msgtextinput').val('dvioff 169.254.104.1'+eol);
										break;
									case 'deccropref':
										$(div).find('.msgtextinput').val('cropref 169.254.104.1 10 10 20 20'+eol);
										break;
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus 169.254.104.1'+eol);
										break;
									case 'nvrrecord':
										$(div).find('.msgtextinput').val('record 169.254.178.49 169.254.30.238 5 MY RECORDING'+eol);
										break;
									case 'nvrdsrecord':
										$(div).find('.msgtextinput').val('dsrecord 169.254.178.49 169.254.30.238 169.254.23.72 5 MY RECORDING 1 and MY RECORDING 2'+eol);
										break;
									case 'nvrswitch1':
										$(div).find('.msgtextinput').val('dvrswitch1 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrswitch2':
										$(div).find('.msgtextinput').val('dvrswitch2 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrmpeg':
										$(div).find('.msgtextinput').val('mpeg 169.254.178.49 latest 1 bitrate:7500000'+eol);
										break;
									case 'nvrmpegall':
										$(div).find('.msgtextinput').val('mpegall 169.254.178.49 <begin timeframe> <end timeframe> bitrate:7500000'+eol);
										break;
									case 'nvrdeletempegfile':
										$(div).find('.msgtextinput').val('deletempegfile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrplay':
										$(div).find('.msgtextinput').val('play 169.254.178.49 <index|latest> <loop|noloop> <start offset> <stop offset>'+eol);
										break;
									case 'nvrstop':
										$(div).find('.msgtextinput').val('stop 169.254.178.49'+eol);
										break;
									case 'nvrpause':
										$(div).find('.msgtextinput').val('pause 169.254.178.49'+eol);
										break;
									case 'nvrunpause':
										$(div).find('.msgtextinput').val('unpause 169.254.178.49'+eol);
										break;
									case 'nvrfastforward':
										$(div).find('.msgtextinput').val('fastforward 169.254.178.49'+eol);
										break;
									case 'nvrrewind':
										$(div).find('.msgtextinput').val('rewind 169.254.178.49'+eol);
										break;
									case 'nvrdeletefile':
										$(div).find('.msgtextinput').val('deletefile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrstepforward':
										$(div).find('.msgtextinput').val('stepforward 169.254.178.49'+eol);
										break;
									case 'nvrstepreverse':
										$(div).find('.msgtextinput').val('stepreverse 169.254.178.49'+eol);
										break;
									case 'nvrstoprecord':
										$(div).find('.msgtextinput').val('stoprecord 169.254.178.49'+eol);
										break;
									case 'nvrrecordhold':
										$(div).find('.msgtextinput').val('recordhold 169.254.178.49'+eol);
										break;
									case 'nvrrecordrelease':
										$(div).find('.msgtextinput').val('recordrelease 169.254.178.49'+eol);
										break;
									case 'nvrplayhold':
										$(div).find('.msgtextinput').val('playhold 169.254.178.49'+eol);
										break;
									case 'nvrplayrelease':
										$(div).find('.msgtextinput').val('playrelease 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallplaylist':
										$(div).find('.msgtextinput').val('deleteallplaylist 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallmpegs':
										$(div).find('.msgtextinput').val('deleteallmpegs 169.254.178.49'+eol);
										break;
									case 'nvrremotecopy':
										$(div).find('.msgtextinput').val('remotecopy 169.254.178.49'+eol);
										break;
									case 'wpset':
										$(div).find('.msgtextinput').val('wpswitch 169.254.120.2 1 169.254.30.238'+eol);
										break;
									case 'wpaudioin':
										$(div).find('.msgtextinput').val('wpaudioin 169.254.120.2 169.254.30.238'+eol);
										break;
									case 'wpactive':
										$(div).find('.msgtextinput').val('wpactive 169.254.120.2 1'+eol);
										break;
									case 'wpinactive':
										$(div).find('.msgtextinput').val('wpinactive 169.254.120.2 1'+eol);
										break;
									case 'wpaudioon':
										$(div).find('.msgtextinput').val('wpaudioon 169.254.120.2'+eol);
										break;
									case 'wpaudiooff':
										$(div).find('.msgtextinput').val('wpaudiooff 169.254.120.2'+eol);
										break;
									case 'wpmodeon':
										$(div).find('.msgtextinput').val('wpmodeon 169.254.120.2'+eol);
										break;
									case 'wpmodeoff':
										$(div).find('.msgtextinput').val('wpmodeoff 169.254.120.2'+eol);
										break;
									case 'wparrange':
										$(div).find('.msgtextinput').val('wparrange 169.254.120.2 1 0 0 10 10'+eol);
										break;
									case 'wpbackground':
										$(div).find('.msgtextinput').val('wpbackground 169.254.120.2 1'+eol);
										break;
									case 'wpcrop':
										$(div).find('.msgtextinput').val('wpcrop 169.254.120.2 1 0 0 0 0'+eol);
										break;
									case 'wppriority':
										$(div).find('.msgtextinput').val('wppriority 169.254.120.2 1 1'+eol);
										break;
									case 'wpbordon':
										$(div).find('.msgtextinput').val('wpbordon 169.254.120.2 1'+eol);
										break;
									case 'wpbordoff':
										$(div).find('.msgtextinput').val('wpbordoff 169.254.120.2 1'+eol);
										break;
									case 'wppreset':
										$(div).find('.msgtextinput').val('wppreset 169.254.120.2 0'+eol);
										break;
									case 'atrset':
										$(div).find('.msgtextinput').val('atrswitch 169.254.252.121 169.254.30.238'+eol);
										break;
									case 'atrmute':
										$(div).find('.msgtextinput').val('atrmute 169.254.252.121'+eol);
										break;
									case 'atrunmute':
										$(div).find('.msgtextinput').val('atrunmute 169.254.252.121'+eol);
										break;
									case 'atrxmute':
										$(div).find('.msgtextinput').val('atrxmute 169.254.252.121'+eol);
										break;
									case 'atrxunmute':
										$(div).find('.msgtextinput').val('atrxunmute 169.254.252.121'+eol);
										break;
									case 'atrhpvol':
										$(div).find('.msgtextinput').val('atrhpvol 169.254.252.121 50'+eol);
										break;
									case 'atrhpvolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrhpvoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'atrlovol':
										$(div).find('.msgtextinput').val('atrlovol 169.254.252.121 50'+eol);
										break;
									case 'atrlovolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrlovoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'videowall':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen"'+eol);
										break;
									case 'videowallswitch':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen" <layer> <stream>'+eol);
										break;
									case 'script':
										$(div).find('.msgtextinput').val('script 33'+eol);
										break;
									case 'tcpclient':
										$(div).find('.msgtextinput').val('tcpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'udpclient':
										$(div).find('.msgtextinput').val('udpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('reboot 192.168.10.20'+eol);
										break;
									case 'gcserial':
										$(div).find('.msgtextinput').val('gc_serial 192.168.1.166 1:1 6b 61 20 30 20 30 31 0d'+eol);
										break;
									case 'gcopenrelay':
										$(div).find('.msgtextinput').val('gc_openrelay 192.168.1.166 3:1'+eol);
										break;
									case 'gccloserelay':
										$(div).find('.msgtextinput').val('gc_closerelay 192.168.1.166 3:1'+eol);
										break;
									case 'gcir':
										$(div).find('.msgtextinput').val('gc_ir 169.254.250.240 4:3 sendir,1,38000,1,1,347,173,22,22'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50008');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'volume', text: 'Volume'},
								{value: 'leftvolume', text: 'Left Volume'},
								{value: 'rightvolume', text: 'Right Volume'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'setcroplocation', text: 'Set Crop Location'},
								{value: 'sendir', text: 'Send IR'},
								{value: 'sendirraw', text: 'Send IR Raw'},
								{value: 'configserial', text: 'Configure Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'leftvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'rightvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'setcroplocation':
										$(div).find('.msgtextinput').val('croppref:5,50,720,720'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmit'},
								{value: 'txdisable', text: 'Disable Transmit'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'sendirraw', text: 'Send IR Raw'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'setaudiofollow', text: 'Audio Follow Video'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'writeserial', text: 'Write Serial'},
								{value: 'readserial', text: 'Read Serial'},
								{value: 'setserial', text: 'Set Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'setaudiofollow':
										$(div).find('.msgtextinput').val('seta:0'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'writeserial':
										$(div).find('.msgtextinput').val('serWrite:<command>'+eol);
										break;
									case 'readserial':
										$(div).find('.msgtextinput').val('serRead'+eol);
										break;
									case 'setserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits & parity & stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'hostplay', text: 'Host Play'},
								{value: 'streamon', text: 'Stream On'},
								{value: 'streamoff', text: 'Stream Off'},
								{value: 'enablecc', text: 'Enable CC'},
								{value: 'disablecc', text: 'Disable CC'},
								{value: 'enablehdmiaudio', text: 'Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: 'Disable HDMI Audio'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'hostplay':
										$(div).find('.msgtextinput').val('host:1'+eol);
										break;
									case 'streamon':
										$(div).find('.msgtextinput').val('streamOn'+eol);
										break;
									case 'streamoff':
										$(div).find('.msgtextinput').val('streamOff'+eol);
										break;
									case 'enablecc':
										$(div).find('.msgtextinput').val('advClr:1'+eol);
										break;
									case 'disablecc':
										$(div).find('.msgtextinput').val('advSet:1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('advSet:4'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('advClr:4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4321':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
								{value: 'linputgainpre', text: 'Left Input Gain(pre)'},
								{value: 'rinputgainpre', text: 'Right Input Gain(pre)'},
								{value: 'linputgainpost', text: 'Left Input Gain(post)'},
								{value: 'rinputgainpost', text: 'Right Input Gain(post)'},
								{value: 'reboot', text: 'Reboot'},
								{value: 'relay1', text: 'Relay 1 State'},
								{value: 'relay2', text: 'Relay 2 State'},
								{value: 'phantompower', text: 'Phantom Power'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'linputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainleft:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'rinputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainright:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'linputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcLeftGain:<0-59>'+eol);
										break;
									case 'rinputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcRightGain:<0-59>'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('setSettings:reboot'+eol);
										break;
									case 'relay1':
										$(div).find('.msgtextinput').val('setSettings:relay1State:<open|close>'+eol);
										break;
									case 'relay2':
										$(div).find('.msgtextinput').val('setSettings:relay2State:<open|close>'+eol);
										break;
									case 'phantompower':
										$(div).find('.msgtextinput').val('setSettings:phantomPower:<on|off>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4000':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'wp':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setpreset', text: 'Set Preset'},
								{value: 'setwindowstream', text: 'Set Window Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'outputmode', text: 'Set Scaler Mode'},
								{value: 'priority', text: 'Set Window Priority'},
								{value: 'enablewindow', text: 'Enable Window'},
								{value: 'disablewindow', text: 'Disable Window'},
								{value: 'enableborder', text: 'Enable Border'},
								{value: 'disableborder', text: 'Disable Border'},
								{value: 'setborderwidth', text: 'Set Border Width'},
								{value: 'setbordercolor', text: 'Set Border Color'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setpreset':
										$(div).find('.msgtextinput').val('preset:1'+eol);
										break;
									case 'setwindowstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'outputmode':
										$(div).find('.msgtextinput').val('modeset:1080p'+eol);
										break;
									case 'enablewindow':
										$(div).find('.msgtextinput').val('winon:0'+eol);
										break;
									case 'disablewindow':
										$(div).find('.msgtextinput').val('winoff:0'+eol);
										break;
									case 'enableborder':
										$(div).find('.msgtextinput').val('bordon:0'+eol);
										break;
									case 'disableborder':
										$(div).find('.msgtextinput').val('bordoff:0'+eol);
										break;
									case 'setborderwidth':
										$(div).find('.msgtextinput').val('setbord:0:4,4'+eol);
										break;
									case 'setbordercolor':
										$(div).find('.msgtextinput').val('setbordcol:0:4,4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nvr':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setmode', text: 'Set NVR Mode'},
								{value: 'setstream', text: 'Set Stream/Channel'},
								{value: 'setaudiostream', text: 'Set Audio Stream/Channel'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'play', text: 'Play'},
								{value: 'stop', text: 'Stop'},
								{value: 'record', text: 'Record'},
								{value: 'dsrecord', text: 'Dual Sync Record'},
								{value: 'stoprecord', text: 'Stop Recording'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setmode':
										$(div).find('.msgtextinput').val('dvrmode:<1,2,3>'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'play':
										$(div).find('.msgtextinput').val('play:<channel>,<file>,<loop(0|1)>'+eol);
										break;
									case 'stop':
										$(div).find('.msgtextinput').val('stop:<channel>'+eol);
										break;
									case 'record':
										$(div).find('.msgtextinput').val('record:<channel>,<stream>,<stream>,<duration>,<description>'+eol);
										break;
									case 'dsrecord':
										$(div).find('.msgtextinput').val('record:0,<channel>,<stream1>,<stream1>,<stream2>,<stream2>,<duration>,<description>'+eol);
										break;
									case 'stoprecord':
										$(div).find('.msgtextinput').val('recstop:<channel>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						default: break;
					}
				};
				break;
			case 'tcpclose':
				ng[name].iptext = true;
				ng[name].porttext = true;
				break;
			case 'tcpclient':
				ng[name].iptext = true;
				ng[name].porttext = true;
				ng[name].msgtext = true;
				ng[name].select1 = [
					{value: 'ascii', text: 'ascii'},
					{value: 'hex', text: 'hex'}
				];
				ng[name].select2 = [
					{value: 'none', text: '[SVSi...]'},
					{value: 'ncommand', text: 'N-Command'},
					{value: 'nseriesdec', text: 'N-Series Decoder'},
					{value: 'nseriesenc', text: 'N-Series Encoder'},
					{value: 'vseriesdec', text: 'V-Series Decoder'},
					{value: 'vseriesenc', text: 'V-Series Encoder'},
					{value: 'wp', text: 'Windowing Processor'},
					{value: 'n4321', text: 'N-4321'},
					{value: 'n4000', text: 'N-4000'},
					{value: 'nvr', text: 'NVR'},
				];
				$(div).find('.select2')[0].onchange = function(){
					ng[name].select3 = false;
					switch ($(div).find('.select2').val()){
						case 'ncommand':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: '(ENC/DEC) Get Status'},
								{value: 'live', text: '(ENC/DEC) Live Play'},
								{value: 'local', text: '(ENC/DEC) Local Play'},
								{value: 'serial', text: '(ENC/DEC) Serial'},
								{value: 'serialhex', text: '(ENC/DEC) Serial Hex'},
								{value: 'readresponse', text: '(ENC/DEC) Read Response'},
								{value: 'sendir', text: '(ENC/DEC) Send IR'},
								{value: 'sendirraw', text: '(ENC/DEC) Send IR Raw'},
								{value: 'audioon', text: '(ENC/DEC) Audio On'},
								{value: 'audiooff', text: '(ENC/DEC) Audio Off'},
								{value: 'enablehdmiaudio', text: '(ENC/DEC) Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: '(ENC/DEC) Disable HDMI Audio'},
								{value: 'autohdmiaudio', text: '(ENC/DEC) Auto HDMI Audio'},
								
								{value: 'encenablecc', text: '(ENC) Enable CC'},
								{value: 'encdisablecc', text: '(ENC) Disable CC'},
								{value: 'encautocc', text: '(ENC) Auto CC'},
								{value: 'encmodeoff', text: '(ENC) Mode Off'},
								
								{value: 'decswitch', text: '(DEC) Set Stream'},
								{value: 'decswitchaudio', text: '(DEC) Set Audio Stream'},
								{value: 'decaudiofollow', text: '(DEC) Audio Follow'},
								{value: 'decdvion', text: '(DEC) DVI On'},
								{value: 'decdvioff', text: '(DEC) DVI Off'},
								{value: 'deccropref', text: '(DEC) Crop Ref'},
								
								{value: 'nvrrecord', text: '(NVR) Record'},
								{value: 'nvrdsrecord', text: '(NVR) Dual Sync Record'},
								{value: 'nvrdvrswitch1', text: '(NVR) DVR Switch 1'},
								{value: 'nvrdvrswitch2', text: '(NVR) DVR Switch 2'},
								{value: 'nvrmpeg', text: '(NVR) MPEG Convert Last'},
								{value: 'nvrmpegall', text: '(NVR) MPEG Convert All'},
								{value: 'nvrdeletempegfile', text: '(NVR) Delete MPEG File'},
								{value: 'nvrplay', text: '(NVR) Play'},
								{value: 'nvrstop', text: '(NVR) Stop'},
								{value: 'nvrpause', text: '(NVR) Pause'},
								{value: 'nvrfastforward', text: '(NVR) Fast Forward'},
								{value: 'nvrrewind', text: '(NVR) Rewind'},
								{value: 'nvrdeletefile', text: '(NVR) Delete File'},
								{value: 'nvrstepforward', text: '(NVR) Step Forward'},
								{value: 'nvrstepreverse', text: '(NVR) Step Reverse'},
								{value: 'nvrstoprecord', text: '(NVR) Stop Record'},
								{value: 'nvrrecordhold', text: '(NVR) Record Hold'},
								{value: 'nvrrecordrelease', text: '(NVR) Record Release'},
								{value: 'nvrplayhold', text: '(NVR) Play Hold'},
								{value: 'nvrplayrelease', text: '(NVR) Play Release'},
								{value: 'nvrdeleteallplaylist', text: '(NVR) Delete All Playlists'},
								{value: 'nvrdeleteallmpegs', text: '(NVR) Delete All MPEGs'},
								{value: 'nvrremotecopy', text: '(NVR) Remote Copy'},
								
								{value: 'wpset', text: '(WP) Set Stream'},
								{value: 'wpaudioin', text: '(WP) Audio In'},
								{value: 'wpactive', text: '(WP) Active'},
								{value: 'wpinactive', text: '(WP) Inactive'},
								{value: 'wpaudioon', text: '(WP) Audio On'},
								{value: 'wpaudiooff', text: '(WP) Set Stream'},
								{value: 'wpmodeon', text: '(WP) Set Stream'},
								{value: 'wpmodeoff', text: '(WP) Set Stream'},
								{value: 'wparrange', text: '(WP) Arrange'},
								{value: 'wpbackground', text: '(WP) Background'},
								{value: 'wpcrop', text: '(WP) Crop'},
								{value: 'wppriority', text: '(WP) Priority'},
								{value: 'wpbordon', text: '(WP) Border On'},
								{value: 'wpbordoff', text: '(WP) Border Off'},
								{value: 'wppreset', text: '(WP) Set Preset'},
								
								{value: 'atrset', text: '(ATR) Set Stream'},
								{value: 'atrmute', text: '(ATR) Mute'},
								{value: 'atrunmute', text: '(ATR) Unmute'},
								{value: 'atrxmute', text: '(ATR) Mute Transmit'},
								{value: 'atrxunmute', text: '(ATR) Unmute Transmit'},
								{value: 'atrhpvol', text: '(ATR) Headphone Volume'},
								{value: 'atrhpvolup', text: '(ATR) Headphone Volume Up'},
								{value: 'atrhpvoldown', text: '(ATR) Headphone Volume Down'},
								{value: 'atrlovol', text: '(ATR) Lineout Volume'},
								{value: 'atrlovolup', text: '(ATR) Lineout Volume Up'},
								{value: 'atrlovoldown', text: '(ATR) Lineout Volume Down'},
								
								{value: 'videowall', text: '(VW) Video Wall'},
								{value: 'videowallswitch', text: '(VW) Set Stream'},
								
								{value: 'script', text: '(MISC) Script'},
								{value: 'tcpclient', text: '(MISC) TCP Client'},
								{value: 'udpclient', text: '(MISC) UDP Client'},
								{value: 'reboot', text: '(MISC) Reboot'},
								{value: 'gcserial', text: '(MISC) Global Cache Serial'},
								{value: 'gcopenrelay', text: '(MISC) Global Cache Open Relay'},
								{value: 'gccloserelay', text: '(MISC) Global Cache Close Relay'},
								{value: 'gcir', text: '(MISC) Global Cache IR'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'live':
										$(div).find('.msgtextinput').val('live 169.254.104.1'+eol);
										break;
									case 'local':
										$(div).find('.msgtextinput').val('local 169.254.104.1 1'+eol);
										break;
									case 'encmodeoff':
										$(div).find('.msgtextinput').val('modeoff 169.254.104.1'+eol);
										break;
									case 'serial':
										$(div).find('.msgtextinput').val('serial 169.254.104.1 29'+eol);
										break;
									case 'serialhex':
										$(div).find('.msgtextinput').val('serialhex 169.254.104.1 4f 4d 41 4e'+eol);
										break;
									case 'readresponse':
										$(div).find('.msgtextinput').val('readresponse 169.254.104.1'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir 169.254.104.1 Play'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw 169.254.104.1 0000 006C'+eol);
										break;
									case 'audioon':
										$(div).find('.msgtextinput').val('audioon 169.254.104.1'+eol);
										break;
									case 'audiooff':
										$(div).find('.msgtextinput').val('audiooff 169.254.104.1'+eol);
										break;
									case 'encenablecc':
										$(div).find('.msgtextinput').val('enablecc 169.254.104.1'+eol);
										break;
									case 'encdisablecc':
										$(div).find('.msgtextinput').val('disablecc 169.254.104.1'+eol);
										break;
									case 'encautocc':
										$(div).find('.msgtextinput').val('autocc 169.254.104.1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('enablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('disablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'decswitch':
										$(div).find('.msgtextinput').val('switch 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decswitchaudio':
										$(div).find('.msgtextinput').val('switchaudio 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decaudiofollow':
										$(div).find('.msgtextinput').val('audiofollow 169.254.104.1'+eol);
										break;
									case 'decdvion':
										$(div).find('.msgtextinput').val('dvion 169.254.104.1'+eol);
										break;
									case 'decdvioff':
										$(div).find('.msgtextinput').val('dvioff 169.254.104.1'+eol);
										break;
									case 'deccropref':
										$(div).find('.msgtextinput').val('cropref 169.254.104.1 10 10 20 20'+eol);
										break;
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus 169.254.104.1'+eol);
										break;
									case 'nvrrecord':
										$(div).find('.msgtextinput').val('record 169.254.178.49 169.254.30.238 5 MY RECORDING'+eol);
										break;
									case 'nvrdsrecord':
										$(div).find('.msgtextinput').val('dsrecord 169.254.178.49 169.254.30.238 169.254.23.72 5 MY RECORDING 1 and MY RECORDING 2'+eol);
										break;
									case 'nvrswitch1':
										$(div).find('.msgtextinput').val('dvrswitch1 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrswitch2':
										$(div).find('.msgtextinput').val('dvrswitch2 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrmpeg':
										$(div).find('.msgtextinput').val('mpeg 169.254.178.49 latest 1 bitrate:7500000'+eol);
										break;
									case 'nvrmpegall':
										$(div).find('.msgtextinput').val('mpegall 169.254.178.49 <begin timeframe> <end timeframe> bitrate:7500000'+eol);
										break;
									case 'nvrdeletempegfile':
										$(div).find('.msgtextinput').val('deletempegfile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrplay':
										$(div).find('.msgtextinput').val('play 169.254.178.49 <index|latest> <loop|noloop> <start offset> <stop offset>'+eol);
										break;
									case 'nvrstop':
										$(div).find('.msgtextinput').val('stop 169.254.178.49'+eol);
										break;
									case 'nvrpause':
										$(div).find('.msgtextinput').val('pause 169.254.178.49'+eol);
										break;
									case 'nvrunpause':
										$(div).find('.msgtextinput').val('unpause 169.254.178.49'+eol);
										break;
									case 'nvrfastforward':
										$(div).find('.msgtextinput').val('fastforward 169.254.178.49'+eol);
										break;
									case 'nvrrewind':
										$(div).find('.msgtextinput').val('rewind 169.254.178.49'+eol);
										break;
									case 'nvrdeletefile':
										$(div).find('.msgtextinput').val('deletefile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrstepforward':
										$(div).find('.msgtextinput').val('stepforward 169.254.178.49'+eol);
										break;
									case 'nvrstepreverse':
										$(div).find('.msgtextinput').val('stepreverse 169.254.178.49'+eol);
										break;
									case 'nvrstoprecord':
										$(div).find('.msgtextinput').val('stoprecord 169.254.178.49'+eol);
										break;
									case 'nvrrecordhold':
										$(div).find('.msgtextinput').val('recordhold 169.254.178.49'+eol);
										break;
									case 'nvrrecordrelease':
										$(div).find('.msgtextinput').val('recordrelease 169.254.178.49'+eol);
										break;
									case 'nvrplayhold':
										$(div).find('.msgtextinput').val('playhold 169.254.178.49'+eol);
										break;
									case 'nvrplayrelease':
										$(div).find('.msgtextinput').val('playrelease 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallplaylist':
										$(div).find('.msgtextinput').val('deleteallplaylist 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallmpegs':
										$(div).find('.msgtextinput').val('deleteallmpegs 169.254.178.49'+eol);
										break;
									case 'nvrremotecopy':
										$(div).find('.msgtextinput').val('remotecopy 169.254.178.49'+eol);
										break;
									case 'wpset':
										$(div).find('.msgtextinput').val('wpswitch 169.254.120.2 1 169.254.30.238'+eol);
										break;
									case 'wpaudioin':
										$(div).find('.msgtextinput').val('wpaudioin 169.254.120.2 169.254.30.238'+eol);
										break;
									case 'wpactive':
										$(div).find('.msgtextinput').val('wpactive 169.254.120.2 1'+eol);
										break;
									case 'wpinactive':
										$(div).find('.msgtextinput').val('wpinactive 169.254.120.2 1'+eol);
										break;
									case 'wpaudioon':
										$(div).find('.msgtextinput').val('wpaudioon 169.254.120.2'+eol);
										break;
									case 'wpaudiooff':
										$(div).find('.msgtextinput').val('wpaudiooff 169.254.120.2'+eol);
										break;
									case 'wpmodeon':
										$(div).find('.msgtextinput').val('wpmodeon 169.254.120.2'+eol);
										break;
									case 'wpmodeoff':
										$(div).find('.msgtextinput').val('wpmodeoff 169.254.120.2'+eol);
										break;
									case 'wparrange':
										$(div).find('.msgtextinput').val('wparrange 169.254.120.2 1 0 0 10 10'+eol);
										break;
									case 'wpbackground':
										$(div).find('.msgtextinput').val('wpbackground 169.254.120.2 1'+eol);
										break;
									case 'wpcrop':
										$(div).find('.msgtextinput').val('wpcrop 169.254.120.2 1 0 0 0 0'+eol);
										break;
									case 'wppriority':
										$(div).find('.msgtextinput').val('wppriority 169.254.120.2 1 1'+eol);
										break;
									case 'wpbordon':
										$(div).find('.msgtextinput').val('wpbordon 169.254.120.2 1'+eol);
										break;
									case 'wpbordoff':
										$(div).find('.msgtextinput').val('wpbordoff 169.254.120.2 1'+eol);
										break;
									case 'wppreset':
										$(div).find('.msgtextinput').val('wppreset 169.254.120.2 0'+eol);
										break;
									case 'atrset':
										$(div).find('.msgtextinput').val('atrswitch 169.254.252.121 169.254.30.238'+eol);
										break;
									case 'atrmute':
										$(div).find('.msgtextinput').val('atrmute 169.254.252.121'+eol);
										break;
									case 'atrunmute':
										$(div).find('.msgtextinput').val('atrunmute 169.254.252.121'+eol);
										break;
									case 'atrxmute':
										$(div).find('.msgtextinput').val('atrxmute 169.254.252.121'+eol);
										break;
									case 'atrxunmute':
										$(div).find('.msgtextinput').val('atrxunmute 169.254.252.121'+eol);
										break;
									case 'atrhpvol':
										$(div).find('.msgtextinput').val('atrhpvol 169.254.252.121 50'+eol);
										break;
									case 'atrhpvolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrhpvoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'atrlovol':
										$(div).find('.msgtextinput').val('atrlovol 169.254.252.121 50'+eol);
										break;
									case 'atrlovolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrlovoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'videowall':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen"'+eol);
										break;
									case 'videowallswitch':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen" <layer> <stream>'+eol);
										break;
									case 'script':
										$(div).find('.msgtextinput').val('script 33'+eol);
										break;
									case 'tcpclient':
										$(div).find('.msgtextinput').val('tcpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'udpclient':
										$(div).find('.msgtextinput').val('udpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('reboot 192.168.10.20'+eol);
										break;
									case 'gcserial':
										$(div).find('.msgtextinput').val('gc_serial 192.168.1.166 1:1 6b 61 20 30 20 30 31 0d'+eol);
										break;
									case 'gcopenrelay':
										$(div).find('.msgtextinput').val('gc_openrelay 192.168.1.166 3:1'+eol);
										break;
									case 'gccloserelay':
										$(div).find('.msgtextinput').val('gc_closerelay 192.168.1.166 3:1'+eol);
										break;
									case 'gcir':
										$(div).find('.msgtextinput').val('gc_ir 169.254.250.240 4:3 sendir,1,38000,1,1,347,173,22,22'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50008');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'volume', text: 'Volume'},
								{value: 'leftvolume', text: 'Left Volume'},
								{value: 'rightvolume', text: 'Right Volume'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'setcroplocation', text: 'Set Crop Location'},
								{value: 'sendir', text: 'Send IR'},
								{value: 'sendirraw', text: 'Send IR Raw'},
								{value: 'configserial', text: 'Configure Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'leftvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'rightvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'setcroplocation':
										$(div).find('.msgtextinput').val('croppref:5,50,720,720'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmit'},
								{value: 'txdisable', text: 'Disable Transmit'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'sendirraw', text: 'Send IR Raw'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'setaudiofollow', text: 'Audio Follow Video'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'writeserial', text: 'Write Serial'},
								{value: 'readserial', text: 'Read Serial'},
								{value: 'setserial', text: 'Set Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'setaudiofollow':
										$(div).find('.msgtextinput').val('seta:0'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'writeserial':
										$(div).find('.msgtextinput').val('serWrite:<command>'+eol);
										break;
									case 'readserial':
										$(div).find('.msgtextinput').val('serRead'+eol);
										break;
									case 'setserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits & parity & stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'hostplay', text: 'Host Play'},
								{value: 'streamon', text: 'Stream On'},
								{value: 'streamoff', text: 'Stream Off'},
								{value: 'enablecc', text: 'Enable CC'},
								{value: 'disablecc', text: 'Disable CC'},
								{value: 'enablehdmiaudio', text: 'Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: 'Disable HDMI Audio'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'hostplay':
										$(div).find('.msgtextinput').val('host:1'+eol);
										break;
									case 'streamon':
										$(div).find('.msgtextinput').val('streamOn'+eol);
										break;
									case 'streamoff':
										$(div).find('.msgtextinput').val('streamOff'+eol);
										break;
									case 'enablecc':
										$(div).find('.msgtextinput').val('advClr:1'+eol);
										break;
									case 'disablecc':
										$(div).find('.msgtextinput').val('advSet:1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('advSet:4'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('advClr:4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4321':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
								{value: 'linputgainpre', text: 'Left Input Gain(pre)'},
								{value: 'rinputgainpre', text: 'Right Input Gain(pre)'},
								{value: 'linputgainpost', text: 'Left Input Gain(post)'},
								{value: 'rinputgainpost', text: 'Right Input Gain(post)'},
								{value: 'reboot', text: 'Reboot'},
								{value: 'relay1', text: 'Relay 1 State'},
								{value: 'relay2', text: 'Relay 2 State'},
								{value: 'phantompower', text: 'Phantom Power'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'linputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainleft:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'rinputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainright:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'linputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcLeftGain:<0-59>'+eol);
										break;
									case 'rinputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcRightGain:<0-59>'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('setSettings:reboot'+eol);
										break;
									case 'relay1':
										$(div).find('.msgtextinput').val('setSettings:relay1State:<open|close>'+eol);
										break;
									case 'relay2':
										$(div).find('.msgtextinput').val('setSettings:relay2State:<open|close>'+eol);
										break;
									case 'phantompower':
										$(div).find('.msgtextinput').val('setSettings:phantomPower:<on|off>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4000':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'wp':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setpreset', text: 'Set Preset'},
								{value: 'setwindowstream', text: 'Set Window Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'outputmode', text: 'Set Scaler Mode'},
								{value: 'priority', text: 'Set Window Priority'},
								{value: 'enablewindow', text: 'Enable Window'},
								{value: 'disablewindow', text: 'Disable Window'},
								{value: 'enableborder', text: 'Enable Border'},
								{value: 'disableborder', text: 'Disable Border'},
								{value: 'setborderwidth', text: 'Set Border Width'},
								{value: 'setbordercolor', text: 'Set Border Color'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setpreset':
										$(div).find('.msgtextinput').val('preset:1'+eol);
										break;
									case 'setwindowstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'outputmode':
										$(div).find('.msgtextinput').val('modeset:1080p'+eol);
										break;
									case 'enablewindow':
										$(div).find('.msgtextinput').val('winon:0'+eol);
										break;
									case 'disablewindow':
										$(div).find('.msgtextinput').val('winoff:0'+eol);
										break;
									case 'enableborder':
										$(div).find('.msgtextinput').val('bordon:0'+eol);
										break;
									case 'disableborder':
										$(div).find('.msgtextinput').val('bordoff:0'+eol);
										break;
									case 'setborderwidth':
										$(div).find('.msgtextinput').val('setbord:0:4,4'+eol);
										break;
									case 'setbordercolor':
										$(div).find('.msgtextinput').val('setbordcol:0:4,4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nvr':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setmode', text: 'Set NVR Mode'},
								{value: 'setstream', text: 'Set Stream/Channel'},
								{value: 'setaudiostream', text: 'Set Audio Stream/Channel'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'play', text: 'Play'},
								{value: 'stop', text: 'Stop'},
								{value: 'record', text: 'Record'},
								{value: 'dsrecord', text: 'Dual Sync Record'},
								{value: 'stoprecord', text: 'Stop Recording'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setmode':
										$(div).find('.msgtextinput').val('dvrmode:<1,2,3>'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'play':
										$(div).find('.msgtextinput').val('play:<channel>,<file>,<loop(0|1)>'+eol);
										break;
									case 'stop':
										$(div).find('.msgtextinput').val('stop:<channel>'+eol);
										break;
									case 'record':
										$(div).find('.msgtextinput').val('record:<channel>,<stream>,<stream>,<duration>,<description>'+eol);
										break;
									case 'dsrecord':
										$(div).find('.msgtextinput').val('record:0,<channel>,<stream1>,<stream1>,<stream2>,<stream2>,<duration>,<description>'+eol);
										break;
									case 'stoprecord':
										$(div).find('.msgtextinput').val('recstop:<channel>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						default: break;
					}
				};
				break;
			case 'udpclient':
				ng[name].iptext = true;
				ng[name].porttext = true;
				ng[name].msgtext = true;
				ng[name].select1 = [
					{value: 'ascii', text: 'ascii'},
					{value: 'hex', text: 'hex'}
				];
				ng[name].select2 = [
					{value: 'none', text: '[SVSi...]'},
					{value: 'ncommand', text: 'N-Command'},
					{value: 'nseriesdec', text: 'N-Series Decoder'},
					{value: 'nseriesenc', text: 'N-Series Encoder'},
					{value: 'vseriesdec', text: 'V-Series Decoder'},
					{value: 'vseriesenc', text: 'V-Series Encoder'},
					{value: 'wp', text: 'Windowing Processor'},
					{value: 'n4321', text: 'N-4321'},
					{value: 'n4000', text: 'N-4000'},
					{value: 'nvr', text: 'NVR'},
				];
				$(div).find('.select2')[0].onchange = function(){
					ng[name].select3 = false;
					switch ($(div).find('.select2').val()){
						case 'ncommand':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: '(ENC/DEC) Get Status'},
								{value: 'live', text: '(ENC/DEC) Live Play'},
								{value: 'local', text: '(ENC/DEC) Local Play'},
								{value: 'serial', text: '(ENC/DEC) Serial'},
								{value: 'serialhex', text: '(ENC/DEC) Serial Hex'},
								{value: 'readresponse', text: '(ENC/DEC) Read Response'},
								{value: 'sendir', text: '(ENC/DEC) Send IR'},
								{value: 'sendirraw', text: '(ENC/DEC) Send IR Raw'},
								{value: 'audioon', text: '(ENC/DEC) Audio On'},
								{value: 'audiooff', text: '(ENC/DEC) Audio Off'},
								{value: 'enablehdmiaudio', text: '(ENC/DEC) Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: '(ENC/DEC) Disable HDMI Audio'},
								{value: 'autohdmiaudio', text: '(ENC/DEC) Auto HDMI Audio'},
								
								{value: 'encenablecc', text: '(ENC) Enable CC'},
								{value: 'encdisablecc', text: '(ENC) Disable CC'},
								{value: 'encautocc', text: '(ENC) Auto CC'},
								{value: 'encmodeoff', text: '(ENC) Mode Off'},
								
								{value: 'decswitch', text: '(DEC) Set Stream'},
								{value: 'decswitchaudio', text: '(DEC) Set Audio Stream'},
								{value: 'decaudiofollow', text: '(DEC) Audio Follow'},
								{value: 'decdvion', text: '(DEC) DVI On'},
								{value: 'decdvioff', text: '(DEC) DVI Off'},
								{value: 'deccropref', text: '(DEC) Crop Ref'},
								
								{value: 'nvrrecord', text: '(NVR) Record'},
								{value: 'nvrdsrecord', text: '(NVR) Dual Sync Record'},
								{value: 'nvrdvrswitch1', text: '(NVR) DVR Switch 1'},
								{value: 'nvrdvrswitch2', text: '(NVR) DVR Switch 2'},
								{value: 'nvrmpeg', text: '(NVR) MPEG Convert Last'},
								{value: 'nvrmpegall', text: '(NVR) MPEG Convert All'},
								{value: 'nvrdeletempegfile', text: '(NVR) Delete MPEG File'},
								{value: 'nvrplay', text: '(NVR) Play'},
								{value: 'nvrstop', text: '(NVR) Stop'},
								{value: 'nvrpause', text: '(NVR) Pause'},
								{value: 'nvrfastforward', text: '(NVR) Fast Forward'},
								{value: 'nvrrewind', text: '(NVR) Rewind'},
								{value: 'nvrdeletefile', text: '(NVR) Delete File'},
								{value: 'nvrstepforward', text: '(NVR) Step Forward'},
								{value: 'nvrstepreverse', text: '(NVR) Step Reverse'},
								{value: 'nvrstoprecord', text: '(NVR) Stop Record'},
								{value: 'nvrrecordhold', text: '(NVR) Record Hold'},
								{value: 'nvrrecordrelease', text: '(NVR) Record Release'},
								{value: 'nvrplayhold', text: '(NVR) Play Hold'},
								{value: 'nvrplayrelease', text: '(NVR) Play Release'},
								{value: 'nvrdeleteallplaylist', text: '(NVR) Delete All Playlists'},
								{value: 'nvrdeleteallmpegs', text: '(NVR) Delete All MPEGs'},
								{value: 'nvrremotecopy', text: '(NVR) Remote Copy'},
								
								{value: 'wpset', text: '(WP) Set Stream'},
								{value: 'wpaudioin', text: '(WP) Audio In'},
								{value: 'wpactive', text: '(WP) Active'},
								{value: 'wpinactive', text: '(WP) Inactive'},
								{value: 'wpaudioon', text: '(WP) Audio On'},
								{value: 'wpaudiooff', text: '(WP) Set Stream'},
								{value: 'wpmodeon', text: '(WP) Set Stream'},
								{value: 'wpmodeoff', text: '(WP) Set Stream'},
								{value: 'wparrange', text: '(WP) Arrange'},
								{value: 'wpbackground', text: '(WP) Background'},
								{value: 'wpcrop', text: '(WP) Crop'},
								{value: 'wppriority', text: '(WP) Priority'},
								{value: 'wpbordon', text: '(WP) Border On'},
								{value: 'wpbordoff', text: '(WP) Border Off'},
								{value: 'wppreset', text: '(WP) Set Preset'},
								
								{value: 'atrset', text: '(ATR) Set Stream'},
								{value: 'atrmute', text: '(ATR) Mute'},
								{value: 'atrunmute', text: '(ATR) Unmute'},
								{value: 'atrxmute', text: '(ATR) Mute Transmit'},
								{value: 'atrxunmute', text: '(ATR) Unmute Transmit'},
								{value: 'atrhpvol', text: '(ATR) Headphone Volume'},
								{value: 'atrhpvolup', text: '(ATR) Headphone Volume Up'},
								{value: 'atrhpvoldown', text: '(ATR) Headphone Volume Down'},
								{value: 'atrlovol', text: '(ATR) Lineout Volume'},
								{value: 'atrlovolup', text: '(ATR) Lineout Volume Up'},
								{value: 'atrlovoldown', text: '(ATR) Lineout Volume Down'},
								
								{value: 'videowall', text: '(VW) Video Wall'},
								{value: 'videowallswitch', text: '(VW) Set Stream'},
								
								{value: 'script', text: '(MISC) Script'},
								{value: 'tcpclient', text: '(MISC) TCP Client'},
								{value: 'udpclient', text: '(MISC) UDP Client'},
								{value: 'reboot', text: '(MISC) Reboot'},
								{value: 'gcserial', text: '(MISC) Global Cache Serial'},
								{value: 'gcopenrelay', text: '(MISC) Global Cache Open Relay'},
								{value: 'gccloserelay', text: '(MISC) Global Cache Close Relay'},
								{value: 'gcir', text: '(MISC) Global Cache IR'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'live':
										$(div).find('.msgtextinput').val('live 169.254.104.1'+eol);
										break;
									case 'local':
										$(div).find('.msgtextinput').val('local 169.254.104.1 1'+eol);
										break;
									case 'encmodeoff':
										$(div).find('.msgtextinput').val('modeoff 169.254.104.1'+eol);
										break;
									case 'serial':
										$(div).find('.msgtextinput').val('serial 169.254.104.1 29'+eol);
										break;
									case 'serialhex':
										$(div).find('.msgtextinput').val('serialhex 169.254.104.1 4f 4d 41 4e'+eol);
										break;
									case 'readresponse':
										$(div).find('.msgtextinput').val('readresponse 169.254.104.1'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir 169.254.104.1 Play'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw 169.254.104.1 0000 006C'+eol);
										break;
									case 'audioon':
										$(div).find('.msgtextinput').val('audioon 169.254.104.1'+eol);
										break;
									case 'audiooff':
										$(div).find('.msgtextinput').val('audiooff 169.254.104.1'+eol);
										break;
									case 'encenablecc':
										$(div).find('.msgtextinput').val('enablecc 169.254.104.1'+eol);
										break;
									case 'encdisablecc':
										$(div).find('.msgtextinput').val('disablecc 169.254.104.1'+eol);
										break;
									case 'encautocc':
										$(div).find('.msgtextinput').val('autocc 169.254.104.1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('enablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('disablehdmiaudio 169.254.104.1'+eol);
										break;
									case 'decswitch':
										$(div).find('.msgtextinput').val('switch 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decswitchaudio':
										$(div).find('.msgtextinput').val('switchaudio 169.254.104.1 <ip|stream>'+eol);
										break;
									case 'decaudiofollow':
										$(div).find('.msgtextinput').val('audiofollow 169.254.104.1'+eol);
										break;
									case 'decdvion':
										$(div).find('.msgtextinput').val('dvion 169.254.104.1'+eol);
										break;
									case 'decdvioff':
										$(div).find('.msgtextinput').val('dvioff 169.254.104.1'+eol);
										break;
									case 'deccropref':
										$(div).find('.msgtextinput').val('cropref 169.254.104.1 10 10 20 20'+eol);
										break;
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus 169.254.104.1'+eol);
										break;
									case 'nvrrecord':
										$(div).find('.msgtextinput').val('record 169.254.178.49 169.254.30.238 5 MY RECORDING'+eol);
										break;
									case 'nvrdsrecord':
										$(div).find('.msgtextinput').val('dsrecord 169.254.178.49 169.254.30.238 169.254.23.72 5 MY RECORDING 1 and MY RECORDING 2'+eol);
										break;
									case 'nvrswitch1':
										$(div).find('.msgtextinput').val('dvrswitch1 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrswitch2':
										$(div).find('.msgtextinput').val('dvrswitch2 169.254.178.49 169.254.30.238'+eol);
										break;
									case 'nvrmpeg':
										$(div).find('.msgtextinput').val('mpeg 169.254.178.49 latest 1 bitrate:7500000'+eol);
										break;
									case 'nvrmpegall':
										$(div).find('.msgtextinput').val('mpegall 169.254.178.49 <begin timeframe> <end timeframe> bitrate:7500000'+eol);
										break;
									case 'nvrdeletempegfile':
										$(div).find('.msgtextinput').val('deletempegfile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrplay':
										$(div).find('.msgtextinput').val('play 169.254.178.49 <index|latest> <loop|noloop> <start offset> <stop offset>'+eol);
										break;
									case 'nvrstop':
										$(div).find('.msgtextinput').val('stop 169.254.178.49'+eol);
										break;
									case 'nvrpause':
										$(div).find('.msgtextinput').val('pause 169.254.178.49'+eol);
										break;
									case 'nvrunpause':
										$(div).find('.msgtextinput').val('unpause 169.254.178.49'+eol);
										break;
									case 'nvrfastforward':
										$(div).find('.msgtextinput').val('fastforward 169.254.178.49'+eol);
										break;
									case 'nvrrewind':
										$(div).find('.msgtextinput').val('rewind 169.254.178.49'+eol);
										break;
									case 'nvrdeletefile':
										$(div).find('.msgtextinput').val('deletefile 169.254.178.49 <index|latest>'+eol);
										break;
									case 'nvrstepforward':
										$(div).find('.msgtextinput').val('stepforward 169.254.178.49'+eol);
										break;
									case 'nvrstepreverse':
										$(div).find('.msgtextinput').val('stepreverse 169.254.178.49'+eol);
										break;
									case 'nvrstoprecord':
										$(div).find('.msgtextinput').val('stoprecord 169.254.178.49'+eol);
										break;
									case 'nvrrecordhold':
										$(div).find('.msgtextinput').val('recordhold 169.254.178.49'+eol);
										break;
									case 'nvrrecordrelease':
										$(div).find('.msgtextinput').val('recordrelease 169.254.178.49'+eol);
										break;
									case 'nvrplayhold':
										$(div).find('.msgtextinput').val('playhold 169.254.178.49'+eol);
										break;
									case 'nvrplayrelease':
										$(div).find('.msgtextinput').val('playrelease 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallplaylist':
										$(div).find('.msgtextinput').val('deleteallplaylist 169.254.178.49'+eol);
										break;
									case 'nvrdeleteallmpegs':
										$(div).find('.msgtextinput').val('deleteallmpegs 169.254.178.49'+eol);
										break;
									case 'nvrremotecopy':
										$(div).find('.msgtextinput').val('remotecopy 169.254.178.49'+eol);
										break;
									case 'wpset':
										$(div).find('.msgtextinput').val('wpswitch 169.254.120.2 1 169.254.30.238'+eol);
										break;
									case 'wpaudioin':
										$(div).find('.msgtextinput').val('wpaudioin 169.254.120.2 169.254.30.238'+eol);
										break;
									case 'wpactive':
										$(div).find('.msgtextinput').val('wpactive 169.254.120.2 1'+eol);
										break;
									case 'wpinactive':
										$(div).find('.msgtextinput').val('wpinactive 169.254.120.2 1'+eol);
										break;
									case 'wpaudioon':
										$(div).find('.msgtextinput').val('wpaudioon 169.254.120.2'+eol);
										break;
									case 'wpaudiooff':
										$(div).find('.msgtextinput').val('wpaudiooff 169.254.120.2'+eol);
										break;
									case 'wpmodeon':
										$(div).find('.msgtextinput').val('wpmodeon 169.254.120.2'+eol);
										break;
									case 'wpmodeoff':
										$(div).find('.msgtextinput').val('wpmodeoff 169.254.120.2'+eol);
										break;
									case 'wparrange':
										$(div).find('.msgtextinput').val('wparrange 169.254.120.2 1 0 0 10 10'+eol);
										break;
									case 'wpbackground':
										$(div).find('.msgtextinput').val('wpbackground 169.254.120.2 1'+eol);
										break;
									case 'wpcrop':
										$(div).find('.msgtextinput').val('wpcrop 169.254.120.2 1 0 0 0 0'+eol);
										break;
									case 'wppriority':
										$(div).find('.msgtextinput').val('wppriority 169.254.120.2 1 1'+eol);
										break;
									case 'wpbordon':
										$(div).find('.msgtextinput').val('wpbordon 169.254.120.2 1'+eol);
										break;
									case 'wpbordoff':
										$(div).find('.msgtextinput').val('wpbordoff 169.254.120.2 1'+eol);
										break;
									case 'wppreset':
										$(div).find('.msgtextinput').val('wppreset 169.254.120.2 0'+eol);
										break;
									case 'atrset':
										$(div).find('.msgtextinput').val('atrswitch 169.254.252.121 169.254.30.238'+eol);
										break;
									case 'atrmute':
										$(div).find('.msgtextinput').val('atrmute 169.254.252.121'+eol);
										break;
									case 'atrunmute':
										$(div).find('.msgtextinput').val('atrunmute 169.254.252.121'+eol);
										break;
									case 'atrxmute':
										$(div).find('.msgtextinput').val('atrxmute 169.254.252.121'+eol);
										break;
									case 'atrxunmute':
										$(div).find('.msgtextinput').val('atrxunmute 169.254.252.121'+eol);
										break;
									case 'atrhpvol':
										$(div).find('.msgtextinput').val('atrhpvol 169.254.252.121 50'+eol);
										break;
									case 'atrhpvolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrhpvoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'atrlovol':
										$(div).find('.msgtextinput').val('atrlovol 169.254.252.121 50'+eol);
										break;
									case 'atrlovolup':
										$(div).find('.msgtextinput').val('atrhpvolup 169.254.252.121 5'+eol);
										break;
									case 'atrlovoldown':
										$(div).find('.msgtextinput').val('atrhpvoldown 169.254.252.121 5'+eol);
										break;
									case 'videowall':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen"'+eol);
										break;
									case 'videowallswitch':
										$(div).find('.msgtextinput').val('videowall "myVidWall" "fullScreen" <layer> <stream>'+eol);
										break;
									case 'script':
										$(div).find('.msgtextinput').val('script 33'+eol);
										break;
									case 'tcpclient':
										$(div).find('.msgtextinput').val('tcpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'udpclient':
										$(div).find('.msgtextinput').val('udpclient 192.168.10.20 50001 aa bb cc dd'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('reboot 192.168.10.20'+eol);
										break;
									case 'gcserial':
										$(div).find('.msgtextinput').val('gc_serial 192.168.1.166 1:1 6b 61 20 30 20 30 31 0d'+eol);
										break;
									case 'gcopenrelay':
										$(div).find('.msgtextinput').val('gc_openrelay 192.168.1.166 3:1'+eol);
										break;
									case 'gccloserelay':
										$(div).find('.msgtextinput').val('gc_closerelay 192.168.1.166 3:1'+eol);
										break;
									case 'gcir':
										$(div).find('.msgtextinput').val('gc_ir 169.254.250.240 4:3 sendir,1,38000,1,1,347,173,22,22'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50008');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'volume', text: 'Volume'},
								{value: 'leftvolume', text: 'Left Volume'},
								{value: 'rightvolume', text: 'Right Volume'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'setcroplocation', text: 'Set Crop Location'},
								{value: 'sendir', text: 'Send IR'},
								{value: 'sendirraw', text: 'Send IR Raw'},
								{value: 'configserial', text: 'Configure Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'leftvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'rightvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'setcroplocation':
										$(div).find('.msgtextinput').val('croppref:5,50,720,720'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmit'},
								{value: 'txdisable', text: 'Disable Transmit'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'enablescaler', text: 'Enable Scaler'},
								{value: 'disablescaler', text: 'Disable Scaler'},
								{value: 'setoutputmode', text: 'Set Scaler Mode'},
								{value: 'sendirraw', text: 'Send IR Raw'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'enablescaler':
										$(div).find('.msgtextinput').val('scalerenable'+eol);
										break;
									case 'disablescaler':
										$(div).find('.msgtextinput').val('scalerdisable'+eol);
										break;
									case 'setoutputmode':
										$(div).find('.msgtextinput').val('modeset:1080p60'+eol);
										break;
									case 'sendir':
										$(div).find('.msgtextinput').val('sendir:<commandname>'+eol);
										break;
									case 'sendirraw':
										$(div).find('.msgtextinput').val('sendirraw:0000 0006C'+eol);
										break;
									case 'configserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits>:<parity>:<stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesdec':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setstream', text: 'Set Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'setaudiofollow', text: 'Audio Follow Video'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'localplay', text: 'Local Play'},
								{value: 'dvion', text: 'DVI On'},
								{value: 'dvioff', text: 'DVI Off'},
								{value: 'writeserial', text: 'Write Serial'},
								{value: 'readserial', text: 'Read Serial'},
								{value: 'setserial', text: 'Set Serial'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'setaudiofollow':
										$(div).find('.msgtextinput').val('seta:0'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'localplay':
										$(div).find('.msgtextinput').val('local:1'+eol);
										break;
									case 'dvion':
										$(div).find('.msgtextinput').val('dviOn'+eol);
										break;
									case 'dvioff':
										$(div).find('.msgtextinput').val('dviOff'+eol);
										break;
									case 'writeserial':
										$(div).find('.msgtextinput').val('serWrite:<command>'+eol);
										break;
									case 'readserial':
										$(div).find('.msgtextinput').val('serRead'+eol);
										break;
									case 'setserial':
										$(div).find('.msgtextinput').val('serSet:<baudrate>:<databits & parity & stop>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'vseriesenc':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'liveplay', text: 'Live Play'},
								{value: 'hostplay', text: 'Host Play'},
								{value: 'streamon', text: 'Stream On'},
								{value: 'streamoff', text: 'Stream Off'},
								{value: 'enablecc', text: 'Enable CC'},
								{value: 'disablecc', text: 'Disable CC'},
								{value: 'enablehdmiaudio', text: 'Enable HDMI Audio'},
								{value: 'disablehdmiaudio', text: 'Disable HDMI Audio'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'liveplay':
										$(div).find('.msgtextinput').val('live'+eol);
										break;
									case 'hostplay':
										$(div).find('.msgtextinput').val('host:1'+eol);
										break;
									case 'streamon':
										$(div).find('.msgtextinput').val('streamOn'+eol);
										break;
									case 'streamoff':
										$(div).find('.msgtextinput').val('streamOff'+eol);
										break;
									case 'enablecc':
										$(div).find('.msgtextinput').val('advClr:1'+eol);
										break;
									case 'disablecc':
										$(div).find('.msgtextinput').val('advSet:1'+eol);
										break;
									case 'enablehdmiaudio':
										$(div).find('.msgtextinput').val('advSet:4'+eol);
										break;
									case 'disablehdmiaudio':
										$(div).find('.msgtextinput').val('advClr:4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4321':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
								{value: 'linputgainpre', text: 'Left Input Gain(pre)'},
								{value: 'rinputgainpre', text: 'Right Input Gain(pre)'},
								{value: 'linputgainpost', text: 'Left Input Gain(post)'},
								{value: 'rinputgainpost', text: 'Right Input Gain(post)'},
								{value: 'reboot', text: 'Reboot'},
								{value: 'relay1', text: 'Relay 1 State'},
								{value: 'relay2', text: 'Relay 2 State'},
								{value: 'phantompower', text: 'Phantom Power'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									case 'linputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainleft:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'rinputgainpre':
										$(div).find('.msgtextinput').val('setSettings:inputgainright:<-12,-10.5,-9,-7.5,-6,-4.5,-3,-1.5,0>'+eol);
										break;
									case 'linputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcLeftGain:<0-59>'+eol);
										break;
									case 'rinputgainpost':
										$(div).find('.msgtextinput').val('setSettings:adcRightGain:<0-59>'+eol);
										break;
									case 'reboot':
										$(div).find('.msgtextinput').val('setSettings:reboot'+eol);
										break;
									case 'relay1':
										$(div).find('.msgtextinput').val('setSettings:relay1State:<open|close>'+eol);
										break;
									case 'relay2':
										$(div).find('.msgtextinput').val('setSettings:relay2State:<open|close>'+eol);
										break;
									case 'phantompower':
										$(div).find('.msgtextinput').val('setSettings:phantomPower:<on|off>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'n4000':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'txenable', text: 'Enable Transmitter'},
								{value: 'txdisable', text: 'Disable Transmitter'},
								{value: 'rxenable', text: 'Enable Decoder'},
								{value: 'rxdisable', text: 'Disable Decoder'},
								{value: 'volume', text: 'Headphone Volume'},
								{value: 'lvolume', text: 'Left Headphone Volume'},
								{value: 'rvolume', text: 'Right Headphone Volume'},
								{value: 'outvolume', text: 'Line Out Volume'},
								{value: 'loutvolume', text: 'Left Line Out Volume'},
								{value: 'routvolume', text: 'Right Line Out Volume'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'txenable':
										$(div).find('.msgtextinput').val('txenable'+eol);
										break;
									case 'txdisable':
										$(div).find('.msgtextinput').val('txdisable'+eol);
										break;
									case 'rxenable':
										$(div).find('.msgtextinput').val('rxenable'+eol);
										break;
									case 'rxdisable':
										$(div).find('.msgtextinput').val('rxdisable'+eol);
										break;
									case 'volume':
										$(div).find('.msgtextinput').val('hpvol:50'+eol);
										break;
									case 'lvolume':
										$(div).find('.msgtextinput').val('hpvolleft:50'+eol);
										break;
									case 'rvolume':
										$(div).find('.msgtextinput').val('hpvolright:50'+eol);
										break;
									case 'outvolume':
										$(div).find('.msgtextinput').val('lovol:50'+eol);
										break;
									case 'loutvolume':
										$(div).find('.msgtextinput').val('lovolleft:50'+eol);
										break;
									case 'routvolume':
										$(div).find('.msgtextinput').val('lovolright:50'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'wp':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setpreset', text: 'Set Preset'},
								{value: 'setwindowstream', text: 'Set Window Stream'},
								{value: 'setaudiostream', text: 'Set Audio Stream'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'outputmode', text: 'Set Scaler Mode'},
								{value: 'priority', text: 'Set Window Priority'},
								{value: 'enablewindow', text: 'Enable Window'},
								{value: 'disablewindow', text: 'Disable Window'},
								{value: 'enableborder', text: 'Enable Border'},
								{value: 'disableborder', text: 'Disable Border'},
								{value: 'setborderwidth', text: 'Set Border Width'},
								{value: 'setbordercolor', text: 'Set Border Color'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setpreset':
										$(div).find('.msgtextinput').val('preset:1'+eol);
										break;
									case 'setwindowstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'outputmode':
										$(div).find('.msgtextinput').val('modeset:1080p'+eol);
										break;
									case 'enablewindow':
										$(div).find('.msgtextinput').val('winon:0'+eol);
										break;
									case 'disablewindow':
										$(div).find('.msgtextinput').val('winoff:0'+eol);
										break;
									case 'enableborder':
										$(div).find('.msgtextinput').val('bordon:0'+eol);
										break;
									case 'disableborder':
										$(div).find('.msgtextinput').val('bordoff:0'+eol);
										break;
									case 'setborderwidth':
										$(div).find('.msgtextinput').val('setbord:0:4,4'+eol);
										break;
									case 'setbordercolor':
										$(div).find('.msgtextinput').val('setbordcol:0:4,4'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						case 'nvr':
							ng[name].select3 = [
								{value: 'none', text: '[Command...]'},
								{value: 'getstatus', text: 'Get Status'},
								{value: 'setmode', text: 'Set NVR Mode'},
								{value: 'setstream', text: 'Set Stream/Channel'},
								{value: 'setaudiostream', text: 'Set Audio Stream/Channel'},
								{value: 'mute', text: 'Mute'},
								{value: 'unmute', text: 'Unmute'},
								{value: 'play', text: 'Play'},
								{value: 'stop', text: 'Stop'},
								{value: 'record', text: 'Record'},
								{value: 'dsrecord', text: 'Dual Sync Record'},
								{value: 'stoprecord', text: 'Stop Recording'},
							];
							$(div).find('.select3')[0].onchange = function(){
								switch ($(div).find('.select3').val()){
									case 'getstatus':
										$(div).find('.msgtextinput').val('getStatus'+eol);
										break;
									case 'setmode':
										$(div).find('.msgtextinput').val('dvrmode:<1,2,3>'+eol);
										break;
									case 'setstream':
										$(div).find('.msgtextinput').val('set:<window>:1'+eol);
										break;
									case 'setaudiostream':
										$(div).find('.msgtextinput').val('seta:1'+eol);
										break;
									case 'mute':
										$(div).find('.msgtextinput').val('mute'+eol);
										break;
									case 'unmute':
										$(div).find('.msgtextinput').val('unmute'+eol);
										break;
									case 'play':
										$(div).find('.msgtextinput').val('play:<channel>,<file>,<loop(0|1)>'+eol);
										break;
									case 'stop':
										$(div).find('.msgtextinput').val('stop:<channel>'+eol);
										break;
									case 'record':
										$(div).find('.msgtextinput').val('record:<channel>,<stream>,<stream>,<duration>,<description>'+eol);
										break;
									case 'dsrecord':
										$(div).find('.msgtextinput').val('record:0,<channel>,<stream1>,<stream1>,<stream2>,<stream2>,<duration>,<description>'+eol);
										break;
									case 'stoprecord':
										$(div).find('.msgtextinput').val('recstop:<channel>'+eol);
										break;
									default:
										return;
								}
								$(div).find('.porttextinput').val('50001');
								$(div).find('.select1').val('ascii');
							}
							break;
						default: break;
					}
				};
				break;
			case 'get':
				ng[name].itemtext = true;
				ng[name].select1 = [
					{value: 'none', text: '[effect...]'},
					{value: 'show', text: 'Show'},
					{value: 'hide', text: 'Hide'},
					{value: 'fadein', text: 'Fade In'},
					{value: 'fadeout', text: 'Fade Out'},
					{value: 'setstate', text: 'Set State'},
					{value: 'getstate', text: 'Get State'},
					{value: 'settext', text: 'Set Text'},
					{value: 'gettext', text: 'Get Text'},
					{value: 'setsize', text: 'Set Size'},
					{value: 'setposition', text: 'Set Position'},
					{value: 'setstyle', text: 'Set Style'},
					{value: 'settextstyle', text: 'Set Text Style'},
					{value: 'setbgimage', text: 'Set BG Image'},
					{value: 'setbgcolor', text: 'Set BG Color'},
					{value: 'animate', text: 'Animate'},
					{value: 'animate3d', text: 'Animate 3D'},
					{value: 'clickeffect', text: 'Click Effect'},
					{value: 'clickevent', text: 'Click Event'}
				];
				$(div).find('.select1')[0].onchange = function(){
					ng[name].textbox1 = ng[name].textbox2 =
					ng[name].textbox3 = false;
					ng[name].select2 = ng[name].select3 =
					ng[name].select4 = false;
					ng[name].file1 = false;
					switch ($(div).find('.select1').val()){
						case 'fadein':
							ng[name].textbox1 = {placeholder: 'time(sec)', style: 'width: 50px;'};
							break;
						case 'fadeout':
							ng[name].textbox1 = {placeholder: 'time(sec)', style: 'width: 50px;'};
							break;
						case 'settext':
							ng[name].textbox1 = {placeholder: 'text', style: 'width: 100px;'};
							break;
						case 'setsize':
							ng[name].textbox1 = {placeholder: 'width(px)', style: 'width: 70px;'};
							ng[name].textbox2 = {placeholder: 'height(px)', style: 'width: 70px;'};
							break;
						case 'setposition':
							ng[name].textbox1 = {placeholder: 'x(px)', style: 'width: 70px;'};
							ng[name].textbox2 = {placeholder: 'y(px)', style: 'width: 70px;'};
							break;
						case 'setstyle':
							ng[name].textbox1 = {placeholder: '{width: "80px", height: "80px"}', style: 'width: 220px;'};
							break;
						case 'settextstyle':
							ng[name].textbox1 = {placeholder: '{color: "black", "font-size": "22px"}', style: 'width: 220px;'};
							break;
						case 'setbgimage':
							ng[name].textbox1 = {placeholder: 'filename', style: 'width: 120px;'};
							break;
						case 'setbgcolor':
							ng[name].textbox1 = {placeholder: 'color', style: 'width: 120px;'};
							break;
						case 'animate':
							ng[name].textbox1 = {placeholder: '{left: "+=80px"}', style: 'width: 150px;'};
							ng[name].textbox2 = {placeholder: 'time(sec)', style: 'width: 150px;'};
							ng[name].select2 = [
								{value: 'linear', text: '[easing...]'},
								{value: 'linear', text: 'Linear'},
								{value: 'easeInQuad', text: 'Quadratic In'},
								{value: 'easeOutQuad', text: 'Quadratic Out'},
								{value: 'easeInOutQuad', text: 'Quadratic In Out'},
								{value: 'easeInCubic', text: 'Cubic In'},
								{value: 'easeOutCubic', text: 'Cubic Out'},
								{value: 'easeInOutCubic', text: 'Cubic In Out'},
								{value: 'easeInQuart', text: 'Quartic In'},
								{value: 'easeOutQuart', text: 'Quartic Out'},
								{value: 'easeInOutQuart', text: 'Quartic In Out'},
								{value: 'easeInQuint', text: 'Quintic In'},
								{value: 'easeOutQuint', text: 'Quintic Out'},
								{value: 'easeInOutQuint', text: 'Quintic In Out'},
								{value: 'easeInSine', text: 'Sine In'},
								{value: 'easeOutSine', text: 'Sine Out'},
								{value: 'easeInOutSine', text: 'Sine In Out'},
								{value: 'easeInExpo', text: 'Exponential In'},
								{value: 'easeOutExpo', text: 'Exponential Out'},
								{value: 'easeInOutExpo', text: 'Exponential In Out'},
								{value: 'easeInCirc', text: 'Circular In'},
								{value: 'easeOutCirc', text: 'Circular Out'},
								{value: 'easeInOutCirc', text: 'Circular In Out'},
								{value: 'easeInElastic', text: 'Elastic In'},
								{value: 'easeOutElastic', text: 'Elastic Out'},
								{value: 'easeInOutElastic', text: 'Elastic In Out'},
								{value: 'easeInBack', text: 'Back In'},
								{value: 'easeOutBack', text: 'Back Out'},
								{value: 'easeInOutBack', text: 'Back In Out'},
								{value: 'easeInBounce', text: 'Bounce In'},
								{value: 'easeOutBounce', text: 'Bounce Out'},
								{value: 'easeInOutBounce', text: 'Bounce In Out'}
							];
							break;
						case 'animate3d':
							ng[name].textbox1 = {placeholder: '{rotate: 0.0}', style: 'width: 150px;'};
							ng[name].textbox2 = {placeholder: '{rotate: Math.PI*2}', style: 'width: 150px;'};
							ng[name].textbox3 = {placeholder: 'time(sec)', style: 'width: 150px;'};
							ng[name].select2 = [
								{value: 'linear', text: '[easing...]'},
								{value: 'linear', text: 'Linear'},
								{value: 'easeInQuad', text: 'Quadratic In'},
								{value: 'easeOutQuad', text: 'Quadratic Out'},
								{value: 'easeInOutQuad', text: 'Quadratic In Out'},
								{value: 'easeInCubic', text: 'Cubic In'},
								{value: 'easeOutCubic', text: 'Cubic Out'},
								{value: 'easeInOutCubic', text: 'Cubic In Out'},
								{value: 'easeInQuart', text: 'Quartic In'},
								{value: 'easeOutQuart', text: 'Quartic Out'},
								{value: 'easeInOutQuart', text: 'Quartic In Out'},
								{value: 'easeInQuint', text: 'Quintic In'},
								{value: 'easeOutQuint', text: 'Quintic Out'},
								{value: 'easeInOutQuint', text: 'Quintic In Out'},
								{value: 'easeInSine', text: 'Sine In'},
								{value: 'easeOutSine', text: 'Sine Out'},
								{value: 'easeInOutSine', text: 'Sine In Out'},
								{value: 'easeInExpo', text: 'Exponential In'},
								{value: 'easeOutExpo', text: 'Exponential Out'},
								{value: 'easeInOutExpo', text: 'Exponential In Out'},
								{value: 'easeInCirc', text: 'Circular In'},
								{value: 'easeOutCirc', text: 'Circular Out'},
								{value: 'easeInOutCirc', text: 'Circular In Out'},
								{value: 'easeInElastic', text: 'Elastic In'},
								{value: 'easeOutElastic', text: 'Elastic Out'},
								{value: 'easeInOutElastic', text: 'Elastic In Out'},
								{value: 'easeInBack', text: 'Back In'},
								{value: 'easeOutBack', text: 'Back Out'},
								{value: 'easeInOutBack', text: 'Back In Out'},
								{value: 'easeInBounce', text: 'Bounce In'},
								{value: 'easeOutBounce', text: 'Bounce Out'},
								{value: 'easeInOutBounce', text: 'Bounce In Out'}
							];
							break;
						case 'clickeffect':
							ng[name].select2 = [
								{value: 'none', text: '[effect...]'},
								{value: 'none', text: 'None'},
								{value: 'scale', text: 'Scale'},
							];
							break;
						default: break;
					}
				}
				setTimeout(function(){$(div).find('.select1').change();}, 20);
				break;
			case 'self':
				ng[name].select1 = [
					{value: 'none', text: '[effect...]'},
					{value: 'show', text: 'Show'},
					{value: 'hide', text: 'Hide'},
					{value: 'fadein', text: 'Fade In'},
					{value: 'fadeout', text: 'Fade Out'},
					{value: 'setstate', text: 'Set State'},
					{value: 'getstate', text: 'Get State'},
					{value: 'settext', text: 'Set Text'},
					{value: 'gettext', text: 'Get Text'},
					{value: 'setsize', text: 'Set Size'},
					{value: 'setposition', text: 'Set Position'},
					{value: 'setstyle', text: 'Set Style'},
					{value: 'settextstyle', text: 'Set Text Style'},
					{value: 'setbgimage', text: 'Set BG Image'},
					{value: 'setbgcolor', text: 'Set BG Color'},
					{value: 'animate', text: 'Animate'},
					{value: 'animate3d', text: 'Animate 3D'},
					{value: 'clickeffect', text: 'Click Effect'},
					{value: 'clickevent', text: 'Click Event'}
				];
				$(div).find('.select1')[0].onchange = function(){
					$(div).find('.textbox1').val(''); $(div).find('.textbox2').val('');
					ng[name].textbox1 = ng[name].textbox2 = false;
					ng[name].select2 = ng[name].select3 =
					ng[name].select4 = false;
					ng[name].file1 = false;
					switch ($(div).find('.select1').val()){
						case 'fadein':
							ng[name].textbox1 = {placeholder: 'time(sec)', style: 'width: 50px;'};
							break;
						case 'fadeout':
							ng[name].textbox1 = {placeholder: 'time(sec)', style: 'width: 50px;'};
							break;
						case 'settext':
							ng[name].textbox1 = {placeholder: 'text', style: 'width: 100px;'};
							break;
						case 'setsize':
							ng[name].textbox1 = {placeholder: 'width(px)', style: 'width: 70px;'};
							ng[name].textbox2 = {placeholder: 'height(px)', style: 'width: 70px;'};
							break;
						case 'setposition':
							ng[name].textbox1 = {placeholder: 'x(px)', style: 'width: 70px;'};
							ng[name].textbox2 = {placeholder: 'y(px)', style: 'width: 70px;'};
							break;
						case 'setstyle':
							ng[name].textbox1 = {placeholder: '{width: "80px", height: "80px"}', style: 'width: 220px;'};
							break;
						case 'settextstyle':
							ng[name].textbox1 = {placeholder: '{color: "black", "font-size": "22px"}', style: 'width: 220px;'};
							break;
						case 'setbgimage':
							ng[name].textbox1 = {placeholder: 'filename', style: 'width: 120px;'};
							var fileInput = $(div).find('.file1')[0];
							fileInput.addEventListener('change', function(e){
								
								var file = fileInput.files[0];
								var fd = new FormData();
								fd.append("image", file);
								var opts = {command: 'write_image'};
								if (pb.project.puid) opts.puid = pb.project.puid;
								fd.append("opts", JSON.stringify(opts));
							
								server({formdata: fd, callback: function(data){
									
									var tstr = data.substring(data.indexOf('/images/')+8);
									$(div).find('.textbox1').val(tstr);
									
									var found = false;
									for (var i=0; i<pb.assets['user'].length; i++){
										if (pb.assets['user'][i].core.data == data) found = true;
									}
									if (!found){
										var newasset = new Asset({data: data});
										newasset.element.style.backgroundImage = 'url(' + data + ')';
										newasset.element.style.backgroundSize = '100% 100%';
										newasset.element.className += ' cloneable draggable';
										$('#assets-images-pane-list').append(newasset.element);
									}
									pb.checkDiskSize();
									
								}});
								
							});
							ng[name].file1 = true;
							break;
						case 'setbgcolor':
							ng[name].textbox1 = {placeholder: 'color', style: 'width: 120px;'};
							break;
						case 'animate':
							ng[name].textbox1 = {placeholder: '{left: "+=80px"}', style: 'width: 150px;'};
							ng[name].textbox2 = {placeholder: 'time(sec)', style: 'width: 150px;'};
							ng[name].select2 = [
								{value: 'linear', text: '[easing...]'},
								{value: 'linear', text: 'Linear'},
								{value: 'easeInQuad', text: 'Quadratic In'},
								{value: 'easeOutQuad', text: 'Quadratic Out'},
								{value: 'easeInOutQuad', text: 'Quadratic In Out'},
								{value: 'easeInCubic', text: 'Cubic In'},
								{value: 'easeOutCubic', text: 'Cubic Out'},
								{value: 'easeInOutCubic', text: 'Cubic In Out'},
								{value: 'easeInQuart', text: 'Quartic In'},
								{value: 'easeOutQuart', text: 'Quartic Out'},
								{value: 'easeInOutQuart', text: 'Quartic In Out'},
								{value: 'easeInQuint', text: 'Quintic In'},
								{value: 'easeOutQuint', text: 'Quintic Out'},
								{value: 'easeInOutQuint', text: 'Quintic In Out'},
								{value: 'easeInSine', text: 'Sine In'},
								{value: 'easeOutSine', text: 'Sine Out'},
								{value: 'easeInOutSine', text: 'Sine In Out'},
								{value: 'easeInExpo', text: 'Exponential In'},
								{value: 'easeOutExpo', text: 'Exponential Out'},
								{value: 'easeInOutExpo', text: 'Exponential In Out'},
								{value: 'easeInCirc', text: 'Circular In'},
								{value: 'easeOutCirc', text: 'Circular Out'},
								{value: 'easeInOutCirc', text: 'Circular In Out'},
								{value: 'easeInElastic', text: 'Elastic In'},
								{value: 'easeOutElastic', text: 'Elastic Out'},
								{value: 'easeInOutElastic', text: 'Elastic In Out'},
								{value: 'easeInBack', text: 'Back In'},
								{value: 'easeOutBack', text: 'Back Out'},
								{value: 'easeInOutBack', text: 'Back In Out'},
								{value: 'easeInBounce', text: 'Bounce In'},
								{value: 'easeOutBounce', text: 'Bounce Out'},
								{value: 'easeInOutBounce', text: 'Bounce In Out'}
							];
							break;
						case 'animate3d':
							ng[name].textbox1 = {placeholder: '{rotate: 0.0}', style: 'width: 150px;'};
							ng[name].textbox2 = {placeholder: '{rotate: Math.PI*2}', style: 'width: 150px;'};
							ng[name].textbox3 = {placeholder: 'time(sec)', style: 'width: 150px;'};
							ng[name].select2 = [
								{value: 'linear', text: '[easing...]'},
								{value: 'linear', text: 'Linear'},
								{value: 'easeInQuad', text: 'Quadratic In'},
								{value: 'easeOutQuad', text: 'Quadratic Out'},
								{value: 'easeInOutQuad', text: 'Quadratic In Out'},
								{value: 'easeInCubic', text: 'Cubic In'},
								{value: 'easeOutCubic', text: 'Cubic Out'},
								{value: 'easeInOutCubic', text: 'Cubic In Out'},
								{value: 'easeInQuart', text: 'Quartic In'},
								{value: 'easeOutQuart', text: 'Quartic Out'},
								{value: 'easeInOutQuart', text: 'Quartic In Out'},
								{value: 'easeInQuint', text: 'Quintic In'},
								{value: 'easeOutQuint', text: 'Quintic Out'},
								{value: 'easeInOutQuint', text: 'Quintic In Out'},
								{value: 'easeInSine', text: 'Sine In'},
								{value: 'easeOutSine', text: 'Sine Out'},
								{value: 'easeInOutSine', text: 'Sine In Out'},
								{value: 'easeInExpo', text: 'Exponential In'},
								{value: 'easeOutExpo', text: 'Exponential Out'},
								{value: 'easeInOutExpo', text: 'Exponential In Out'},
								{value: 'easeInCirc', text: 'Circular In'},
								{value: 'easeOutCirc', text: 'Circular Out'},
								{value: 'easeInOutCirc', text: 'Circular In Out'},
								{value: 'easeInElastic', text: 'Elastic In'},
								{value: 'easeOutElastic', text: 'Elastic Out'},
								{value: 'easeInOutElastic', text: 'Elastic In Out'},
								{value: 'easeInBack', text: 'Back In'},
								{value: 'easeOutBack', text: 'Back Out'},
								{value: 'easeInOutBack', text: 'Back In Out'},
								{value: 'easeInBounce', text: 'Bounce In'},
								{value: 'easeOutBounce', text: 'Bounce Out'},
								{value: 'easeInOutBounce', text: 'Bounce In Out'}
							];
							break;
						case 'clickeffect':
							ng[name].select2 = [
								{value: 'none', text: '[effect...]'},
								{value: 'none', text: 'None'},
								{value: 'scale', text: 'Scale'},
							];
							break;
						default: break;
					}
				}
				setTimeout(function(){$(div).find('.select1').change();}, 20);
				break;
			case 'asciitohex':
				ng[name].textbox1 = {placeholder: 'text', style: 'width: 90px;'};
				break;
			case 'hextoascii':
				ng[name].textbox1 = {placeholder: '00 01 02 03', style: 'width: 90px;'};
				break;
			default:
				break;
		}
	};
	$(div).find('.command-select')[0].onchange();
	$(div).find('.add-command')[0].onclick = function(){
		switch ($(div).find('.command-select').val()){
			case 'require':
				editor.setValue(editor.getValue() +
					"\n//requires a Javascript module\nrequire('"+$(div).find('.select2').val()+"');\n", 1
				);
				break;
			case 'gotopanel':
				editor.setValue(editor.getValue() +
					"\n//move user to another panel\ngotopanel('"+$(div).find('.select1').val()+"');\n", 1
				);
				break;
			case 'module':
				if (window.module_command_list[$(div).find('.select3').val()].comment) 
					var comment = window.module_command_list[$(div).find('.select3').val()].comment;
				else
					var comment = '';
				editor.setValue(editor.getValue() +
					"\n"+window.module_command_list[$(div).find('.select3').val()].func+" "+comment+"\n", 1
				);
				break;
			case 'tcpopen':
				var ip = $(div).find('.iptextinput').val() || '192.168.1.12';
				var port = $(div).find('.porttextinput').val() || 50001;
				editor.setValue(editor.getValue() +
					"\n//opens a connection to a device, also returns a usable object\nmyTCP = tcpopen('"+
						ip+"', "+port+
						");\n//myTCP.send(asciiToHex('message/data'), function onResponse(response){myResponse = response; myTCP.close();});\n"
				, 1);
				break;
			case 'tcpsend':
				var ip = $(div).find('.iptextinput').val() || '192.168.1.12';
				var port = $(div).find('.porttextinput').val() || 50001;
				var msg = $(div).find('.msgtextinput').val() || 'message/data';
				if ($(div).find('.select1').val() == 'ascii'){
					var ascorhex = 'asciiToHex(';
					var ascorhex2 = ')';
				}
				else {
					var ascorhex = '';
					var ascorhex2 = '';
				}
				editor.setValue(editor.getValue() +
					"\n//sends message/data to a device\ntcpsend('"+
					ip+"', "+port+", "+ascorhex+"'"+msg+"'"+ascorhex2+
					", function onResponse(response){myResponse = response});\n", 1
				);
				break;
			case 'tcpclose':
				var ip = $(div).find('.iptextinput').val() || '192.168.1.12';
				var port = $(div).find('.porttextinput').val() || 50001;
				editor.setValue(editor.getValue() +
					"\n//closes a connection to a device\ntcpclose('"+ip+"', "+port+");\n", 1
				);
				break;
			case 'tcpclient':
				var ip = $(div).find('.iptextinput').val() || '192.168.1.12';
				var port = $(div).find('.porttextinput').val() || 50001;
				var msg = $(div).find('.msgtextinput').val() || 'message/data';
				if ($(div).find('.select1').val() == 'ascii'){
					var ascorhex = 'asciiToHex(';
					var ascorhex2 = ')';
				}
				else {
					var ascorhex = '';
					var ascorhex2 = '';
				}
				editor.setValue(editor.getValue() +
					"\n//sends message/data to a device\ntcpclient('"+
					ip+"', "+port+", "+ascorhex+"'"+msg+"'"+ascorhex2+
					");\n", 1
				);
				break;
			case 'udpclient':
				var ip = $(div).find('.iptextinput').val() || '192.168.1.12';
				var port = $(div).find('.porttextinput').val() || 50001;
				var msg = $(div).find('.msgtextinput').val() || 'message/data';
				if ($(div).find('.select1').val() == 'ascii'){
					var ascorhex = 'asciiToHex(';
					var ascorhex2 = ')';
				}
				else {
					var ascorhex = '';
					var ascorhex2 = '';
				}
				editor.setValue(editor.getValue() +
					"\n//sends message/data to a device\nudpclient('"+
					ip+"', "+port+", "+ascorhex+"'"+msg+"'"+ascorhex2+
					");\n", 1
				);
				break;
			case 'get':
				var id = $('.itemtextinput').val() || 'Button-1';
				if ($(div).find('.select1').val() == 'none'){
					editor.setValue(editor.getValue() +"get('"+id+"');", 1);
				}
				else {
					switch ($(div).find('.select1').val()){
						case 'show':
							editor.setValue(editor.getValue() +"get('"+id+"').show();", 1);
							break;
						case 'hide':
							editor.setValue(editor.getValue() +"get('"+id+"').hide();", 1);
							break;
						case 'fadein':
							var v = $(div).find('.textbox1').val() || 0.3;
							editor.setValue(editor.getValue() +"get('"+id+"').fadein("+v+");", 1);
							break;
						case 'fadeout':
							var v = $(div).find('.textbox1').val() || 0.3;
							editor.setValue(editor.getValue() +"get('"+id+"').fadeout(0.3);", 1);
							break;
						case 'setstate':
							editor.setValue(editor.getValue() +"get('"+id+"').setState('state1');", 1);
							break;
						case 'getstate':
							editor.setValue(editor.getValue() +"get('"+id+"').getState();", 1);
							break;
						case 'settext':
							var v = $(div).find('.textbox1').val() || 'text';
							editor.setValue(editor.getValue() +"get('"+id+"').setText("+v+");", 1);
							break;
						case 'gettext':
							editor.setValue(editor.getValue() +"myText = get('"+id+"').getText();", 1);
							break;
						case 'setsize':
							var w = $(div).find('.textbox1').val() || 'null';
							var h = $(div).find('.textbox2').val() || 'null';
							editor.setValue(editor.getValue() +"get('"+id+"').setSize("+w+","+h+");", 1);
							break;
						case 'setposition':
							var x = $(div).find('.textbox1').val() || 'null';
							var y = $(div).find('.textbox2').val() || 'null';
							editor.setValue(editor.getValue() +"get('"+id+"').setPositionCenter("+x+","+y+");", 1);
							break;
						case 'setstyle':
							var s = $(div).find('.textbox1').val() || '{width: "80px", height: "80px"}';
							editor.setValue(editor.getValue() +"get('"+id+"').setStyle("+s+");", 1);
							break;
						case 'settextstyle':
							var s = $(div).find('.textbox1').val() || '{color: "black", "font-size": "22px"}';
							editor.setValue(editor.getValue() +"get('"+id+"').setTextStyle("+s+");", 1);
							break;
						case 'setbgimage':
							var s = $(div).find('.textbox1').val() || 'myImage.png';
							editor.setValue(editor.getValue() +"get('"+id+"').setBackgroundImage("+s+");", 1);
							break;
						case 'setbgcolor':
							var s = $(div).find('.textbox1').val() || 'white';
							editor.setValue(editor.getValue() +"get('"+id+"').setBackgroundColor("+s+");", 1);
							break;
						case 'animate':
							var props = $(div).find('.textbox1').val() || '{left: "+=80px"}';
							var time = $(div).find('.textbox2').val() || 0.3;
							var ease = $(div).find('.select2').val() || 'linear';
							editor.setValue(editor.getValue() +"get('"+id+"').animate("+props+", "+time+", '"+ease+"');", 1);
							break;
						case 'animate3d':
							var from = $(div).find('.textbox1').val() || '{rotate: 0.0}';
							var to = $(div).find('.textbox2').val() || '{rotate: Math.PI*2}';
							var time = $(div).find('.textbox3').val() || 1.0;
							var ease = $(div).find('.select2').val() || 'linear';
							editor.setValue(editor.getValue() +"get('"+id+"').animate3d({from: "+
								from+", to: "+to+", time: "+time+", ease: '"+ease+"'});", 1);
							break;
						case 'clickeffect':
							switch ($(div).find('.select2').val()){
								default: case 'none':
									editor.setValue(editor.getValue() +'\
get("'+id+'").clickEffect.down = function(self){};\n\
get("'+id+'").clickEffect.up = function(self){};\n', 1);
									break;
								case 'scale':
									editor.setValue(editor.getValue() +'\
get("'+id+'").clickEffect.down = function(self){\n\
tweencss({\n\
object: self.element,\n\
time: 0.08,\n\
props: {scale: 1.0},\n\
to: {scale: 1.14}\n\
});\n\
}\n\
get("'+id+'").clickEffect.up = function(self){\n\
tweencss({\n\
object: self.element,\n\
time: 0.08,\n\
props: {scale: 1.14},\n\
to: {scale: 1.0}\n\
});\n\
}\n', 1);
									break;
							}
							break;
						case 'clickevent':
							editor.setValue(editor.getValue() +'\
get("'+id+'").clickEvent.down = function(self){\n\
//self.doSomething();\n\
}\n\
get("'+id+'").clickEvent.up = function(self){\n\
//self.doSomething();\n\
}\n', 1);
							break;
						default: break;
					}
				}
				break;
			case 'self':
				var id = $('.itemtextinput').val() || 'Button-1';
				if ($(div).find('.select1').val() == 'none'){
					editor.setValue(editor.getValue() +"myItem = self;", 1);
				}
				else {
					switch ($(div).find('.select1').val()){
						case 'show':
							editor.setValue(editor.getValue() +"self.show();", 1);
							break;
						case 'hide':
							editor.setValue(editor.getValue() +"self.hide();", 1);
							break;
						case 'fadein':
							var v = $(div).find('.textbox1').val() || 0.3;
							editor.setValue(editor.getValue() +"self.fadein("+v+");", 1);
							break;
						case 'fadeout':
							var v = $(div).find('.textbox1').val() || 0.3;
							editor.setValue(editor.getValue() +"self.fadeout("+v+");", 1);
							break;
						case 'setstate':
							editor.setValue(editor.getValue() +"self.setState('state1');", 1);
							break;
						case 'getstate':
							editor.setValue(editor.getValue() +"self.getState();", 1);
							break;
						case 'settext':
							var v = $(div).find('.textbox1').val() || 'text';
							editor.setValue(editor.getValue() +"self.setText('"+v+"');", 1);
							break;
						case 'gettext':
							editor.setValue(editor.getValue() +"myText = self.getText();", 1);
							break;
						case 'setsize':
							var w = $(div).find('.textbox1').val() || 'null';
							var h = $(div).find('.textbox2').val() || 'null';
							editor.setValue(editor.getValue() +"self.setSize("+w+","+h+");", 1);
							break;
						case 'setposition':
							var x = $(div).find('.textbox1').val() || 'null';
							var y = $(div).find('.textbox2').val() || 'null';
							editor.setValue(editor.getValue() +"self.setPositionCenter("+x+","+y+");", 1);
							break;
						case 'setstyle':
							var s = $(div).find('.textbox1').val() || '{width: "80px", height: "80px"}';
							editor.setValue(editor.getValue() +"self.setStyle("+s+");", 1);
							break;
						case 'settextstyle':
							var s = $(div).find('.textbox1').val() || '{color: "black", "font-size": "22px"}';
							editor.setValue(editor.getValue() +"self.setTextStyle("+s+");", 1);
							break;
						case 'setbgimage':
							var s = $(div).find('.textbox1').val() || 'myImage.png';
							editor.setValue(editor.getValue() +"self.setBackgroundImage('"+s+"');", 1);
							break;
						case 'setbgcolor':
							var s = $(div).find('.textbox1').val() || 'white';
							editor.setValue(editor.getValue() +"self.setBackgroundColor('"+s+"');", 1);
							break;
						case 'animate':
							var props = $(div).find('.textbox1').val() || '{left: "+=80px"}';
							var time = $(div).find('.textbox2').val() || 0.3;
							var ease = $(div).find('.select2').val() || 'linear';
							editor.setValue(editor.getValue() +"self.animate("+props+", "+time+", '"+ease+"');", 1);
							break;
						case 'animate3d':
							var from = $(div).find('.textbox1').val() || '{rotate: 0.0}';
							var to = $(div).find('.textbox2').val() || '{rotate: Math.PI*2}';
							var time = $(div).find('.textbox1').val() || 1.0;
							var ease = $(div).find('.select2').val() || 'linear';
							editor.setValue(editor.getValue() +"self.animate3d({from: "+from+", to: "+to+", time: "+time+", ease: '"+ease+"'});", 1);
							break;
						case 'clickeffect':
							switch ($(div).find('.select2').val()){
								default: case 'none':
									editor.setValue(editor.getValue() +'\
self.clickEffect.down = function(self){};\n\
self.clickEffect.up = function(self){};\n', 1);
									break;
								case 'scale':
									editor.setValue(editor.getValue() +'\
self.clickEffect.down = function(self){\n\
tweencss({\n\
object: self.element,\n\
time: 0.08,\n\
props: {scale: 1.0},\n\
to: {scale: 1.14}\n\
});\n\
}\n\
self.clickEffect.up = function(self){\n\
tweencss({\n\
object: self.element,\n\
time: 0.08,\n\
props: {scale: 1.14},\n\
to: {scale: 1.0}\n\
});\n\
}\n', 1);
									break;
							}
							break;
						case 'clickevent':
							editor.setValue(editor.getValue() +'\
self.clickEvent.down = function(self){\n\
//self.doSomething();\n\
}\n\
self.clickEvent.up = function(self){\n\
//self.doSomething();\n\
}\n', 1);
							break;
						default: break;
					}
				}
				break;
			case 'asciitohex':
				var text = $(div).find('.textbox1').val() || 'text';
				editor.setValue(editor.getValue() +
					"asciiToHex('"+text+"')", 1
				);
				break;
			case 'hextoascii':
				var text = $(div).find('.textbox1').val() || '00 01 02 03';
				editor.setValue(editor.getValue() +
					"hexToAscii('"+text+"')", 1
				);
				break;
			default:
				break;
		}
		editor.focus();
		editor.navigateFileEnd();
	};
					
}
			