var isDebug = false;
var PcAPI;
var cityXml = null;
(function ($) {
    $.extend({allset:{
		initWindos:function(settings){
				//初始化控件
				for(item in settings){
					$.setCheckBox({key:item,value:settings[item],"SmsDisableFlag":settings.SmsDisableFlag});
				}
				//$.allset.setCheckBoxTime({key:"SmsOnlineStatus_key",value:settings.SmsOnlineStatus_key});
				$.allset.setMainplaneRadio({"CloseToExit":settings.CloseToExit});
				$.allset.setRemindModeRadio({"ShowNewMessageWnd":settings.ShowNewMessageWnd});
				$.allset.setAccessRadio({"AddBuddyPermision":settings.AddBuddyPermision});
				$.allset.setClearFolderRadio({"SaveMyDocument":settings.SaveMyDocument});

				$.allset.setConcernPersonsItem(settings.ConcernPersons);

				//$.allset.setCatchSize({"CacheSize":settings.GetCacheSize});
				$.allset.setSafe(settings);
				$.allset.setWeatherRadio({"WeatherCity":settings.WeatherReportLocalCity,"xml":settings.WeatherReportCitysString,"UserType":settings.UserType});
				$.allset.setLoginStaut({"PresenceAfterLogon":settings.PresenceAfterLogon});
				$.allset.setCmsOption({"SmsOnlineStatus":settings.SmsOnlineStatus,"SmsDisableFlag":settings.SmsDisableFlag});
				$.allset.setCmsLayout({"SmsNicknameConfig":settings.SmsNicknameConfig,"UserNickName":settings.UserName,"SmsDisableFlag":settings.SmsDisableFlag});
				$.allset.setMinTime({"AwayOnIdle":settings.AwayOnIdle,"AwayOnIdleMinutes":settings.AwayOnIdleMinutes});
				$.allset.setForceSmsLogon(settings);
				$.allset.setHotKey({"MainWindowHotKeyShow":settings.MainWindowHotKeyShow||0,"MainWindowHotKeyHide":settings.MainWindowHotKeyHide||0,"CatchScreenHotKey":settings.CatchScreenHotKey||0});
				$(".all_set>li").hover(function() {
						if(!$(this).hasClass("visit")){
							$(this).addClass("hover");
						}
					}, function() {
						$(this).removeClass("hover");
					});
				$("#btnAddPerson").bind('click',function(){PcAPI.OpenWindow({'type':'OpenSelPersons'});}).hover(function() {
					$(this).addClass("add-btn-hover");
				}, function() {
					$(this).removeClass("add-btn-hover");
				});
				$("#SmsNoteSet").bind('click',function(){PcAPI.OpenWindow({'type':'SmsNoteSet'});}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				});
				//标签的滑块初始
				$(".allset_inf").bind("scroll",function(){
					var scrollHeight = $(".allset_inf").scrollTop();
				
					$(".visit").removeClass("visit");
					if(scrollHeight<93){
						$("#all_status_list")[0].style.top="-88px";
						$("#all_time_list")[0].style.top="-88px";
						$("a:contains('登录')").parent().addClass("visit");
					}else if(scrollHeight>=93&&scrollHeight<247){
						//$("#all_status_list").attr("style","top:0px");
						$("#all_status_list")[0].style.top="35px";
						$("#all_time_list")[0].style.top="-88px";
						$("a:contains('主面板')").parent().addClass("visit");
					}else if(scrollHeight>=247&&scrollHeight<366){
						$("#all_status_list")[0].style.top="35px";
						$("#all_time_list")[0].style.top="34px";
						$("a:contains('状态')").parent().addClass("visit");
						if(scrollHeight>=365&&scrollHeight<366){
							$("#all_layout_list")[0].style.top="-106px";
						}
					}else if(scrollHeight>=366&&scrollHeight<437){
						$("a:contains('会话')").parent().addClass("visit");
					}else if(scrollHeight>=437&&scrollHeight<534){
						$("#all_time_list")[0].style.top="34px";
						$("#all_layout_list")[0].style.top="87px";
						$("a:contains('短信')").parent().addClass("visit");
					}else if(scrollHeight>=534&&scrollHeight<957){
						$("a:contains('提醒')").parent().addClass("visit");
					}else if(scrollHeight>=957&&scrollHeight<1136){
						$("a:contains('热键')").parent().addClass("visit");
					}else if(scrollHeight>=1136&&scrollHeight<1187){
						$("a:contains('音视频')").parent().addClass("visit");
					}
					else if(scrollHeight>=1187&&scrollHeight<1424){
						$("a:contains('文件管理')").parent().addClass("visit");
					}
					else if(scrollHeight>=1424&&scrollHeight<1543){
						$("a:contains('权限管理')").parent().addClass("visit");
					}else if(scrollHeight>=1543&&scrollHeight<1971){
						$("a:contains('安全设置')").parent().addClass("visit");
					}
					else if(scrollHeight>=1971){
						$("a:contains('天气设置')").parent().addClass("visit");
					}
                    //alert(scrollHeight);
					$("#msg").html($(".allset_inf").scrollTop() );
				});
				//标签的滑块初始
				$(".all_set>li").click(function() {
						$(".visit").removeClass("visit");
						$(this).removeClass("hover");
						$(this).addClass("visit");
					});
				//绑定事件
				//视频设置
				$("#VedioSetting").live("click",function(){
					PcAPI.OpenWindow({'type':'VedioSetting'});
				}).hover(function() {
					$(this).addClass("btn02_0");
				}, function() {
					$(this).removeClass("btn02_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn02_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn02_1");
				});
				//音频设置
				$("#AudioSetting").bind("click",function(){
					PcAPI.OpenWindow({'type':'AudioSetting'});
				}).hover(function() {
					$(this).addClass("btn02_0");
				}, function() {
					$(this).removeClass("btn02_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn02_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn02_1");
				});
				//刷新连接
				$("#shuaxin").bind("click",function(){
					PcAPI.refresh();
				});
				//打开文件夹
				/*$("#OpenFolder").unbind().bind("click",function(){
					console.log("All打开文件夹单击");
					PcAPI.OpenWindow({'type':'OpenFolder','key':'CustomFolderPath'});
				});*/
				$("#BaseSettingOpenFolder").unbind().bind("click",function(){
					console.log("BaseSetting打开文件夹单击");
					PcAPI.OpenWindow({'type':'OpenFolder','key':'CustomFolderPath'});
				}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn01_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn01_1");
				});
				// 目录迁移打开移动到的目录
				
				//$("#MoveFolder").val(settings.path);
				//$("#CacheSize").html(settings.path);
				$("#BaseSettingMoveFolder").unbind().bind("click",function(){
					PcAPI.OpenWindow({'type':'SelectFileDirectoryPath','key':'path'});
				}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn01_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn01_1");
				});
				
				// 清理个人文件夹
				$("#ClearPersonalFolder").bind("click",function(){
					PcAPI.OpenWindow({'type':'ClearPersonalFolder'});
				}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn01_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn01_1");
				});
				PcAPI.refresh();
		},
		/****************************
		* 功能：根据名称获得地址栏的参数值
		* 参数：name
		*****************************/
		getQueryStringByName:function getQueryStringByName(name) {
			var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));            
			if (result == null || result.length < 1) {                
				return "";            
			}            
			return result[1];        
		},
		/****************************
		* 功能：根据key值取得checkBox对象
		* 参数：settings
		*****************************/

		setCheckBox:function(settings){
			var type = settings&&settings.SmsDisableFlag?settings.SmsDisableFlag:0;
			if((type==1||type==2)&&settings.key=="CCtoSmsConfig"){
			$("a[key=CCtoSmsConfig]").parent().addClass("disable");
				return;
			}
			if((type==1||type==2)&&settings.key=="RecvOfflineFileSms"){
				$("a[key=RecvOfflineFileSms]").parent().addClass("disable");
				return;
			}
			
			if(settings.key=='RecInvPubPhone'&&settings.value==0){
				$("a[key=RecInvPubPhone]").parent().addClass("disable");
				return;
			}else if(settings.value==1){
				settings.value="true";
			}else if(settings.value==2){
				settings.value="false";
			}
			
			var checkBox = $.extend({
					value: null,   //  值
					key: null, //键
					html:null
				}, settings);
			/****************************
			* 功能：初始化checkBox对象
			*****************************/
			function init(){
					checkBox.html = $("a[key="+checkBox.key+"]");
					if(checkBox.value){
						if(checkBox.value=="true"){
							checkBox.html.find("span").addClass("choose");
						}
						
					}
					checkBox.html.attr("value",checkBox.value);
					checkBox.html.unbind().bind("click",function(){
						var safeNotifyVal = 0;
						var EveryLoginSmsBox = $("a[key=EveryLoginSms]");
						var DiffMachineLoginSmsBox = $("a[key=DiffMachineLoginSms]");
						var DiffAreaLoginSmsBox = $("a[key=DiffAreaLoginSms]");
						var OtherTerminalLoginSmsBox = $("a[key=OtherTerminalLoginSms]");
						if(checkBox.key=="DiffMachineLoginSms"||checkBox.key=="DiffAreaLoginSms"||checkBox.key=="OtherTerminalLoginSms"){
								if(checkBox.html.attr("value")=="true"){
									checkBox.html.attr("value","false");
									checkBox.html.find("span").removeClass("choose");
									checkBox.html.find("span").removeClass("choose_hover");
									//PcAPI.ChangeConfigItem({'key':checkBox.key,'value':'false'});
									EveryLoginSmsBox.attr("value","false");
									EveryLoginSmsBox.find("span").removeClass("choose");
									EveryLoginSmsBox.find("span").removeClass("choose_hover");
									//PcAPI.ChangeConfigItem({'key':'EveryLoginSms','value':'false'});
								}else{
									if(DiffMachineLoginSmsBox.attr("value")=="true"&&DiffAreaLoginSmsBox.attr("value")=="true"&&OtherTerminalLoginSmsBox.attr("value")=="true"){
										EveryLoginSmsBox.attr("value","true");
										//checkBox.html.find("span").addClass("choose");
										EveryLoginSmsBox.find("span").addClass("choose_hover");
										//PcAPI.ChangeConfigItem({'key':checkBox.key,'value':'true'});
									}
									checkBox.html.attr("value","true");
									checkBox.html.find("span").addClass("choose_hover");
								}
								if(DiffMachineLoginSmsBox.attr("value")=="true"){
									safeNotifyVal = safeNotifyVal+ 4;
								}
								if(DiffAreaLoginSmsBox.attr("value")=="true"){
									safeNotifyVal = safeNotifyVal+ 8;
								}
								if(OtherTerminalLoginSmsBox.attr("value")=="true"){
									safeNotifyVal = safeNotifyVal+ 16;
								}
								PcAPI.ChangeConfigItem({'key':'SafeNotify','value':safeNotifyVal.toString()});
						}else if(checkBox.key=="EveryLoginSms"){
								if(checkBox.html.attr("value")=="true"){
									EveryLoginSmsBox.attr("value","false");
									EveryLoginSmsBox.find("span").removeClass("choose");
									EveryLoginSmsBox.find("span").removeClass("choose_hover");
								}else{
									EveryLoginSmsBox.attr("value","true");
									//checkBox.html.find("span").addClass("choose");
									EveryLoginSmsBox.find("span").addClass("choose");
									DiffMachineLoginSmsBox.attr("value","true");
									DiffMachineLoginSmsBox.find("span").addClass("choose");
									DiffAreaLoginSmsBox.attr("value","true");
									DiffAreaLoginSmsBox.find("span").addClass("choose");
									OtherTerminalLoginSmsBox.attr("value","true");
									OtherTerminalLoginSmsBox.find("span").addClass("choose");
								}
								//PcAPI.ChangeConfigItem({'key':checkBox.key,'value':checkBox.value});
									if(EveryLoginSmsBox.attr("value")=="true"){
										safeNotifyVal = safeNotifyVal+ 1;
									}
									if(DiffMachineLoginSmsBox.attr("value")=="true"){
										safeNotifyVal = safeNotifyVal+ 4;
									}
									if(DiffAreaLoginSmsBox.attr("value")=="true"){
										safeNotifyVal = safeNotifyVal+ 8;
									}
									if(OtherTerminalLoginSmsBox.attr("value")=="true"){
										safeNotifyVal = safeNotifyVal+ 16;
									}
								PcAPI.ChangeConfigItem({'key':'SafeNotify','value':safeNotifyVal.toString()});
						}else if(checkBox.key=="NoLoginPc"||checkBox.key=="EveryLogin"){
							var checkVal="0";
							var NoLoginPcBox = $("a[key=NoLoginPc]");
							var EveryLoginBox = $("a[key=EveryLogin]");
							if(checkBox.key=="EveryLogin"&&checkBox.html.attr("value")=="false"){
									checkBox.html.attr("value","true");
									checkBox.html.find("span").addClass("choose");
									//checkBox.html.find("span").removeClass("choose");
									//checkBox.html.find("span").removeClass("choose_hover");
									NoLoginPcBox.attr("value","true");
									NoLoginPcBox.find("span").addClass("choose");
							}else if(checkBox.key=="EveryLogin"&&checkBox.html.attr("value")=="true"){
									checkBox.html.attr("value","false");
									checkBox.html.find("span").removeClass("choose");
									checkBox.html.find("span").removeClass("choose_hover");
							}else if(checkBox.key=="NoLoginPc"&&checkBox.html.attr("value")=="true"){
								checkBox.html.attr("value","false");
								checkBox.html.find("span").removeClass("choose");
								checkBox.html.find("span").removeClass("choose_hover");
								EveryLoginBox.attr("value","false");
								EveryLoginBox.find("span").removeClass("choose");
								EveryLoginBox.find("span").removeClass("choose_hover");
							}else{
								checkBox.html.attr("value","true");
								checkBox.html.find("span").addClass("choose");
							}
							if(EveryLoginBox.attr("value")=="true"){
								checkVal="1";
							}else if(NoLoginPcBox.attr("value")=="true"&EveryLoginBox.attr("value")=="false"){
								checkVal="2";
							}else{
								checkVal="0";
							};
							PcAPI.ChangeConfigItem({'key':'ForceSmsLogon','value':checkVal});
						}else{
							setSelect();
							//alert(checkBox.html.attr("key"));
							var keyId = checkBox.html.attr("key");
							var checkVal = checkBox.html.attr("value");
							if(keyId=="ShowSessionWindow"){
								keyId="ShowNewMessageWnd";
								if(checkVal=="true"){
									checkVal='2';
								}else{
									checkVal='1';
								}
							}
							
							PcAPI.ChangeConfigItem({'key':keyId,'value':checkVal});
						}
					})				
					
			};
			/****************************
			* 功能：设置checkBox是否选择的状态和值
			*****************************/
			var setSelect = function(){
				var value = checkBox.html.attr("value");
				
				if(value=="true"){
					checkBox.html.attr("value","false");
					checkBox.html.find("span").removeClass("choose");
					checkBox.html.find("span").removeClass("choose_hover");
				}else{
					checkBox.html.attr("value","true");
					//checkBox.html.find("span").addClass("choose");
					checkBox.html.find("span").addClass("choose_hover");
				}
				
				if(checkBox.key=="AwayOnIdle"){
					$.setMinTime({"AwayOnIdle":value,"AwayOnIdleMinutes":settings.AwayOnIdleMinutes});
				}
			};
			init();
			return checkBox;
		},
		/****************************
		* 功能：设置主面板单选按钮
		* 参数：settings:{CloseToExit:true/false}
		*****************************/
        setMainplaneRadio:function(settings){
			//$(".mainplane").find("")
			var value = "false";
			var radio1 = $("a.notexit");
			var radio2 = $("a.exit");
			if(settings.CloseToExit=="false"){
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				
				radio2.find("span").attr("selected","true");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
			}else{
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
			}
			radio1.unbind().bind("click",function(){			
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "false";
				PcAPI.ChangeConfigItem({'key':"CloseToExit",'value':value});
			});
			
			radio2.unbind().bind("click",function(){			
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				value = "true";
				PcAPI.ChangeConfigItem({'key':"CloseToExit",'value':value});
			});
			return value;
		},
		
		/****************************
		* 功能：个人文件夹设置单选按钮
		* 参数：settings:{SaveMyDocument:true/false}
		*****************************/
        setClearFolderRadio:function(settings){
			var value = "false";
			var radio1 = $("a.savemydocument");
			var radio2 = $("a.savetocustom");
			if(settings.SaveMyDocument=="true"){
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				
				radio2.find("span").attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				$("#MoveFolder").val("请浏览并选择文件路径");
				$("#MoveFolder").css("color","bbb");
				$("#BaseSettingMoveFolder").removeClass("btn01_0");
				$("#BaseSettingMoveFolder").addClass("btn01_2");
				$("#BaseSettingMoveFolder").unbind();
				$("#BaseSettingMoveFolder").css("color","bbb");
			}else if(settings.SaveMyDocument=="false"){
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
			}
			radio1.unbind().bind("click",function(){			
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "true";
				if($("#MoveFolder").val()==""||$("#MoveFolder").val()=="请浏览并选择文件路径"||$("#MoveFolder").val()=="路径无效，请重新选择。"){
					$("#MoveFolder").val("请浏览并选择文件路径");
				}
				$("#MoveFolder").css("color","bbb");
				$("#BaseSettingMoveFolder").removeClass("btn01_0");
				$("#BaseSettingMoveFolder").addClass("btn01_2");
				$("#BaseSettingMoveFolder").unbind();
				$("#BaseSettingMoveFolder").css("color","bbb");
				PcAPI.ChangeConfigItem({'key':"SaveMyDocument",'value':value});
			});
			
			radio2.unbind().bind("click",function(){	
				$("#BaseSettingMoveFolder").removeClass("btn01_2");
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				value = "false";
				$("#BaseSettingMoveFolder").unbind().bind("click",function(){
					PcAPI.OpenWindow({'type':'SelectFileDirectoryPath','key':'path'});
				}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn01_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn01_1");
				});
				$("#BaseSettingMoveFolder").css("color","");
				PcAPI.ChangeConfigItem({'key':"SaveMyDocument",'value':value});
			});
			return value;
		},
		/****************************
		* 功能：设置权限单选按钮
		* 参数：settings:{AddBuddyPermision:true/false}
		*****************************/
		setAccessRadio:function(settings){
			var value = "1";
			var radio0 = $("a:contains('全部拒绝')");		// 全部拒绝 value = 0
			var radio1 = $("a:contains('全部同意')");		// 全部同意，value = 1
			var radio2 = $("a:contains('需要我审核')");		// 需要我审核 value = 2
			
			if(settings.AddBuddyPermision=="2"){
				radio0.attr("selected","true");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				radio1.find("span").attr("selected","true");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
				value = "2";
				console.log("AddBuddyPermision :2");
			}else if(settings.AddBuddyPermision=="1"){
				radio0.attr("selected","false");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "1";
				console.log("AddBuddyPermision :1");
			}else{
				radio0.attr("selected","true");
				radio0.find("span").removeClass("radio_auto").addClass("radio_on");
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "0";
				console.log("AddBuddyPermision :0");
			}
			radio0.unbind().bind("click",function(){
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				radio0.attr("selected","true");
				radio0.find("span").removeClass("auto_hover").addClass("on_hover");
				value = "0";
				console.log("ChangeConfigItem AddBuddyPermision :0");
				PcAPI.ChangeConfigItem({'key':"AddBuddyPermision",'value':value});
			});
			radio1.unbind().bind("click",function(){
				radio1.attr("selected","true");
				radio1.find("span").removeClass("auto_hover").addClass("on_hover");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				radio0.attr("selected","true");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "1";
				console.log("ChangeConfigItem AddBuddyPermision :1");
				PcAPI.ChangeConfigItem({'key':"AddBuddyPermision",'value':value});
			});
			radio2.unbind().bind("click",function(){
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("auto_hover").addClass("on_hover");
				radio0.attr("selected","false");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "2";
				console.log("ChangeConfigItem AddBuddyPermision :2");
				PcAPI.ChangeConfigItem({'key':"AddBuddyPermision",'value':value});
			});
			
			return value;
		},
		/****************************
		* 功能：设置短信提醒方式单选按钮
		* 参数：settings:
		*****************************/
        setRemindModeRadio:function(settings){
			//$(".mainplane").find("")
			
			var value = settings.ShowNewMessageWnd;
			var radio1 = $("a.mode1");
			var radio2 = $("a.mode2");
			if(settings.ShowNewMessageWnd=="0"){
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				$("a[key=ShowSessionWindow]").parent().addClass("disable");
			}else if(settings.ShowNewMessageWnd=="3"){
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				$("a[key=ShowSessionWindow]").parent().addClass("disable");
			}else if(settings.ShowNewMessageWnd=="1"){
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				
				radio2.find("span").attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
				$("a[key=ShowSessionWindow]").parent().removeClass("disable");
			}else{
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				
				radio2.find("span").attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
			}
			radio1.unbind().bind("click",function(){			
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				radio2.attr("selected","false");
				radio2.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "0";
				$("a[key=ShowSessionWindow]").parent().addClass("disable");
				PcAPI.ChangeConfigItem({'key':"ShowNewMessageWnd",'value':value});
			});
			
			radio2.unbind().bind("click",function(){			
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				radio2.attr("selected","true");
				radio2.find("span").removeClass("radio_auto").addClass("radio_on");
				$(this).find("span").removeClass("auto_hover").addClass("on_hover");
				$("a[key=ShowSessionWindow]").parent().removeClass("disable");
				if($("a[key=ShowSessionWindow]").attr("value")=="true"){
					value = "2";
				}else{
					value = "1";
				}
				PcAPI.ChangeConfigItem({'key':"ShowNewMessageWnd",'value':value});
			});
			var checkBoxVal = (value==2||value==3)?"true":"false";
			$.setCheckBox({key:'ShowSessionWindow',value:checkBoxVal,"SmsDisableFlag":settings.SmsDisableFlag});
			return value;
		},
		setSafe:function(settings){
			var type = settings&&settings.SmsDisableFlag?settings.SmsDisableFlag:0;
			if(type==1||type==2){
				$("dd:contains('登录短信提醒')").addClass("disable");
				$("dd:contains('在以下情况登录时短信通知我')").addClass("disable");
				$("a[key=DiffMachineLoginSms]").parent().addClass("disable");
				$("a[key=DiffAreaLoginSms]").parent().addClass("disable");
				$("a[key=OtherTerminalLoginSms]").parent().addClass("disable");
				$("a[key=EveryLoginSms]").parent().addClass("disable");
				$('.pos_1').addClass("disable");
				$('.link_t2').unbind().bind("click",function(){
					PcAPI.OpenWindow({'type':'ChangePassword'});
					});
				return;
			}
			//'DiffMachineLoginSms':'true','DiffAreaLoginSms':'true','OtherTerminalLoginSms':'true','EveryLoginSms':'true',
			$.setCheckBox({key:'DiffMachineLoginSms',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
			$.setCheckBox({key:'DiffAreaLoginSms',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
			$.setCheckBox({key:'OtherTerminalLoginSms',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
			$.setCheckBox({key:'EveryLoginSms',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
			if((settings.SafeNotify&1)==1){
				$.setCheckBox({key:'DiffMachineLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
				$.setCheckBox({key:'DiffAreaLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
				$.setCheckBox({key:'OtherTerminalLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
				$.setCheckBox({key:'EveryLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
			}
			if((settings.SafeNotify&4)==4){
				$.setCheckBox({key:'DiffMachineLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
			}
			if((settings.SafeNotify&8)==8){
				$.setCheckBox({key:'DiffAreaLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
			}
			if((settings.SafeNotify&16)==16){
				$.setCheckBox({key:'OtherTerminalLoginSms',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
			}
			
			$('.link_t1').unbind().bind("click",function(){
				PcAPI.OpenWindow({'type':'CommonAreaSetting'});
				//window.open("http://safe.feixin.10086.cn/Account/LoginRegion");
			});
			$('.link_t2').unbind().bind("click",function(){
				PcAPI.OpenWindow({'type':'ChangePassword'});
				//window.open("http://safe.feixin.10086.cn/Account/LoginRegion");
			});
		},
		/****************************
		* 功能：设置天气设置单选按钮
		* 参数：settings:{weather:true/false}
		*****************************/
		setWeatherRadio:function(settings){
			cityXml = base64Coder.decode(settings.xml);
			var value = "1";
			var radio0 = $("a:contains('默认显示手机号归属城市天气')");		//  value = 1
			var radio1 = $("a:contains('默认显示以下城市的天气')");		// value = ""
			if(settings.WeatherCity=="1"){
				radio0.attr("selected","true");
				radio0.find("span").removeClass("radio_auto").addClass("radio_on");
				radio1.attr("selected","false");
				radio1.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "1";
				$(".city").attr("disabled", true);
				$(".area").attr("disabled", true);
				$(".city").hover(function() {
					$(this).addClass("city_area_hover");
				}, function() {
					$(this).removeClass("city_area_hover");
				})
				$(".area").hover(function() {
					$(this).addClass("city_area_hover");
				}, function() {
					$(this).removeClass("city_area_hover");
				})
				console.log("WeatherCity :1");
			}else{
				radio0.attr("selected","false");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				value = "1";
				$(".city").attr("disabled", false);
				$(".area").attr("disabled", false);
				$(".city").unbind("mouseenter").unbind("mouseleave");
				$(".area").unbind("mouseenter").unbind("mouseleave");
				console.log("WeatherCity :0");
			}
			$.allset.setCityAreaSelect(cityXml,settings.WeatherCity);
			if(settings.UserType==2){
				//设置第一个按钮不可用
				radio0.find("span").addClass("radio_disable");
				radio1.attr("selected","true");
				radio1.find("span").removeClass("radio_auto").addClass("radio_on");
				$(".city").attr("disabled", false);
				$(".area").attr("disabled", false);
			}else{
				radio0.unbind().bind("click",function(){
					radio1.attr("selected","false");
					radio1.find("span").removeClass("radio_on").addClass("radio_auto");
					radio0.attr("selected","true");
					radio0.find("span").removeClass("auto_hover").addClass("on_hover");
					value = "1";
					console.log("ChangeConfigItem WeatherCity :0");
					$(".city").attr("disabled", true);
					$(".area").attr("disabled", true);
					$(".city").unbind("mouseenter").unbind("mouseleave");
					$(".area").unbind("mouseenter").unbind("mouseleave");
					PcAPI.ChangeConfigItem({'key':"WeatherReportLocalCity",'value':value});
				});
			}
			radio1.unbind().bind("click",function(){
				radio1.attr("selected","true");
				radio1.find("span").removeClass("auto_hover").addClass("on_hover");
				radio0.attr("selected","false");
				radio0.find("span").removeClass("radio_on").addClass("radio_auto");
				value = "CN."+$(".city").val()+"."+$(".area").val()+".";
				console.log("ChangeConfigItem WeatherCity :1");
				$(".city").attr("disabled", false);
				$(".area").attr("disabled", false);
				$(".city").hover(function() {
					$(this).addClass("city_area_hover");
				}, function() {
					$(this).removeClass("city_area_hover");
				})
				$(".area").hover(function() {
					$(this).addClass("city_area_hover");
				}, function() {
					$(this).removeClass("city_area_hover");
				})
				PcAPI.ChangeConfigItem({'key':"WeatherReportLocalCity",'value':value});
			});
			
			return value;
		},
		//设置城市区域下拉列表
		setCityAreaSelect:function(xml,sel){
			$(".city option").remove();
			$(".area option").remove();
				var city = "bj";
				var area = "10";
				if(sel!="1"){
				var cityArea = sel.split(".");
					city = cityArea[1];
					area = cityArea[2];
				}
				var data = $(xml);
				var cityData = data.find("Province");
				cityData.each(function() {
					if($(this).attr("Code")==city){
						$(".city").append("<option value='"+$(this).attr("Code")+"' selected>"+$(this).attr("Name")+"</option>");
					}else{
						$(".city").append("<option value='"+$(this).attr("Code")+"'>"+$(this).attr("Name")+"</option>");
					}
                });
				var areaData = data.find("Province[Code='"+city+"']>City");
				areaData.each(function() {
					if($(this).attr("Code")==area){
						$(".area").append("<option value='"+$(this).attr("Code")+"' selected>"+$(this).attr("Name")+"</option>");
					}else{
						$(".area").append("<option value='"+$(this).attr("Code")+"'>"+$(this).attr("Name")+"</option>");
					}
                });
				$(".city").unbind().bind("change", function() {
					$(".area option").remove();
					areaData = data.find("Province[Code='"+$(".city").val()+"']>City");
					areaData.each(function() {
						if($(this).attr("Code")==area){
							$(".area").append("<option value='"+$(this).attr("Code")+"' selected>"+$(this).attr("Name")+"</option>");
						}else{
							$(".area").append("<option value='"+$(this).attr("Code")+"'>"+$(this).attr("Name")+"</option>");
						}
					});
					PcAPI.ChangeConfigItem({'key':"WeatherReportLocalCity",'value':("CN."+$(".city").val()+"."+$(".area").val()+".")});
                });
				$(".area").unbind().bind("change", function() {
						PcAPI.ChangeConfigItem({'key':"WeatherReportLocalCity",'value':("CN."+$(".city").val()+"."+$(".area").val()+".")});
                });
		
		},
		/****************************
		* 功能：设置登录状态下拉列表
		* 参数：settings:{PresenceAfterLogon:"online"}
		*****************************/
		setLoginStaut:function(settings){
			var value=settings&&settings.PresenceAfterLogon?settings.PresenceAfterLogon:"online";
			
			$("#all_status>input.sel_1").val($("#all_status_list>ul>li>a[v="+value+"]").text());
			$("#all_status>input.sel_1").attr("v",value);
			$("#all_status_list").hide();
			$("#all_status_list>ul>li").hover(function() {
					$(this).addClass("hover");
				}, function() {
					$(this).removeClass("hover");
				}).bind("click",function(){
					var a = $(this).find("a");
						$("#all_status>input.sel_1").val(a.text());
						$("#all_status>input.sel_1").attr("v",a.attr("v"));
						PcAPI.ChangeConfigItem({'key':"PresenceAfterLogon",'value':a.attr("v")});
						
						//绑定
						$("#status>input.sel_1").val(a.text());
						$("#status>input.sel_1").attr("v",a.attr("v"));
				});
			$("#all_status").unbind().bind("click",function(e){
				var target  = $(e.target);
				if($.dropDownListId&&$.dropDownListId=="all_status_list"){
					$("#"+$.dropDownListId).hide();
					$.dropDownListId=undefined;
					$(this).addClass("person_0").removeClass("person_1");
				}else if(!$.dropDownListId&&$.dropDownListId!="all_status_list"){
					$("#all_status_list").show();
					$(this).addClass("person_1");
					$.dropDownListId="all_status_list";
				}else{
					$("#"+$.dropDownListId).hide();
					$("#all_status_list").show();
					$(this).addClass("person_1");
					$.dropDownListId="all_status_list";
				}
			});

			$(document).bind("click",function(e){
				var target  = $(e.target);
				if(target.closest("#all_status").length == 0){
					$("#all_status_list").hide();
					$("#all_status").removeClass("person_0");
					$("#all_status").removeClass("person_1");
				}
			});
		},
		/****************************
		* 功能：设置短信发送频率
		* 参数：settings:{SmsOnlineStatus:-1/0/1/2/3}
		*****************************/
		setCmsOption:function(settings){
			var type = settings&&settings.SmsDisableFlag?settings.SmsDisableFlag:0;
			if((type==1||type==2)){
				$("a[key=SmsOnlineStatus_key]").parent().addClass("disable");
				return;
			}
			var value=settings&&settings.SmsOnlineStatus?settings.SmsOnlineStatus:-1;
			//设置下拉列表内容
			$("#time_list").hide();
			$("#all_time_list").hide();
			$("#time_list>ul>li").hover(function() {
					$(this).addClass("hover");
				}, function() {
					$(this).removeClass("hover");
				}).bind("click",function(){
					var a = $(this).find("a");
					$("#interval_time>input.sel_1").val(a.text());
					$("#all_interval_time>input.sel_1").val(a.text());
					$("#time_list").hide();
					$.dropDownListId=undefined;
					PcAPI.ChangeConfigItem({'key':"SmsOnlineStatus",'value':a.attr("v")});
				});
				
			$("#all_time_list>ul>li").hover(function() {
					$(this).addClass("hover");
				}, function() {
					$(this).removeClass("hover");
				}).bind("click",function(){
					var a = $(this).find("a");
					$("#all_interval_time>input.sel_1").val(a.text());
					$("#interval_time>input.sel_1").val(a.text());
					$("#all_time_list").hide();
					$.dropDownListId=undefined;
					PcAPI.ChangeConfigItem({'key':"SmsOnlineStatus",'value':a.attr("v")});
					console.log(a.attr("v"));
				});
			//设置复选框
			var html = $("a[key=SmsOnlineStatus_key]");
					if(value>-1){
						html.find("span").addClass("choose");
						//html.find("span").removeClass("choose_hover");
						$("#interval_time").removeClass("gray_bg");
						
						$("#all_interval_time").removeClass("gray_bg");
						$("#interval_time").unbind().bind("click",function(){
							$("#time_list").show();
								});
						$("#all_interval_time").unbind().bind("click",function(){
							$("#all_time_list").show();
						});
					}else{
						//$("#interval_time").unbind();
						html.find("span").removeClass("choose");
						html.find("span").removeClass("choose_hover");
						$("#interval_time").addClass("gray_bg");
						$("#interval_time>input.sel_1").val("24小时内");
						
						//$("#all_interval_time").unbind();
						html.find("span").removeClass("choose");
						html.find("span").removeClass("choose_hover");
						$("#all_interval_time").addClass("gray_bg");
						$("#all_interval_time>input.sel_1").val("24小时内");
					};
					html.attr("v",value);
					$("#interval_time>input.sel_1").val($("div[id=all_time_list]>ul>li>a[v="+((value==-1)?0:value)+"]").text());
					$("#all_interval_time>input.sel_1").val($("div[id=all_time_list]>ul>li>a[v="+((value==-1)?0:value)+"]").text());
					////////////////////////////////////////////////////////////////////////////////
					$("#all_time_list").attr("show","false");
					$("#time_list").attr("show","false");

					////////////////////////////////////////////////////////////////////////////////
					html.unbind().bind("click",function(e){														
						var target  = $(e.target);
						var parent=$(e.target).parent();
						var did="";
						if(parent.attr("id")=="msg_set_all"){
							did="all_time_list";
						}else if(parent.attr("id")=="msg_set"){
							did="time_list";
						};
						if($.dropDownListId){
							$("#"+$.dropDownListId).hide();
						}
							//处理
						var v = html.attr("v");
						if(v==-1){
							//html.find("span").addClass("choose");
							html.find("span").addClass("choose_hover");
							$("#interval_time").removeClass("gray_bg");
							$("#interval_time").unbind().bind("click",function(){
								if($("#time_list").attr("show")=="true"){
									$("#time_list").attr("show","false");
									$("#time_list").hide();
									$(this).addClass("person_0").removeClass("person_1");
								}else{
									$("#time_list").attr("show","true");
									$("#time_list").show();
									$(this).addClass("person_1").removeClass("person_0");
								}
							});
							
							$("#all_interval_time").removeClass("gray_bg");
							$("#all_interval_time").unbind().bind("click",function(){
								if($("#all_time_list").attr("show")=="true"){
									$("#all_time_list").attr("show","false");
									$(this).addClass("person_0").removeClass("person_1");
									$("#all_time_list").hide();
								}else{
									$("#all_time_list").attr("show","true");
									$(this).addClass("person_1").removeClass("person_0");
									$("#all_time_list").show();
								}
							});
							html.attr("v",0);
							$("#interval_time>input.sel_1").val("24小时内");
							$("#all_interval_time>input.sel_1").val("24小时内");
						}else{
								html.find("span").removeClass("choose");
								html.find("span").removeClass("choose_hover");
								$("#interval_time").addClass("gray_bg");
								$("#interval_time").unbind();
								html.attr("v",-1);
								
								html.find("span").removeClass("choose");
								html.find("span").removeClass("choose_hover");
								$("#all_interval_time").addClass("gray_bg");
								$("#all_interval_time").unbind();
								html.attr("v",-1);
								$("#interval_time>input.sel_1").val("24小时内");
								$("#all_interval_time>input.sel_1").val("24小时内");
						}
						console.log(html.attr("v"));
						PcAPI.ChangeConfigItem({'key':"SmsOnlineStatus",'value':html.attr("v")});
						
					});

			$(document).bind("click",function(e){
				var target  = $(e.target);
				if(target.closest("#interval_time").length == 0){
					$("#time_list").hide();
					$("#time_list").attr("show","false");
					//$("#all_time_list").hide();
					//$("#all_time_list").attr("show","false");
					$("#interval_time").removeClass("person_0");
					$("#interval_time").removeClass("person_1");
					
				}
				if(target.closest("#all_interval_time").length == 0){
					//$("#time_list").hide();
					//$("#time_list").attr("show","false");
					$("#all_time_list").hide();
					$("#all_time_list").attr("show","false");
					$("#all_interval_time").removeClass("person_0");
					$("#all_interval_time").removeClass("person_1");
				}
			});
		},
		/****************************
		* 功能：设置短信布局
		* 参数：settings:{SmsNicknameConfig:true/false}
		*****************************/
		setCmsLayout:function(settings){
			var type = settings&&settings.SmsDisableFlag?settings.SmsDisableFlag:0;
			if(type==2){
				$("a[key=SmsNicknameConfig_key]").parent().addClass("disable");
				return;
			}
			var value=settings&&settings.SmsNicknameConfig?settings.SmsNicknameConfig:0;
		//设置下拉列表内容

			$("#all_layout_list").hide();
			$("#all_layout_list>ul>li").hover(function() {
					$(this).addClass("hover");
					var type=$(this).find("a").attr("v");
					if(type==0){
						$("#showNameTemp").html(settings.UserNickName+":最近好吗?");
					}else if(type==1){
						$("#showNameTemp").html("最近好吗?【"+settings.UserNickName+"】");
					}else if(type==2){
						$("#showNameTemp").html("最近好吗?");
					}
				}, function() {
					$(this).removeClass("hover");
				}).bind("click",function(){
					var a = $(this).find("a");
					if(a.length==0){
					    return false;
					}
					$("#all_sms_layout>a>input.sel_1").val(a.text());
					PcAPI.ChangeConfigItem({'key':"SmsNicknameConfig",'value':a.attr("v")});
					
					//绑定
					$("#sms_layout>input.sel_1").val(a.text());
				});
				//
				var html = $("a[key=SmsNicknameConfig_key]");
				html.find("span").addClass("choose");
				$("#all_sms_layout>a>input.sel_1").val($("#all_layout_list>ul>li>a[v="+value+"]").text());

				$("#all_sms_layout").unbind().bind("click",function(e){
					//初始下拉列表
					if(value==0){
						$("#showNameTemp").html(settings.UserNickName+":最近好吗?");
					}else if(value==1){
						$("#showNameTemp").html("最近好吗?【"+settings.UserNickName+"】");
					}else if(value==2){
						$("#showNameTemp").html("最近好吗?");
					}
					var target  = $(e.target);
					if($.dropDownListId&&$.dropDownListId=="all_layout_list"){
						$("#"+$.dropDownListId).hide();
						$.dropDownListId=undefined;
						$(this).removeClass("s_msg_1").addClass("s_msg_0");
					}else if(!$.dropDownListId&&$.dropDownListId!="all_layout_list"){
						$("#all_layout_list").show();
						$(this).addClass("s_msg_1");
						$.dropDownListId="all_layout_list";
					}else{
						$("#"+$.dropDownListId).hide();
						$("#all_layout_list").show();
						$(this).addClass("s_msg_1");
						$.dropDownListId="all_layout_list";
					}
				});
			$(document).bind("click",function(e){
				var target  = $(e.target);
				if(target.closest("#all_sms_layout").length == 0){
					$("#all_layout_list").hide();
					$("#all_sms_layout").removeClass("s_msg_0");
					$("#all_sms_layout").removeClass("s_msg_1");
				}
			});
		},
		/****************************
		* 功能：设置时间控件
		* 参数：settings:{"AwayOnIdle":true,"AwayOnIdleMinutes":5}
		*****************************/
		setMinTime:function(settings){
			$("a.arrow_t").hover(function() {
						if(!$(this).hasClass("visit")){
							$(this).addClass("hover");
						}
					}, function() {
						$(this).removeClass("hover");
					});
		$("a.arrow_b").hover(function() {
						if(!$(this).hasClass("visit")){
							$(this).addClass("hover");
						}
					}, function() {
						$(this).removeClass("hover");
					});
			if(settings.AwayOnIdle&&settings.AwayOnIdle=="true"){
				$("input.min_txt").attr("readonly",false);
				var value = settings && settings.AwayOnIdleMinutes ? settings.AwayOnIdleMinutes : 5;
				$("input.min_txt").val(value);
				$("div.arrow_p>a.arrow_t").bind("click",function(){
					$("input.min_txt").val(parseInt($("input.min_txt").val())+1);
					PcAPI.ChangeConfigItem({'key':"AwayOnIdleMinutes",'value':$("input.min_txt").val()});
				});
				
				$("div.arrow_p>a.arrow_b").bind("click",function(){
					value = $("input.min_txt").val();
					if(value>1){
						$("input.min_txt").val($("input.min_txt").val()-1);
						PcAPI.ChangeConfigItem({'key':"AwayOnIdleMinutes",'value':$("input.min_txt").val()});
					}
				
				});
			}else{
				var value = settings && settings.AwayOnIdleMinutes ? settings.AwayOnIdleMinutes : 5;
				$("div.min_sel>input.min_txt").val(value);
				$("div.min_sel>input.min_txt")[0].setAttribute("readonly","readonly");
				$("div.arrow_p>a.arrow_t").unbind();
				$("div.arrow_p>a.arrow_b").unbind();
			}
			$("div.min_sel>input.min_txt").unbind().bind("change",function(){
				PcAPI.ChangeConfigItem({'key':"AwayOnIdleMinutes",'value':$("div.min_sel>input.min_txt").val()});
			});
			
		},
		/****************************
		* 功能：设置关注联系人
		* 参数：datas:[{'id':'','name':'','img':'',phone:''},{'id':'','name':'','img':'',phone:''}]
		*****************************/
		setConcernPersonsItem:function(datas){
			if(datas)
			{
					var html="";
					for (var i = 0; i < datas.length; i++) {
						html += "<li data='" + JSON.stringify(datas[i]) + "' id='"+datas[i].id+"'>";
						html += "<div class='p-icon'><img src='fetionres:///" + datas[i].img + "' /></div>";
						//var name=datas[i].name.length>8?datas[i].name.substr(0,8)+"...":datas[i].name
						html += "<div class='p-name' style='overflow:hidden;text-overflow:ellipsis;width:190px;white-space:nowrap;'>" + datas[i].name + "（" + datas[i].phone + "）" + "</div>";
						html += "<a class=\"del-p\" style='display:none' onclick='PcAPI.deletePersons(this)'></a></li>";
					}
					$("#ConcernPersons").html(html);
					$("#ConcernPersons>li").bind("mouseover", function() {
						$(this).find('a').css("display","");
					}).bind("mouseout", function() {
						$(this).find('a').css("display","none");
					});
					
			}else{
				$("#ConcernPersons").html("");
			}
			
		},
		/**
		/* 设置强制短信密码
		/*
		/**/
		setForceSmsLogon:function(settings){
			var type = settings&&settings.SmsDisableFlag?settings.SmsDisableFlag:0;
			if(type==2||type==1){
				$(".msg-tx01").addClass("disable");
				$("#smsTit").addClass("disable");
				$("a[key=NoLoginPc]").parent().addClass("disable");
				$("a[key=EveryLogin]").parent().addClass("disable");
				return;
			}else{
				if(settings.ForceSmsLogon==0){
					$.setCheckBox({key:'NoLoginPc',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
					$.setCheckBox({key:'EveryLogin',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
				}else if(settings.ForceSmsLogon==1){
					$.setCheckBox({key:'NoLoginPc',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
					$.setCheckBox({key:'EveryLogin',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
				}else if(settings.ForceSmsLogon==2){
					$.setCheckBox({key:'NoLoginPc',value:'true',"SmsDisableFlag":settings.SmsDisableFlag});
					$.setCheckBox({key:'EveryLogin',value:'false',"SmsDisableFlag":settings.SmsDisableFlag});
				}
				
			}
		},
		setHotKey:function(settings){
		
			function HighWord(value)
			{
				return ((value) >> 16) & 0xffff;
			}

			function LowWord(value)
			{
				return value & 0xffff;
			}
			
			function keyStr(k){
				var HOTKEYF_SHIFT = 1,HOTKEYF_CONTROL = 2,HOTKEYF_ALT = 4,temp="";
				if(HighWord(k)&HOTKEYF_SHIFT)
				{
					temp = "Shift + " + temp;	
				}
				if(HighWord(k)&HOTKEYF_ALT)
				{
					temp = "Alt + " + temp;
				}
				if(HighWord(k)&HOTKEYF_CONTROL)
				{
					temp = "Ctrl + " + temp;
				}
				
				return temp+$.allset.keyValue[LowWord(k)];

			}
			
			if(settings.CatchScreenHotKey!=0){
				$('.inp_hot_key[keyId="CatchScreenHotKey"]').val(keyStr(settings.CatchScreenHotKey));
				//$('.inp_hot_key[keyId="CatchScreenHotKey"]').attr("hot_key",settings.CatchScreenHotKey);
				$('.inp_hot_key[keyId="CatchScreenHotKey"]')[0].setAttribute("hot_key",settings.CatchScreenHotKey);
				$('.inp_hot_key[keyId="CatchScreenHotKey"]')[0].setAttribute("hot_val",keyStr(settings.CatchScreenHotKey));
				$('.inp_hot_key[keyId="CatchScreenHotKey"]').removeClass("inp_hot_no");
			}
			if(settings.MainWindowHotKeyShow!=0){
				$('.inp_hot_key[keyId="MainWindowHotKeyShow"]').val(keyStr(settings.MainWindowHotKeyShow));
				$('.inp_hot_key[keyId="MainWindowHotKeyShow"]')[0].setAttribute("hot_key",settings.MainWindowHotKeyShow);
				$('.inp_hot_key[keyId="MainWindowHotKeyShow"]')[0].setAttribute("hot_val",keyStr(settings.MainWindowHotKeyShow));
				$('.inp_hot_key[keyId="MainWindowHotKeyShow"]').removeClass("inp_hot_no");
			}
			if(settings.MainWindowHotKeyHide!=0){
				$('.inp_hot_key[keyId="MainWindowHotKeyHide"]').val(keyStr(settings.MainWindowHotKeyHide));
				$('.inp_hot_key[keyId="MainWindowHotKeyHide"]')[0].setAttribute("hot_key",settings.MainWindowHotKeyHide);
				$('.inp_hot_key[keyId="MainWindowHotKeyHide"]')[0].setAttribute("hot_val",keyStr(settings.MainWindowHotKeyHide));
				$('.inp_hot_key[keyId="MainWindowHotKeyHide"]').removeClass("inp_hot_no");
			}
			
			
			$('.inp_hot_key').bind("keydown",function(e){
				var ret=$.allset.transformKeyCode(e,this);
				if(ret){
					//$(this).val(ret.key);
					PcAPI.CheckHotKey(ret,this);
					
				}
			});
			$('.inp_hot_key').bind("click",function(e){
				$(".bg_02").removeClass("bg_02").addClass("bg_01");
				$(this).parent().parent().removeClass("bg_01").addClass("bg_02");
			});
			$('.inp_hot_key').bind("blur",function(e){
				var o = $("#"+$(this).attr("forId"));
				if(o.html()=="冲突"){
					o.html("");
					
					if($(this).attr("hot_val")=='undefined'){
						$(this).val("请按键盘进行设置");
						$(this).addClass("inp_hot_no");
					}else{
						$(this).val($(this).attr("hot_val"));
						$(this).removeClass("inp_hot_no");
					}
				}
			});
		},
		transformKeyCode:function(e,o)
		{
			var keynum,keychar,numcheck,ret={};
			if(window.event) // IE
			{
				keynum = e.keyCode
			}else if(e.which) // Netscape/Firefox/Opera
			{
				keynum = e.which
			}
			$(o).removeClass("inp_hot_no");
			if(keynum==8 || keynum==46){
				{
					PcAPI.ChangeConfigItem({'key':$(o).attr("keyId"),'value':'0'});
				}
				$(o).val("请按键盘进行设置");
				$(o).addClass("inp_hot_no");
			}
			if($.allset.keyValue[keynum]){
				keychar=$.allset.keyValue[keynum];
				temp = ""
				if(e.keyCode==299){e.preventDefault();return false;}
				var HOTKEYF_SHIFT = 1,HOTKEYF_CONTROL = 2,HOTKEYF_ALT = 4,HotKeyModifier = 0,HotKeyValue = 0;
				
				if (e.shiftKey)
				{
					HotKeyModifier |= HOTKEYF_SHIFT;
					temp = "Shift + " + temp;	
				}
				if (e.altKey)
				{
					HotKeyModifier |= HOTKEYF_ALT;
					temp = "Alt + " + temp;
				}
				if (e.ctrlKey)
				{
					HotKeyModifier |= HOTKEYF_CONTROL;
					temp = "Ctrl + " + temp;
				}
				
				if(!e.ctrlKey&&!e.altKey&&!e.shiftKey){
					HotKeyModifier |= HOTKEYF_ALT;
					HotKeyModifier |= HOTKEYF_CONTROL;
					temp="CTRL + ALT + "+temp;
				}
				
				HotKeyValue = (keynum & 0xffff) | (HotKeyModifier & 0xffff) << 16
				temp = temp + keychar;
				var isUser=false;
				$('.inp_hot_key').each(function(k,v){
					if( $(v).attr("hot_key")&&$(v).attr("hot_key")==HotKeyValue 
                        && $(v).attr("keyid")!=$(o).attr("keyid") ){
						$(o).val(temp);
						$("#"+$(o).attr("forId")).html("冲突");
						isUser=true;
					}
				});
				if(!isUser){
					$(o).val(temp);
					ret["hotKeyId"]=$(o).attr("keyId");
					console.log(temp);
					ret["hotKey"]=HotKeyValue;
					ret["hotVal"]=temp;
					return ret;
				}
			}			
		},
		keyValue:{
			//8:"BackSpace",
			//9:"Tab",
			12:"Clear",
			//13:"Enter",
			//19:"Pause",
			//20:"Caps_Lock",
			//27:"Escape",
			//32:"space space",
			33:"Prior",
			34:"Next",
			35:"End",
			36:"Home",
			37:"Left",
			38:"Up",
			39:"Right",
			40:"Down",
			//41:"Select",
			//42:"Print",
			//43:"Execute",
			45:"Insert",
			//46:"Delete",
			//47:"Help",
			48:"0",
			49:"1",
			50:"2",
			51:"3",
			52:"4",
			53:"5",
			54:"6",
			55:"7",
			56:"8",
			57:"9",
			65:"A",
			66:"B",
			67:"C",
			68:"D",
			69:"E",
			70:"F",
			71:"G",
			72:"H",
			73:"I",
			74:"J",
			75:"K",
			76:"L",
			77:"M",
			78:"N",
			79:"O",
			80:"P",
			81:"Q",
			82:"R",
			83:"S",
			84:"T",
			85:"U",
			86:"V",
			87:"W",
			88:"X",
			89:"Y",
			90:"Z",
			96:"Num 0",
			97:"Num 1",
			98:"Num 2",
			98:"Num 3",
			100:"Num 4",
			101:"Num 5",
			102:"Num 6",
			103:"Num 7",
			104:"Num 8",
			105:"Num 9",
			106:"Num *",
			107:"Num +",
			
			109:"Num -",
			110:"Num /",
			111:"Num Del",
			112:"F1",
			113:"F2",
			114:"F3",
			115:"F4",
			116:"F5",
			117:"F6",
			118:"F7",
			119:"F8",
			120:"F9",
			121:"F10",
			122:"F11",
			123:"F12",
			
			186:";",
			187:"=",
			188:",",
			189:"-",
			190:".",
			191:"/",
			192:".",
			
			219:"[",
			220:"\\",
			221:"]",
			222:"'",
			
			
		}
	}
	});
	var API = {
		/****************************
		* 功能：初始化页面设置
		* 返回值：如（{'AutoLogon':'true','AwayOnIdle':'true','AwayOnIdleMinutes':'5',
		* 				'BusyOnFullScreen':'true','CatchScreenHotKey':'393304','CloseToExit':'false',
		*				'CustomFolder':'c:\','EnableAroundRemind':'true','EnableShakeWindow':'true',
		*				'EnableSysSound':'true','FetionAutoRun':'true','MainWindowAutoHide':'true',
		*				'MainWindowHotKeyHide':'0','MainWindowHotKeyShow':'0','MainWindowTopMost':'false',
		*				'MiniPageAutoShow':'true','PresenceAfterLogon':'true','RecvOfflineFileSms':'1',
		*				'ShowLatestMessagesV5':'true','SmsNicknameConfig':'2','SmsOnlineStatus':'-1'}）
		*****************************/
		InitConfigData:function(){
		    this.addListnerFun("SysOption","setFilePath",null,null,this.setFilePath);
			this.selectPersons();
		    this.addListnerFunOfCacheSize("SysOption", "setCacheTempSize", null, null, this.setCacheTempSize);
			if(!isDebug){
				var strData = SM.exec('Ext', 'GetData', 'InitConfigData');
				var jsonData = eval("("+strData["json"]["value"]+")");
				if(jsonData.ConcernPersons&&jsonData.ConcernPersons!=""){
					jsonData.ConcernPersons = base64Coder.decode(jsonData.ConcernPersons);
					jsonData.ConcernPersons=eval("("+jsonData.ConcernPersons+")");
				}
				//jsonData.ConcernPersons=[{'id':'11','name':'是我ID文化从的女擦得','img':'','phone':'13522229999'},{'id':'11','name':'dd','img':'','phone':'13522229999'}];
				console.log(strData["json"]["value"]);
				return jsonData;
			}else{
				return {'UserType':2,'Position':1,'AddBuddyPermision':'1','AutoLogon':'false','AwayOnIdle':'true','AwayOnIdleMinutes':'5',
					'BusyOnFullScreen':'true','CatchScreenHotKey':'393304','CloseToExit':'false','SaveMyDocument':'false','path':'c:\\files\\',
					'CustomFolder':'c:\\','EnableAroundRemind':'true','EnableShakeWindow':'true','CacheSize':'30',
					'EnableSysSound':'true','FetionAutoRun':'true','MainWindowAutoHide':'true',
					'MainWindowHotKeyHide':'0','MainWindowHotKeyShow':'0','MainWindowTopMost':'false',
					'MiniPageAutoShow':'true','PresenceAfterLogon':'online','RecvOfflineFileSms':'1',/////
					'SafeNotify':0,'RecInvPubPhone':0,'StrangerSmsOffkey':'false','ConcernPersons':[],
					'ShowLatestMessagesV5':'true','SmsNicknameConfig':'2','SmsOnlineStatus':'-1','CCtoSmsConfig':1,"SmsDisableFlag":1,"WeatherReportLocalCity":"CN.ah.550","WeatherReportCitysString":'<Country Name="中国" Code="CN"><Province Name="北京" Code="bj"><City Name="北京" Code="10" /></Province><Province Name="上海" Code="sh"><City Name="上海" Code="21" /></Province><Province Name="重庆" Code="cq"><City Name="重庆" Code="23" /></Province><Province Name="天津" Code="tj"><City Name="天津" Code="22" /></Province><Province Name="香港" Code="HK"><City Name="香港" Code="HK" /></Province><Province Name="澳门" Code="MO"><City Name="澳门" Code="MO" /></Province><Province Name="台湾" Code="TW"><City Name="台湾" Code="TW" /></Province><Province Name="安徽" Code="ah"><City Name="滁州" Code="550" /><City Name="合肥" Code="551" /><City Name="蚌埠" Code="552" /><City Name="芜湖" Code="553" /><City Name="淮南" Code="554" /><City Name="马鞍山" Code="555" /><City Name="安庆" Code="556" /><City Name="宿州" Code="557" /><City Name="阜阳" Code="558" /><City Name="黄山" Code="559" /><City Name="亳州" Code="560" /><City Name="淮北" Code="561" /><City Name="铜陵" Code="562" /><City Name="宣城" Code="563" /><City Name="六安" Code="564" /><City Name="巢湖" Code="565" /><City Name="池州" Code="566" /></Province><Province Name="福建" Code="fj"><City Name="福州" Code="591" /><City Name="厦门" Code="592" /><City Name="宁德" Code="593" /><City Name="莆田" Code="594" /><City Name="泉州" Code="595" /><City Name="漳州" Code="596" /><City Name="龙岩" Code="597" /><City Name="三明" Code="598" /><City Name="南平" Code="599" /></Province><Province Name="广东" Code="gd"><City Name="广州" Code="20" /><City Name="汕尾" Code="660" /><City Name="潮阳" Code="661" /><City Name="阳江" Code="662" /><City Name="揭阳" Code="663" /><City Name="茂名" Code="668" /><City Name="江门" Code="750" /><City Name="韶关" Code="751" /><City Name="惠州" Code="752" /><City Name="梅州" Code="753" /><City Name="汕头" Code="754" /><City Name="深圳" Code="755" /><City Name="珠海" Code="756" /><City Name="佛山" Code="757" /><City Name="肇庆" Code="758" /><City Name="湛江" Code="759" /><City Name="中山" Code="760" /><City Name="河源" Code="762" /><City Name="清远" Code="763" /><City Name="顺德" Code="765" /><City Name="云浮" Code="766" /><City Name="潮州" Code="768" /><City Name="东莞" Code="769" /></Province><Province Name="甘肃" Code="gs"><City Name="临夏" Code="930" /><City Name="兰州" Code="931" /><City Name="定西" Code="932" /><City Name="平凉" Code="933" /><City Name="西峰" Code="934" /><City Name="金昌" Code="935" /><City Name="张掖" Code="936" /><City Name="酒泉" Code="937" /><City Name="天水" Code="938" /><City Name="陇南" Code="939" /><City Name="甘南" Code="941" /><City Name="嘉峪关" Code="942" /><City Name="白银" Code="943" /><City Name="武威" Code="944" /></Province><Province Name="广西" Code="gx"><City Name="防城港" Code="770" /><City Name="南宁" Code="771" /><City Name="柳州" Code="772" /><City Name="桂林" Code="773" /><City Name="梧州" Code="774" /><City Name="玉林" Code="775" /><City Name="百色" Code="776" /><City Name="钦州" Code="777" /><City Name="河池" Code="778" /><City Name="北海" Code="779" /><City Name="崇左" Code="780" /><City Name="贵港" Code="781" /><City Name="贺州" Code="782" /><City Name="来宾" Code="783" /></Province><Province Name="贵州" Code="gz"><City Name="贵阳" Code="851" /><City Name="遵义" Code="852" /><City Name="安顺" Code="853" /><City Name="黔南" Code="854" /><City Name="黔东南" Code="855" /><City Name="铜仁" Code="856" /><City Name="毕节" Code="857" /><City Name="六盘水" Code="858" /><City Name="黔西南" Code="859" /></Province><Province Name="河南" Code="ha"><City Name="商丘" Code="370" /><City Name="郑州" Code="371" /><City Name="安阳" Code="372" /><City Name="新乡" Code="373" /><City Name="许昌" Code="374" /><City Name="平顶山" Code="375" /><City Name="信阳" Code="376" /><City Name="南阳" Code="377" /><City Name="开封" Code="378" /><City Name="洛阳" Code="379" /><City Name="焦作" Code="391" /><City Name="鹤壁" Code="392" /><City Name="濮阳" Code="393" /><City Name="周口" Code="394" /><City Name="漯河" Code="395" /><City Name="驻马店" Code="396" /><City Name="潢川" Code="397" /><City Name="三门峡" Code="398" /></Province><Province Name="湖北" Code="hb"><City Name="武汉" Code="27" /><City Name="襄阳" Code="710" /><City Name="鄂州" Code="711" /><City Name="孝感" Code="712" /><City Name="黄冈" Code="713" /><City Name="黄石" Code="714" /><City Name="咸宁" Code="715" /><City Name="荆州" Code="716" /><City Name="宜昌" Code="717" /><City Name="恩施" Code="718" /><City Name="十堰" Code="719" /><City Name="潜江" Code="720" /><City Name="天门" Code="721" /><City Name="随州" Code="722" /><City Name="神农架" Code="723" /><City Name="荆门" Code="724" /><City Name="仙桃" Code="728" /></Province><Province Name="河北" Code="he"><City Name="邯郸" Code="310" /><City Name="石家庄" Code="311" /><City Name="保定" Code="312" /><City Name="张家口" Code="313" /><City Name="承德" Code="314" /><City Name="唐山" Code="315" /><City Name="廊坊" Code="316" /><City Name="沧州" Code="317" /><City Name="衡水" Code="318" /><City Name="邢台" Code="319" /><City Name="秦皇岛" Code="335" /></Province><Province Name="海南" Code="hi"><City Name="白沙" Code="840" /><City Name="保亭" Code="841" /><City Name="昌江" Code="842" /><City Name="澄迈" Code="843" /><City Name="儋州" Code="844" /><City Name="定安" Code="845" /><City Name="东方" Code="846" /><City Name="乐东" Code="847" /><City Name="临高" Code="848" /><City Name="陵水" Code="849" /><City Name="琼海" Code="861" /><City Name="琼中" Code="862" /><City Name="三亚" Code="863" /><City Name="屯昌" Code="864" /><City Name="万宁" Code="865" /><City Name="文昌" Code="866" /><City Name="五指山" Code="867" /><City Name="三沙" Code="869" /><City Name="海口" Code="898" /></Province><Province Name="黑龙江" Code="hl"><City Name="哈尔滨" Code="451" /><City Name="齐齐哈尔" Code="452" /><City Name="牡丹江" Code="453" /><City Name="佳木斯" Code="454" /><City Name="绥化" Code="455" /><City Name="黑河" Code="456" /><City Name="大兴安岭" Code="457" /><City Name="伊春" Code="458" /><City Name="大庆" Code="459" /><City Name="七台河" Code="464" /><City Name="鸡西" Code="467" /><City Name="鹤岗" Code="468" /><City Name="双鸭山" Code="469" /></Province><Province Name="湖南" Code="hn"><City Name="岳阳" Code="730" /><City Name="长沙" Code="731" /><City Name="湘潭" Code="732" /><City Name="株洲" Code="733" /><City Name="衡阳" Code="734" /><City Name="郴州" Code="735" /><City Name="常德" Code="736" /><City Name="益阳" Code="737" /><City Name="娄底" Code="738" /><City Name="邵阳" Code="739" /><City Name="湘西" Code="743" /><City Name="张家界" Code="744" /><City Name="怀化" Code="745" /><City Name="永州" Code="746" /></Province><Province Name="吉林" Code="jl"><City Name="长春" Code="431" /><City Name="吉林" Code="432" /><City Name="延边" Code="433" /><City Name="四平" Code="434" /><City Name="通化" Code="435" /><City Name="白城" Code="436" /><City Name="辽源" Code="437" /><City Name="松原" Code="438" /><City Name="白山" Code="439" /><City Name="梅河口" Code="448" /></Province><Province Name="江苏" Code="js"><City Name="南京" Code="25" /><City Name="无锡" Code="510" /><City Name="镇江" Code="511" /><City Name="苏州" Code="512" /><City Name="南通" Code="513" /><City Name="扬州" Code="514" /><City Name="盐城" Code="515" /><City Name="徐州" Code="516" /><City Name="淮安" Code="517" /><City Name="连云港" Code="518" /><City Name="常州" Code="519" /><City Name="泰州" Code="523" /><City Name="宿迁" Code="527" /></Province><Province Name="江西" Code="jx"><City Name="鹰潭" Code="701" /><City Name="新余" Code="790" /><City Name="南昌" Code="791" /><City Name="九江" Code="792" /><City Name="上饶" Code="793" /><City Name="抚州" Code="794" /><City Name="宜春" Code="795" /><City Name="吉安" Code="796" /><City Name="赣州" Code="797" /><City Name="景德镇" Code="798" /><City Name="萍乡" Code="799" /></Province><Province Name="辽宁" Code="ln"><City Name="沈阳" Code="24" /><City Name="铁岭" Code="410" /><City Name="大连" Code="411" /><City Name="鞍山" Code="412" /><City Name="抚顺" Code="413" /><City Name="本溪" Code="414" /><City Name="丹东" Code="415" /><City Name="锦州" Code="416" /><City Name="营口" Code="417" /><City Name="阜新" Code="418" /><City Name="辽阳" Code="419" /><City Name="朝阳" Code="421" /><City Name="盘锦" Code="427" /><City Name="葫芦岛" Code="429" /></Province><Province Name="内蒙古" Code="nm"><City Name="呼伦贝尔" Code="470" /><City Name="呼和浩特" Code="471" /><City Name="包头" Code="472" /><City Name="乌海" Code="473" /><City Name="乌兰察布" Code="474" /><City Name="通辽" Code="475" /><City Name="赤峰" Code="476" /><City Name="鄂尔多斯" Code="477" /><City Name="巴彦淖尔" Code="478" /><City Name="锡林浩特" Code="479" /><City Name="兴安" Code="482" /><City Name="阿拉善" Code="483" /></Province><Province Name="宁夏" Code="nx"><City Name="银川" Code="951" /><City Name="石嘴山" Code="952" /><City Name="吴忠" Code="953" /><City Name="固原" Code="954" /><City Name="中卫" Code="955" /></Province><Province Name="青海" Code="qh"><City Name="海晏" Code="970" /><City Name="西宁" Code="971" /><City Name="海东" Code="972" /><City Name="黄南" Code="973" /><City Name="海南" Code="974" /><City Name="果洛" Code="975" /><City Name="玉树" Code="976" /><City Name="德令哈" Code="977" /><City Name="海北" Code="978" /><City Name="海西" Code="979" /></Province><Province Name="四川" Code="sc"><City Name="成都" Code="28" /><City Name="攀枝花" Code="812" /><City Name="自贡" Code="813" /><City Name="绵阳" Code="816" /><City Name="南充" Code="817" /><City Name="达州" Code="818" /><City Name="遂宁" Code="825" /><City Name="广安" Code="826" /><City Name="巴中" Code="827" /><City Name="眉山" Code="828" /><City Name="资阳" Code="829" /><City Name="泸州" Code="830" /><City Name="宜宾" Code="831" /><City Name="内江" Code="832" /><City Name="乐山" Code="833" /><City Name="凉山" Code="834" /><City Name="雅安" Code="835" /><City Name="甘孜" Code="836" /><City Name="阿坝" Code="837" /><City Name="德阳" Code="838" /><City Name="广元" Code="839" /></Province><Province Name="山东" Code="sd"><City Name="菏泽" Code="530" /><City Name="济南" Code="531" /><City Name="青岛" Code="532" /><City Name="淄博" Code="533" /><City Name="德州" Code="534" /><City Name="烟台" Code="535" /><City Name="潍坊" Code="536" /><City Name="济宁" Code="537" /><City Name="泰安" Code="538" /><City Name="临沂" Code="539" /><City Name="滨州" Code="543" /><City Name="东营" Code="546" /><City Name="威海" Code="631" /><City Name="枣庄" Code="632" /><City Name="日照" Code="633" /><City Name="莱芜" Code="634" /><City Name="聊城" Code="635" /></Province><Province Name="陕西" Code="sn"><City Name="西安" Code="29" /><City Name="咸阳" Code="910" /><City Name="延安" Code="911" /><City Name="榆林" Code="912" /><City Name="渭南" Code="913" /><City Name="商洛" Code="914" /><City Name="安康" Code="915" /><City Name="汉中" Code="916" /><City Name="宝鸡" Code="917" /><City Name="铜川" Code="919" /></Province><Province Name="山西" Code="sx"><City Name="朔州" Code="349" /><City Name="忻州" Code="350" /><City Name="太原" Code="351" /><City Name="大同" Code="352" /><City Name="阳泉" Code="353" /><City Name="晋中" Code="354" /><City Name="长治" Code="355" /><City Name="晋城" Code="356" /><City Name="临汾" Code="357" /><City Name="吕梁" Code="358" /><City Name="运城" Code="359" /></Province><Province Name="新疆" Code="xj"><City Name="塔城" Code="901" /><City Name="哈密" Code="902" /><City Name="和田" Code="903" /><City Name="阿勒泰" Code="906" /><City Name="阿图什" Code="908" /><City Name="博乐" Code="909" /><City Name="阿拉尔" Code="920" /><City Name="五家渠" Code="921" /><City Name="图木舒克" Code="922" /><City Name="克拉玛依" Code="990" /><City Name="乌鲁木齐" Code="991" /><City Name="奎屯" Code="992" /><City Name="石河子" Code="993" /><City Name="昌吉" Code="994" /><City Name="吐鲁番" Code="995" /><City Name="库尔勒" Code="996" /><City Name="阿克苏" Code="997" /><City Name="喀什" Code="998" /><City Name="伊宁" Code="999" /></Province><Province Name="西藏" Code="xz"><City Name="拉萨" Code="891" /><City Name="日喀则" Code="892" /><City Name="山南" Code="893" /><City Name="林芝" Code="894" /><City Name="昌都" Code="895" /><City Name="那曲" Code="896" /><City Name="阿里" Code="897" /></Province><Province Name="云南" Code="yn"><City Name="昭通" Code="870" /><City Name="昆明" Code="871" /><City Name="大理" Code="872" /><City Name="曲靖" Code="874" /><City Name="文山" Code="876" /><City Name="玉溪" Code="877" /><City Name="楚雄" Code="878" /><City Name="临沧" Code="883" /><City Name="丽江" Code="888" />	  <City Name="红河" Code="873" />	  <City Name="普洱" Code="879" />	  <City Name="保山" Code="875" />	  <City Name="西双版纳" Code="691" />	  <City Name="德宏" Code="692" />	  <City Name="怒江" Code="886" />	  <City Name="迪庆" Code="887" /></Province><Province Name="浙江" Code="zj"><City Name="衢州" Code="570" /><City Name="杭州" Code="571" /><City Name="湖州" Code="572" /><City Name="嘉兴" Code="573" /><City Name="宁波" Code="574" /><City Name="绍兴" Code="575" /><City Name="台州" Code="576" /><City Name="温州" Code="577" /><City Name="丽水" Code="578" /><City Name="金华" Code="579" /><City Name="舟山" Code="580" /></Province></Country>'};
			}
			
		},
		
		/****************************
		* 功能：配置变化的项通知客户端
		* 参数：jsonItem:{key:AutoLogon,value:true}
		*****************************/
		ChangeConfigItem:function(jsonItem){
			
			if (!isDebug) {
				SM.exec('SysOption', 'ChangeConfigItem', '', jsonItem);
			} else {
				alert("通知客户端" + jsonItem.key + ":" + jsonItem.value);
			}
		},
		
		OpenWindow:function(jsonItem){
			if(!isDebug){
				SM.exec( 'SysOption', 'OpenWindow', '', jsonItem );
			}else{
				alert("通知客户端" + jsonItem.type);
			}
		},
		CheckHotKey:function(jsonItem,obj){
			if(!isDebug){
				SM.ajax( 'SysOption', 'CheckHotKey', '', jsonItem, function (status, txt, json){
					if ( status == 200 || status == 188)
					{
						console.log( '检测热键成功:' + jsonItem.hotKeyId);
						console.log(json.canUse);
						console.log(jsonItem.hotKeyId);
					//	var hotKeyId = json.hotKeyId;
						var hotKey = json.hotKey;
						var canUse = json.canUse;	// 如果为false，则说明已被占用。
						console.log((!canUse));
						if(!canUse){
							$("#"+$(obj).attr("forId")).html("冲突");
						}else{
							$(obj)[0].setAttribute("hot_key",json.hotKey);
							$(obj)[0].setAttribute("hot_val",json.hotVal);
							$("#"+$(obj).attr("forId")).html("");
							PcAPI.ChangeConfigItem({'key':jsonItem.hotKeyId,'value':json.hotKey});
						}
					 }
					 else if ( status == 404 )
					 {
						console.log( '检测热键失败，404' );
					 }
					 else
					 {
						console.log( '飞信客户端发生未知错误' );
					 }
				});
			}else{
				alert("通知客户端" + jsonItem.type);
			}
		},
		addListnerFun:function(path, command, txt, json,callback){
			SM.ajax(path, command, txt, json, function(status, outTxt, outJson) {
					if (callback != undefined && callback != null && callback != "") {
						callback(outJson);
					}
				}
			);
		},
		// 设置浏览文件地址outJson={path:""}
		setFilePath:function(outJson) {
			if(outJson.type==1&&outJson.path==0){
				$("#MoveFolder").css("color","red");
				$("#MoveFolder").val("路径无效，请重新选择。");
				document.getElementById("filemanagerTag").click();
			}else{
				if($("a.savemydocument").attr("selected")=="true"){
					$("#MoveFolder").css("color","bbb");
				}else{
					$("#MoveFolder").css("color","");
				}
				$("#MoveFolder").val(outJson.path);
				PcAPI.ChangeConfigItem({'key':"path",'value':outJson.path});
			}
		
		},
		addListnerFunOfCacheSize:function(path, command, txt, json,callback){
			SM.ajax(path, command, txt, json, function(status, outTxt, outJson) {
					if (callback != undefined && callback != null && callback != "") {
						callback(outJson);
					}
				}
			);
		},
		// 设置个人文件夹清理后的大小outJson={size:""}
		setCacheTempSize:function(outJson) {
			$("#CacheSize").html(outJson.size);
			if(outJson.size=="0B"){
				$("#ClearPersonalFolder").unbind();
				$("#ClearPersonalFolder").css("color","bbb");
			}else{
				$("#ClearPersonalFolder").css("color","");
				$("#ClearPersonalFolder").unbind().bind("click",function(){
					PcAPI.OpenWindow({'type':'ClearPersonalFolder'});
				}).hover(function() {
					$(this).addClass("btn01_0");
				}, function() {
					$(this).removeClass("btn01_0");
				}).bind("mousedown",function(){
					$(this).addClass("btn01_1");
				}).bind("mouseup",function(){
					$(this).removeClass("btn01_1");
				});
			}
		},
		//添加关注联系人
		selectPersons:function()
		{
		SM.ajax( 'SysOption', 'SelectPersons', '', null, function (status, txt, json){
					if ( status == 200 || status == 188)
					{
					//var datas = eval("(" + json + ")");
					$.allset.setConcernPersonsItem(json);
					//ChangeConfigItem("ConcernPersons",outJson);
					}
					});
			
		},
		//删除联系人
		deletePersons: function(obj) {
			var id=$(obj).parent().attr("id");
			$(obj).parent().remove();
			// var allObj = $("#ConcernPersons").children();
			// var outJson = "[";
			// for (var i = 0; i < allObj.length; i++) {
			// 	outJson += allObj.attr("data") + ",";
			// };
			// if (allObj.length > 0)
			// 	outJson = outJson.substr(0, outJson.length - 1);
			// outJson += "]";
			SM.exec( 'SysOption', 'DeletePerson',id,'' );
			

		},
		refresh:function(){
			SM.ajax( 'SysOption', 'Refresh', '', null, function (status, txt, json){
				if ( status == 200 || status == 188){
					$.allset.setConcernPersonsItem(json);
				}
			});
			
		}
		
	}
	PcAPI = API;
    function Base64() {

        // private property   
        _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

        // public method for encoding   
        this.encode = function(input) {
            var output = "";
            var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
            var i = 0;
            input = _utf8_encode(input);
            while (i < input.length) {
                chr1 = input.charCodeAt(i++);
                chr2 = input.charCodeAt(i++);
                chr3 = input.charCodeAt(i++);
                enc1 = chr1 >> 2;
                enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
                enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
                enc4 = chr3 & 63;
                if (isNaN(chr2)) {
                    enc3 = enc4 = 64;
                } else if (isNaN(chr3)) {
                    enc4 = 64;
                }
                output = output +
			   _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
			   _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
            }
            return output;
        }

        // public method for decoding   
        this.decode = function(input) {
            var output = "";
            var chr1, chr2, chr3;
            var enc1, enc2, enc3, enc4;
            var i = 0;
            input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
            while (i < input.length) {
                enc1 = _keyStr.indexOf(input.charAt(i++));
                enc2 = _keyStr.indexOf(input.charAt(i++));
                enc3 = _keyStr.indexOf(input.charAt(i++));
                enc4 = _keyStr.indexOf(input.charAt(i++));
                chr1 = (enc1 << 2) | (enc2 >> 4);
                chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
                chr3 = ((enc3 & 3) << 6) | enc4;
                output = output + String.fromCharCode(chr1);
                if (enc3 != 64) {
                    output = output + String.fromCharCode(chr2);
                }
                if (enc4 != 64) {
                    output = output + String.fromCharCode(chr3);
                }
            }
            output = _utf8_decode(output);
            return output;
        }

        // private method for UTF-8 encoding   
        _utf8_encode = function(string) {
            string = string.replace(/\r\n/g, "\n");
            var utftext = "";
            for (var n = 0; n < string.length; n++) {
                var c = string.charCodeAt(n);
                if (c < 128) {
                    utftext += String.fromCharCode(c);
                } else if ((c > 127) && (c < 2048)) {
                    utftext += String.fromCharCode((c >> 6) | 192);
                    utftext += String.fromCharCode((c & 63) | 128);
                } else {
                    utftext += String.fromCharCode((c >> 12) | 224);
                    utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                    utftext += String.fromCharCode((c & 63) | 128);
                }

            }
            return utftext;
        }

        // private method for UTF-8 decoding   
        _utf8_decode = function(utftext) {
            var string = "";
            var i = 0;
            var c = c1 = c2 = 0;
            while (i < utftext.length) {
                c = utftext.charCodeAt(i);
                if (c < 128) {
                    string += String.fromCharCode(c);
                    i++;
                } else if ((c > 191) && (c < 224)) {
                    c2 = utftext.charCodeAt(i + 1);
                    string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                    i += 2;
                } else {
                    c2 = utftext.charCodeAt(i + 1);
                    c3 = utftext.charCodeAt(i + 2);
                    string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                    i += 3;
                }
            }
            return string;
        }
    }
	var base64Coder = new Base64();


	
}
)(jQuery);
