').append(
				$('| ').html(' '+usr[idx]+''),
				$(' | ').html(' '+pwd[idx]+''),
				$(' | ').html(
					$('').attr("type","button")
					.attr("value",((usr[idx]=='')?'Add':'Edit'))
					.attr("id","edit"+idx)
					.css({"margin-left":"10px","width":"80px","height":"24px"})
					.click(function(){
						var IDStr=parseInt($(this).attr('id').slice($(this).attr('id').length-1,$(this).attr('id').length),10);
						creat_tabledialog(IDStr);
					})
				),
				$(' | ').html(
					$('').attr("type","button")
					.attr("value","Remove")
					.attr("id","del"+idx)
					.attr('disabled',chk_FT[((usr[idx]=='')?0:1)])
					.css({"margin-left":"10px","width":"80px","height":"24px"})
					.click(function(){
						var IDStr=parseInt($(this).attr('id').slice($(this).attr('id').length-1,$(this).attr('id').length),10);
						setRS232('IPDelUser',usr[IDStr]);
					})
				)
			)
		);
	}
	
	function creat_tabledialog(idx)
	{
		var Str='';
		
		Str+='';
		$('#msg').html(Str);
	
		$('#table-dialog'+idx).dialog({
			autoOpen: false,
			height:200,
			width:400,
			modal: true,
			buttons:{
				'Save Change':function(){
					if($('#ausr').val()=='')
					{
						$('#diamsg').html(' Please type Username!');
						setTimeout('$("#diasmsg").fadeOut();',3000);
						return;
					}
					if($('#apsw').val()=='')
					{
						$('#diamsg').html(' Please type Password!');
						setTimeout('$("#diasmsg").fadeOut();',3000);
						return;
					}
					if(usr[idx]=='')
					{
						setRS232('IPAddUser',$('#ausr').val(),$('#apsw').val());
					}
					else
					{
						setRS232('ChangeNUP',usr[idx],pwd[idx],$('#ausr').val(),$('#apsw').val());
					}
					$(this).dialog("close");
				},
				Cancel: function(){
					$(this).dialog("close");
				}
			},
			close: function(){
				$('#table-dialog'+idx).remove();			
			}
		});	
		$('#table-dialog'+idx).dialog("open");
	}
}
function creat_sys()
{
	var AppendStr='';
	
	AppendStr+='';
	AppendStr+='';
	AppendStr+='';
	$('#All_body').html(AppendStr);
	
	if(ip_mode)
	{
		$('#ip,#sn,#gw').removeAttr('disabled');
	}
	else
	{
		$('#ip,#sn,#gw').attr('disabled','disabled');
	}
	
	$('#ipmode').switchbutton({
		checkedLabel:'Static IP',
		uncheckedLabel:'DHCP'	
	}).change(function(){
		ip_mode=$(this).prop("checked")?1:0;
		
		if(ip_mode)
		{
			$('#ip,#sn,#gw').removeAttr('disabled');
		}
		else
		{
			$('#ip,#sn,#gw').attr('disabled','disabled');
		}
	});
	$('#IPLogin').switchbutton({
		checkedLabel:'ON',
		uncheckedLabel:'OFF'	
	}).change(function(){
		var IDStr=$(this).attr('id');
		tel_log=$(this).prop("checked")?1:0;
		if(!tel_log_s)
		{
			setRS232(IDStr,chk_of[tel_log]);
		}
		else
		{
			tel_log_s=0;
		}
	});
	$('#Broadcast').switchbutton({
		checkedLabel:'ON',
		uncheckedLabel:'OFF'	
	}).change(function(){
		var IDStr=$(this).attr('id');
		broad=$(this).prop("checked")?1:0;
		if(!broad_s)
		{
			setRS232(IDStr,chk_of[broad]);
		}
		else
		{
			broad_s=0;
		}
	});
	$('#IPTimeout').change(function(){
		var IDStr=$(this).attr('id');
		setRS232(IDStr, $(this).val());
	});
	
	$('#PW').switchbutton({
		checkedLabel:'ON',
		uncheckedLabel:'OFF'	
	}).change(function(){
		var IDStr=$(this).attr('id');
		PW=$(this).prop("checked")?1:0;
		
		if(PW_s)
		{
			setRS232(IDStr+chk_Bof[PW]);
		}
		else
		{
			PW_s=0;
		}
	});
	
	$('#Lock_obj').switchbutton({
		checkedLabel:'Lock',
		uncheckedLabel:'Unlock'	
	}).change(function(){
		var set_obj=['Unlock','Lock'];
		Lock_obj=$(this).prop("checked")?1:0;
		
		if(!Lock_obj_s)
		{
			setRS232(set_obj[Lock_obj]);
		}
		else
		{
			Lock_obj_s=0;
		}
		check_lock(1,Lock_obj);
	});
	
	$('#BCPW').change(function(){
		var send_val=['local','cec','both'];
		var IDStr=$(this).attr('id');
		setRS232(IDStr,send_val[$(this).val()]);	
	});
	
	$('#nwsave,#Mreset,#fwbutton,#vlbutton').mouseover(function(){
		$(this).css('background','#F68428');	
	}).mouseleave(function(){
		if($(this).hasClass('othsave_down'))
			$(this).removeClass('othsave_down').addClass('othsave');
		$(this).css('background','');
	}).mousedown(function(){
		$(this).removeClass('othsave').addClass('othsave_down');
	}).mouseup(function(){
		var IDStr=$(this).attr('id');
		$(this).removeClass('othsave_down').addClass('othsave');
		$(this).css('background','');
		if(IDStr=='nwsave')
		{
			if($('#tp').val()!=tp)
			{
				setRS232("IPPort",$('#tp').val());
			}
			if(ip_mode)
			{
				//if(($('#ip').val()!=ip)||($('#sn').val()!=sn)||($('#gw').val()!=gw))
				{
					if(confirm('Are you Sure you want to Change IP Setting?'))
					{
						clear_Interval();
						show_wait('Setting Network Configuration,Please Wait!');
						setRS232("IPStatic", $('#ip').val(), $('#sn').val(),$('#gw').val());
						setTimeout('go_staticip("'+$('#ip').val()+'");',10000);
					}
				}
			}
			else
			{
				if(o_ip_mode!=ip_mode)
				{
					if(confirm('Are you Sure you want to Set Address Type to DHCP?'))
					{
						clear_Interval();
						show_wait('Setting Network to DHCP,Please Type New IP On URL, After 10 Seconds!');
						setRS232('IPDHCP', 'on');
					}
				}
			}
		}
		else if(IDStr=='Mreset')
		{
			if(confirm('Are you Sure want to Reset Device to manufacture default?'))
			{
				clear_Interval();
				show_wait('Please wait few Seconds,and Type New IP On URL!');
				setRS232(IDStr);
			}
		}
		else if(IDStr=='fwbutton')
		{
			if(confirm('Are you Sure want to update Firmware?'))
			{
				clear_Interval();
				show_wait('Updates,Please wait!');
				$.ajaxFileUpload
				({
					url:'action.html',
					secureuri:false,
					fileElementId:'fwfile',
					dataType: 'text',
					success: function (data, status){
						if(parseInt(data,10))
						{
							setTimeout("setinterpage('check_up')",1000);
						}
						else
						{
							show_wait("Firmware Update Fail!Please check Firmware file!");
						}
					},
					error: function (data, status, e){}
				})
			}
		}
		
		else if(IDStr=='vlbutton')
		{
			if(confirm('Are you Sure want to update Valens?'))
			{
				clear_Interval();
				show_wait('Updates,Please wait!');
				$.ajaxFileUpload
				({
					url:'action.html',
					secureuri:false,
					fileElementId:'vlfile',
					dataType: 'text',
					success: function (data, status){
						if(parseInt(data,10))
						{
							setRS232("VLUPGO");
							setTimeout("setinterpage('check_up')",53000);
						}
						else
						{
							show_wait("Valens Update Fail!");
						}
						
					},
					error: function (data, status, e){}
				})
			}
		}
		
	});
	
	$('#TrigCEC_on,#TrigCEC_off').mouseover(function(){
			$(this).css('background','#F68428');	
		}).mouseleave(function(){
			if($(this).hasClass('othsave_down'))
				$(this).removeClass('othsave_down').addClass('othsave');
			$(this).css('background','');
		}).mousedown(function(){
			$(this).removeClass('othsave').addClass('othsave_down');
		}).mouseup(function(){
		var IDStr=$(this).attr('id').slice(8,$(this).attr('id').length);
		$(this).removeClass('othsave_down').addClass('othsave');
		$(this).css('background','');
		setRS232('TrigCEC',IDStr);
	});
} |