
					
$(function(){
	parent.managerIframe=parent.document.getElementById("manager").contentWindow;

	My$("ul[name='manager_menus'] li").click(function(){
			if(My$(this).attr("class") != "first on"){
				My$("ul[name='manager_menus'] li").attr("class","");
				My$(this).attr("class","first on");
				var id=My$(this).attr("id");
				
				My$("div[name='manager_content']").hide();		
				
				switch(id){
					case "manager_client" : My$("#manager_content_client").show();
											ClientMananger.query(1);
											break;
											
					case "manager_user" :   My$("#manager_content_user").show();
										  	UserMananger.query(1);
										    break;
					                        
					case "manager_vehicle" : if($("#manager_userType").val()==0)$("#addVechileBtn").hide();
											 My$("#manager_content_vechile").show();
										  	 VechileMananger.query(1);
										  	 break;
					
					case "manager_group" : My$("#manager_content_group").show();
										   GroupMananger.query(1);
										   break;
				}
			}
	});
	
	My$("a[name='shebei_zhuangtai']").click(function(){
		
		My$("a[name='shebei_zhuangtai']").attr("class","");
		
		My$(this).attr("class","shebei_select");	
			
		var id=My$(this).attr("id").split("_")[1];
		
		My$("span[name='ot_count']").html("");
		
		VechileMananger.queryType=id;
		
		VechileMananger.query(1);
	
	});
	
	Manager.initManager();
	
	 //添加客户窗口开始
		frame("clientContentWin","moveClientWin","closecclientWin");
	 //添加客户窗口结束
	 
	 //添加组窗口开始
		frame("manager_groupContentWin","manager_moveGroupWin","manager_closecgroupWin");
	 //添加组窗口结束
	 
	 //添加设备窗口开始
		frame("manager_vechileContentWin","manager_moveVechileWin","manager_closecvechileWin");
	 //添加设备窗口结束
	 
	 //添加设备窗口开始
		frame("manager_userContentWin","manager_moveUserWin","manager_closecUserWin");
	 //添加设备窗口结束
	 
	//Manager.loadDictionary();//加载数据字典	
	 
	My$(window).resize(function(){
		winToCenter();
	});
});

var Manager={
	dictionary : null,
	modelJson : null,
	modelObject : { getModelById : function (id){
										var modelType="";
										switch(id){
											case 101000: modelType = "manager_client"; break;
											case 101010: modelType = "addClientBtn"; break;
											case 20101020: Manager.modelObject.DelUpdate.clientOperate.del=true; break;
											case 10101020: Manager.modelObject.DelUpdate.clientOperate.update=true; break;
											case 105000: modelType = "manager_user"; break;
											case 105010: modelType = "addUserBtn"; break;
											case 20105020: Manager.modelObject.DelUpdate.userOperate.del=true; break;
											case 10105020: Manager.modelObject.DelUpdate.userOperate.update=true; break;
											case 102000: modelType = "manager_group"; break;
											case 102010: modelType = "addGroupBtn"; break;
											case 20102020: Manager.modelObject.DelUpdate.groupOperate.del=true; break;
											case 10102020: Manager.modelObject.DelUpdate.groupOperate.update=true; break;
											case 103000: modelType = "manager_vehicle"; break;
											case 103010: modelType = "addVechileBtn"; break;
											case 20103020: Manager.modelObject.DelUpdate.vechileOperate.del=true; break;
											case 10103020: Manager.modelObject.DelUpdate.vechileOperate.update=true; break;
											 
										}
										
										return modelType;
								   },
					 DelUpdate :{
					 		clientOperate : {"del" : false,"update" : false},
					 		userOperate : {"del" : false,"update" : false},
					 		vechileOperate : {"del" : false,"update" : false},
					 		groupOperate : {"del" : false,"update" : false}
					 
					 }
				  },
	loadDictionary : function(){
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        async: false,
		        url: "manager/dictionaryAction_dictionary.action",
		        success: function(json){
					 //console.info("*******"+JSON.stringify(json));
		        	 if(json.flag == undefined){
		        	 	Manager.dictionary = json;
		        	 	parent.managerDictionary = json;
		        	 }
		        }
		});
	},
	
	initManager : function(){
		if(!parent.isloginManager){
			parent.loginManager();
		}
		
		if(parent.managerDictionary == null){
			Manager.loadDictionary();
		}
		
		Manager.dictionary = parent.managerDictionary;
		
		this.modelJson = parent.modelJson;
		
		if(Manager.modelJson != null){
			var ModelType="";
			for(var i=0;i<Manager.modelJson.length;i++){
				ModelType="";
				ModelType = Manager.modelObject.getModelById(Manager.modelJson[i].id);
				if(ModelType.length!=0){
					My$("#"+ModelType).show();
				}
			}
			My$("ul[name='manager_menus'] li").each(function(){
				if(My$(this).is(":visible")){
					My$(this).click();
					return false;
				}			
			});
		}
		$("#manager_content_loadding").hide();
	}
}

var ClientMananger = {
	openAddWindow : function (){
		initErrorMsg();
		openMask(false);
		
		//My$("#clientContentWin").center();
		//My$("#clientContentWin").show();
		$("#clientContentWin",parent.document).center();
		$("#clientContentWin",parent.document).show();
	},
	add : function (){
		
		My$("#addClientButton").attr("disabled","disabled");//设置所有的button不可用   
		
		var companyName=My$("#companyName").val(),
			phone=My$("#companyPhone").val(),
			address=My$("#companyAddress").val();
			
		if(companyName.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qymcbnwk);
			My$("#addClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}
		/*
		if(phone.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qydhbnwk);
			return;
		}
		
		if(address.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qydzbnwk);
			return;
		}*/
		My$("#addclientmsg").css("color","rgb(153, 153, 153)");
		My$("#addclientmsg").text(manager.zztj);
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/clientAction_add.action",
		        data:{"form.companyName":companyName,"form.phone":phone,"form.officeaddres":address},
		        success: function(json) {
			         if (json.flag==true) {
			         
			         	My$("#closecclientWin").click();
			         	
			         	ClientMananger.query(1);
			         	
			         }else{
			         	My$("#addclientmsg").css("color","red");
						My$("#addclientmsg").text("*"+json.msg);
						
						My$("#addClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
		
	},
	clientIds : "",
	checkedAll : function(element){
		if(My$(element).is(":checked")){
			My$("input[name='client_checkBox']").each(function(){
			   			ClientMananger.clientIds += My$(this).val()+",";
			   			My$(this).attr("checked",true);	
			});
			ClientMananger.clientIds=ClientMananger.clientIds.substring(0,ClientMananger.clientIds.length-1);
		}else{
			My$("input[name='client_checkBox']").each(function(){
			   	My$(this).attr("checked",false);
			}); 
			ClientMananger.clientIds="";
		}
	},
	batchDel: function(){
		initErrorMsg();
		if(this.clientIds!=""){
			this.del(this.clientIds);
		}else{
			alert("请选择要删除的记录！");
		}
	},
	del : function (id){
		initErrorMsg();
		if(confirm(manager.qdyscm)){
			openMask(true);
			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: true,
			        url: "manager/clientAction_delete.action",
			        data:{"form.id":id},
			        success: function(json) {
				         if (json.flag==true) {
				         		ClientMananger.query(1);      	
				         }else{
				         		My$("#manager_msg_client").text(json.msg);
				         }
				          closeMask();
			        },error: function() { closeMask();}
			 });
			
		 }
		
	},
	openUpdateWindow : function (id){
		initErrorMsg();
		openMask(false);
		var tds = My$("#client_"+id).find("td");
		
		var companyName=My$(tds[1]).text(),
		    phone=My$(tds[3]).text(),
		    address=My$(tds[4]).text();
		    
		My$("#companyName").val(companyName);
		My$("#companyPhone").val(phone);
		My$("#companyAddress").val(address);
		My$("#clientID").val(id);
		
		My$("#addClientButton").hide();
		My$("#updateClientButton").show();
		
		My$("#manager_clientName").text(manager.xgkh);
		
		ClientMananger.openAddWindow();
	},
	update : function (){
		
		My$("#updateClientButton").attr("disabled","disabled");//设置所有的button不可用  
		
		var companyName=My$("#companyName").val(),
			phone=My$("#companyPhone").val(),
			address=My$("#companyAddress").val(),
			id=My$("#clientID").val();
			
		if(companyName.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qymcbnwk);
			
			My$("#updateClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			
			return;
		}
		
		/*
		if(phone.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qydhbnwk);
			return;
		}
		
		if(address.length==0){
			My$("#addclientmsg").css("color","red");
			My$("#addclientmsg").text(manager.qydzbnwk);
			return;
		}
		*/
		My$("#addclientmsg").css("color","rgb(153, 153, 153)");
		My$("#addclientmsg").text(manager.zztj);
		
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/clientAction_update.action",
		        data:{"form.id":id,"form.companyName":companyName,"form.phone":phone,"form.officeaddres":address},
		        success: function(json) {
			         if (json.flag==true) {
			   
			         	var tds = My$("#client_"+id).find("td");
		
						My$(tds[1]).text(companyName),
						My$(tds[3]).text(phone),
						My$(tds[4]).text(address);
						    
			         	My$("#closecclientWin").click();
			         	
			         	
			         }else{
			         
			         	My$("#addclientmsg").css("color","red");
						My$("#addclientmsg").text("*"+json.msg);
						
						My$("#updateClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
		
	},
	pageSize: 10,
	pageCount : 0,
	nextPage : function(){
		var curPageNum=parseInt(My$("#client_page_num").text());
		if(0<curPageNum && curPageNum< ClientMananger.pageCount){
			this.query(curPageNum+1);
		}
		
	},
	prevPage : function(){
		var curPageNum=parseInt(My$("#client_page_num").text());
		if(1<curPageNum){
			this.query(curPageNum-1);
		}
		
	},
	startPage : function(){
		if(parseInt(My$("#client_page_num").text())!=1){
			this.query(1);
		}
	},
	endPage : function(){
		if(parseInt(My$("#client_page_num").text())!=ClientMananger.pageCount){
			this.query(ClientMananger.pageCount);
		}
	},
	query : function(pageOffset){
		initErrorMsg();
		My$("#table_manager_client tr").eq(0).nextAll().remove();
		My$("#table_manager_client tr").eq(0).after("<tr><td><div style='padding:10px; font-size:14px; color:#0099FF;'> loading... </div></td>"+
	                                      "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");	
	   var queryValue="";
	   
	   //if($("#client_query_value").attr("isquery")=="true"){
	   		queryValue=$("#client_query_value").val();//查询的企业名称
	   //}

	   
	   try{
	   		My$("#client_query_btn").attr("disabled","disabled");//设置所有的button不可用
	   		
		    $.ajax({
			        type: "POST",
			        dataType: "json",
			        url: "manager/clientAction_query.action",
			        async : false,
			        data : {"form.pageOffset":(pageOffset-1)*ClientMananger.pageSize,"form.pageSize":ClientMananger.pageSize,"form.queryValue":queryValue},
			        success: function(json) {
			        	 My$("#table_manager_client tr").eq(0).nextAll().remove();
				         if (json.flag==true) {
				 				 if(json.data.length!=0){			 				
											
				 				 	 if(Manager.modelObject.DelUpdate.clientOperate.del && Manager.modelObject.DelUpdate.clientOperate.update){
									     for(var i=0;i<json.data.length;i++){/*<td align=\"center\"  style=\"width: 30px;\"><input type=\"checkbox\" name=\"client_checkBox\" value=\""+json.data[i].id+"\"/></td>*/
									       	    My$("#table_manager_client").append("<tr id='client_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+ (i+1+((pageOffset-1)*ClientMananger.pageSize)) +"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].compyname+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].compyperson+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].phone+"</td><td align=\"center\"  style=\"width: 250px;\">"+json.data[i].officeaddrs+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:ClientMananger.del("+json.data[i].id+");\"  style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> | <a href=\"javascript:ClientMananger.openUpdateWindow("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\">"+manager.xiugai+"</a></span></td></tr>");
									     }
								     }else if(Manager.modelObject.DelUpdate.clientOperate.del){
								     	for(var i=0;i<json.data.length;i++){/*<td align=\"center\"  style=\"width: 30px;\"><input type=\"checkbox\" name=\"client_checkBox\" value=\""+json.data[i].id+"\"/></td>*/
									       	    My$("#table_manager_client").append("<tr id='client_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+ (i+1+((pageOffset-1)*ClientMananger.pageSize)) +"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].compyname+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].compyperson+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].phone+"</td><td align=\"center\"  style=\"width: 250px;\">"+json.data[i].officeaddrs+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:ClientMananger.del("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> </span></td></tr>");
									     }
								     }else if(Manager.modelObject.DelUpdate.clientOperate.update){
								     	for(var i=0;i<json.data.length;i++){/*<td align=\"center\"  style=\"width: 30px;\"><input type=\"checkbox\" name=\"client_checkBox\" value=\""+json.data[i].id+"\"/></td>*/
									       	    My$("#table_manager_client").append("<tr id='client_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+ (i+1+((pageOffset-1)*ClientMananger.pageSize)) +"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].compyname+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].compyperson+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].phone+"</td><td align=\"center\"  style=\"width: 250px;\">"+json.data[i].officeaddrs+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:ClientMananger.openUpdateWindow("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\">"+manager.xiugai+"</a></span></td></tr>");
									     }
								     }else{
								     	 for(var i=0;i<json.data.length;i++){/*<td align=\"center\"  style=\"width: 30px;\"><input type=\"checkbox\" name=\"client_checkBox\" value=\""+json.data[i].id+"\"/></td>*/
									       	    My$("#table_manager_client").append("<tr id='client_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+ (i+1+((pageOffset-1)*ClientMananger.pageSize)) +"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].compyname+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].compyperson+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].phone+"</td><td align=\"center\"  style=\"width: 250px;\">"+json.data[i].officeaddrs+"</td><td align=\"center\"  style=\"width: 100px;\"><span>&nbsp; </span></td></tr>");
									     }
								     }
								     var pageCount=0;
								     if( (json.totalCount % (ClientMananger.pageSize)) ==0){
								     	  pageCount = json.totalCount/ClientMananger.pageSize;
								     }else{
								     	  pageCount = parseInt(json.totalCount/ClientMananger.pageSize) + 1;
								     }
								     
								     My$("#client_page_count").text(pageCount);
								     My$("#client_page_num").text(pageOffset);
								     My$("#client_record_count").text(json.totalCount);
								     ClientMananger.pageCount=pageCount;
							     }else{
							     	 ClientMananger.pageCount=0;
							     	 My$("#client_page_count").text(0);
								     My$("#client_page_num").text(0);
								     My$("#client_record_count").text(0);
							     }
							     ClientMananger.clientIds="";
							     ClientMananger.initPageBtn();
				         }else{
			          	 	My$("#manager_msg_client").text("*"+json.msg);                                             
			             }
			        },
			        error: function() {
			             My$("#table_manager_client tr").eq(0).nextAll().remove();
			        }
			});	
		}catch(e){
			    My$("#client_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}finally{
			    My$("#client_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}
	},
	initPageBtn : function(){//startPage
		if(parseInt(My$("#client_page_num").text())>=ClientMananger.pageCount){
			My$("#client_nextPage_Btn").attr("class","un_fenye_s");
			My$("#client_endPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#client_nextPage_Btn").attr("class","en_fenye_s");
			My$("#client_endPage_Btn").attr("class","en_fenye_s");
		}
		
		if(parseInt(My$("#client_page_num").text())<=1){
			My$("#client_startPage_Btn").attr("class","un_fenye_s");
			My$("#client_prevPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#client_startPage_Btn").attr("class","en_fenye_s");
			My$("#client_prevPage_Btn").attr("class","en_fenye_s");
		}		
	}
}


var GroupMananger = {
	openAddWindow : function (){
		initErrorMsg();
		openMask(false);
		//GroupMananger.initClientSelect(-1);
		
		My$("#manager_groupContentWin").center();
		My$("#manager_groupContentWin").show();
		
	},
	add : function (){
		
		My$("#addGroupButton").attr("disabled","disabled");//设置所有的button不可用   
		
		var reg=/^[0-9]+?$/;
		
		var groupName=My$("#groupName").val(),
			userCount=My$("#userCount").val(),
			vechileCount=My$("#vechileCount").val(),
			seeNext=My$("#seeNext").val();
			//clientId=My$("#selectClient  option:selected").val();
			
		if(groupName.length==0){
			My$("#groupName_Msg").css("color","red");
			My$("#groupName_Msg").html(manager.bnwk);
			My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else if(groupName.length > 20){
			My$("#groupName_Msg").css("color","red");
			My$("#groupName_Msg").html("*" + manager.fenzumincheguochang);
			My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#groupName_Msg").html(manager.bnwk);
			My$("#groupName_Msg").css("color","rgb(153, 153, 153)");
		}
		
		/*
		if(clientId.length==0){
			My$("#selectClient_Msg").css("color","red");
			My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#selectClient_Msg").css("color","rgb(153, 153, 153)");
		}
		*/
		
		if(userCount.length != 0 && !reg.test(userCount)){
			My$("#userCountMsg").css("color","red");
			My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#userCountMsg").css("color","rgb(153, 153, 153)");
		}
		
		if(vechileCount.length != 0 && !reg.test(vechileCount)){
			My$("#vechileCountMsg").css("color","red");
			My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vechileCountMsg").css("color","rgb(153, 153, 153)");
		}
		
		My$("#addgroupmsg").css("color","rgb(153, 153, 153)");
		My$("#addgroupmsg").text(manager.zztj);
		
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/groupAction_add.action",
		        data:{"form.groupName":groupName,"form.userCount":parseInt(userCount.length=="0" ? 0 :userCount ),"form.vhcCount":parseInt(vechileCount.length=="0" ? 0 :vechileCount ),"form.userId":0, "form.seeNext":seeNext},
		        success: function(json) {
			         if (json.flag==true) {

			         	My$("#manager_closecgroupWin").click();
			         	
			         	GroupMananger.query(1);		       
			         	
			         }else{
			         	My$("#addgroupmsg").css("color","red");
						My$("#addgroupmsg").text("*"+json.msg);
						
						My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
	},
	del : function (id){
		initErrorMsg();
		if(confirm(manager.qdyscm)){
			openMask(true);
			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: true,
			        url: "manager/groupAction_delete.action",
			        data:{"form.id":id},
			        success: function(json) {
				         if (json.flag==true) {
				         		GroupMananger.query(1);		         	
				         }else{
				         		My$("#manager_msg_group").text(json.msg);
				         }
				         closeMask();
			        },error: function() {closeMask();}
			 });
			 
		 }
		
	},
	openUpdateWindow : function (id){
		initErrorMsg();
		openMask(false);
	    My$("#manager_groupName").text(manager.xgfz);
	    
		var tds = My$("#group_"+id).find("td");
		
		var groupName=My$(tds[1]).text(),
			userCount=My$(tds[5]).text(),
			vechileCount=My$(tds[6]).text(),
			seeNext = My$("#group_"+id).attr("seeNext");
		    
		My$("#groupName").val(groupName),
		My$("#userCount").val(userCount),
		My$("#vechileCount").val(vechileCount);
		My$("#groupID").val(id);
		My$("#seeNext option[value='"+seeNext+"']").attr("selected", "selected")
		
		My$("#addGroupButton").hide();
		My$("#updateGroupButton").show();		
		
		GroupMananger.openAddWindow();
	},
	update : function (){
		
		My$("#updateGroupButton").attr("disabled","disabled");//设置所有的button不可用  
		
		var reg=/^[0-9]+?$/;
		
		var groupName=My$("#groupName").val(),
			userCount=My$("#userCount").val(),
			vechileCount=My$("#vechileCount").val(),
			id=My$("#groupID").val(),
			seeNext=My$("#seeNext").val();
		
		if(groupName.length==0){
			My$("#groupName_Msg").css("color","red");
			My$("#groupName_Msg").html(manager.bnwk);
			My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else if(groupName.length > 20){
			My$("#groupName_Msg").css("color","red");
			My$("#groupName_Msg").html("*" + manager.fenzumincheguochang);
			My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#groupName_Msg").html(manager.bnwk);
			My$("#groupName_Msg").css("color","rgb(153, 153, 153)");
		}	
		
		if(userCount.length != 0 && !reg.test(userCount)){
			My$("#userCountMsg").css("color","red");
			My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#userCountMsg").css("color","rgb(153, 153, 153)");
		}
		
		if(vechileCount.length != 0 && !reg.test(vechileCount)){
			My$("#vechileCountMsg").css("color","red");
			My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vechileCountMsg").css("color","rgb(153, 153, 153)");
		}
		
		My$("#addgroupmsg").css("color","rgb(153, 153, 153)");
		My$("#addgroupmsg").text(manager.zztj);
		
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/groupAction_update.action",
		        data:{"form.id":id,"form.groupName":groupName,"form.userCount":parseInt(userCount.length=="0" ? 0 :userCount ),"form.vhcCount":parseInt(vechileCount.length=="0" ? 0 :vechileCount ),"form.userId":0, "form.seeNext":seeNext},
		        success: function(json) {
			         if (json.flag==true) {

			         	My$("#manager_closecgroupWin").click();
			         	
			         	GroupMananger.query(1);		       
			         	
			         }else{
			         	My$("#addgroupmsg").css("color","red");
						My$("#addgroupmsg").text("*"+json.msg);
						
						My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
		
		
	},
	pageSize: 10,
	pageCount : 0,
	nextPage : function(){
		var curPageNum=parseInt(My$("#group_page_num").text());
		if(0<curPageNum && curPageNum< this.pageCount){
			this.query(curPageNum+1);
		}
		
	},
	prevPage : function(){
		var curPageNum=parseInt(My$("#group_page_num").text());
		if(1<curPageNum){
			this.query(curPageNum-1);
		}
		
	},
	startPage : function(){
		if(parseInt(My$("#group_page_num").text())!=1){
			this.query(1);
		}
	},
	endPage : function(){
		if(parseInt(My$("#group_page_num").text())!=this.pageCount){
			this.query(this.pageCount);
		}
	},
	query : function(pageOffset){
		initErrorMsg();
		My$("#table_manager_group tr").eq(0).nextAll().remove();
		My$("#table_manager_group tr").eq(0).after("<tr><td><div style='padding:10px; font-size:14px; color:#0099FF;'> loading... </div></td>"+
	                                      "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");	
	    var queryValue="";
	   
		//if($("#group_query_value").attr("isquery")=="true"){
		   	queryValue=$("#group_query_value").val();
		//}                  
	    try{
	   		My$("#group_query_btn").attr("disabled","disabled");//设置所有的button不可用
	   		
		    $.ajax({
			        type: "POST",
			        dataType: "json",
			        url: "manager/groupAction_query.action",
			        async : false,
			        data : {"form.pageOffset":(pageOffset-1)*GroupMananger.pageSize,"form.pageSize":GroupMananger.pageSize,"form.groupName":queryValue},
			        success: function(json) {
			        	 My$("#table_manager_group tr").eq(0).nextAll().remove();	
				         if (json.flag==true) {	
				        	 if(json.data.length!=0){					        	 
				
				                 if(Manager.modelObject.DelUpdate.groupOperate.del && Manager.modelObject.DelUpdate.groupOperate.update){
				                 	for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_group").append("<tr id='group_"+json.data[i].id+"' seeNext=\"" + json.data[i].seeNext + "\" onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].groupName+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].createtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].mintime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].maxtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].vhcCount+"</td><td align=\"center\"  style=\"width: 110px;\"><span><a href=\"javascript:GroupMananger.del("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\" >"+manager.shanchu+"</a> | <a href=\"javascript:GroupMananger.openUpdateWindow("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\" >"+manager.xiugai+"</a></span></td></tr>");
							        }
				                 }else if(Manager.modelObject.DelUpdate.groupOperate.del){
				                 	 for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_group").append("<tr id='group_"+json.data[i].id+"' seeNext=\"" + json.data[i].seeNext + "\" onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].groupName+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].createtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].mintime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].maxtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].vhcCount+"</td><td align=\"center\"  style=\"width: 110px;\"><span><a href=\"javascript:GroupMananger.del("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\" >"+manager.shanchu+"</a></span></td></tr>");
							    	 }
				                 }else if(Manager.modelObject.DelUpdate.groupOperate.update){
				                 	for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_group").append("<tr id='group_"+json.data[i].id+"' seeNext=\"" + json.data[i].seeNext + "\" onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].groupName+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].createtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].mintime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].maxtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].vhcCount+"</td><td align=\"center\"  style=\"width: 110px;\"><span><a href=\"javascript:GroupMananger.openUpdateWindow("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\" >"+manager.xiugai+"</a></span></td></tr>");
							        }
				                 }else{
				                 	for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_group").append("<tr id='group_"+json.data[i].id+"' seeNext=\"" + json.data[i].seeNext + "\" onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].groupName+"</td><td align=\"center\"  style=\"width: 200px;\">"+json.data[i].createtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].mintime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].maxtime+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 150px;\">"+json.data[i].vhcCount+"</td><td align=\"center\"  style=\"width: 110px;\"><span>&nbsp;</span></td></tr>");
							    	}
				                 }	 					 
							     
							     
							     var pageCount=0;
							     
							     if( (json.totalCount % (GroupMananger.pageSize)) ==0){
							     	  pageCount = json.totalCount/GroupMananger.pageSize;
							     }else{
							     	  pageCount = parseInt(json.totalCount/GroupMananger.pageSize) + 1;
							     }
							     
							     My$("#group_page_count").text(pageCount);
							     My$("#group_page_num").text(pageOffset);
							     My$("#group_record_count").text(json.totalCount);
							     GroupMananger.pageCount=pageCount;
						     }else{
						     	GroupMananger.pageCount=0;
						     	My$("#group_page_count").text(0);
						     	  My$("#group_page_num").text(0);
							     My$("#group_record_count").text(0);
						     }
						     
						     GroupMananger.initPageBtn();
						     
				         }else{
			          	 	My$("#manager_msg_group").text(json.msg);                                             
			             }
			        },
			        error: function() {
			             My$("#table_manager_group tr").eq(0).nextAll().remove();
			        }
			});
		}catch(e){
			    My$("#group_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}finally{
			    My$("#group_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}
	},
	initClientSelect : function(id){
		My$("#selectClient").html("");
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/clientAction_query.action",
		        success: function(json) {
		        	 var options = "<option value='' style='width:120px;' selected='selected'>--"+manager.qxzkh+"--</option>";
	        	   	 if(json.data.length>0){		         				      						 
					     for(var i=0;i<json.data.length;i++){
					       	   options+="<option style='width:120px;' value='"+json.data[i].id+"'>"+json.data[i].compyname+"</option>"
					     }
					     
					     My$("#selectClient").html(options);
					    
				     	 //My$("#groupID").html(json.data[0].id);
				     }
		        }
		});	
	},
	initPageBtn : function(){
		if(parseInt(My$("#group_page_num").text())>=this.pageCount){
			My$("#group_nextPage_Btn").attr("class","un_fenye_s");
			My$("#group_endPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#group_nextPage_Btn").attr("class","en_fenye_s");
			My$("#group_endPage_Btn").attr("class","en_fenye_s");
		}
		
		if(parseInt(My$("#group_page_num").text())<=1){
			My$("#group_startPage_Btn").attr("class","un_fenye_s");
			My$("#group_prevPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#group_startPage_Btn").attr("class","en_fenye_s");
			My$("#group_prevPage_Btn").attr("class","en_fenye_s");
		}		
	}
}


var UserMananger = {
	openAddWindow : function (){
		initErrorMsg();
		openMask(false);
		UserMananger.openGroupSelectPaneManager.initGroupSelectPane(null);
		UserMananger.initClientSelect(null);
		UserMananger.initUserType({isUpdate:false,userType:My$("#usertypeId",window.parent.document).val()});
		UserMananger.initUserOverTime(null);

		My$("#manager_userContentWin").center();
		My$("#manager_userContentWin").show();	
	},
	add : function (){
	
	    var reg=/^[0-9]+?$/;
	    
		My$("#addUserButton").attr("disabled","disabled");//设置所有的button不可用  
	
		var userName=My$("#userName").val(),
			userType=My$("#manager_userType  option:selected").val(),
			userPwd=My$("#userPwd").val(),
			reuserPwd=My$("#reuserPwd").val(),
			user_client=My$("#user_client option:selected").val(),
			user_group=UserMananger.openGroupSelectPaneManager.groupIds,
			user_group_count=My$("#user_group_count").val(),
			user_moin_count=My$("#user_moin_count").val(),
			user_vechile_count=My$("#user_vechile_count").val(),
			user_overTime=My$("#add_user_overTime").val();
		
		if(userName.length==0){
			My$("#userName_Msg").css("color","red");
			My$("#userName_Msg").html(manager.bnwk);
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else if(userName.length > 9){
			My$("#userName_Msg").css("color","red");
			My$("#userName_Msg").html("*" + manager.mingchengguochang);
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#userName_Msg").html(manager.bnwk);
			My$("#userName_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(userType.length==0){
			My$("#manager_userType_Msg").css("color","red");
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#manager_userType_Msg").css("color","rgb(153, 153, 153)");
		}
		
			
		if(userPwd.length==0){
			My$("#userPwd_Msg").css("color","red");
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}/*else if(reuserPwd.length!=0){
			if(reuserPwd != userPwd){
				My$("#userPwd_Msg").css("color","red");
				My$("#userPwd_Msg").text(manager.mmbyz);
				My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}
		}*/else{
			My$("#userPwd_Msg").text(manager.bnwk);
			My$("#userPwd_Msg").css("color","rgb(153, 153, 153)");
		}	
	
		if(reuserPwd.length==0){
			My$("#reuserPwd_Msg").css("color","red");
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else if(reuserPwd != userPwd){
			My$("#reuserPwd_Msg").css("color","red");
			My$("#reuserPwd_Msg").text(manager.mmbyz);
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#reuserPwd_Msg").text(manager.bnwk);
			My$("#reuserPwd_Msg").css("color","rgb(153, 153, 153)");
		}	
	
		if((typeof user_client == 'undefined') || user_client.length==0){
			My$("#user_client_Msg").css("color","red");
			My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#user_client_Msg").css("color","rgb(153, 153, 153)");
		}
		
		/*
		if(userType== "-1" || userType== "10"){
		
		    if(user_group.length==0){
				My$("#user_group_Msg").css("color","red");
				My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_group_Msg").css("color","rgb(153, 153, 153)");
			}
		}*/
		
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_group_count.length != 0 && !reg.test(user_group_count)){
				My$("#user_group_count_Msg").css("color","red");
				My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_group_count_Msg").css("color","rgb(153, 153, 153)");
			}
		}
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_moin_count.length != 0 && !reg.test(user_moin_count)){
				My$("#user_moin_count").css("color","red");
				My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_moin_count").css("color","rgb(153, 153, 153)");
			}
		}
		
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_vechile_count.length != 0 && !reg.test(user_vechile_count)){
				My$("#user_vechile_count_Msg").css("color","red");
				My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_vechile_count_Msg").css("color","rgb(153, 153, 153)");
			}
		}
		
		My$("#addUsermsg").css("color","rgb(153, 153, 153)");
		My$("#addUsermsg").text(manager.zztj);
	
		var userId="",addUserSuccess=false,addUserGroupSuccess=false;
	
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/userAction_add.action",
		        async:false,
		        data:{"form.userName":userName,"form.userType":userType,"form.userPassword":userPwd,"form.rePassWord":reuserPwd,"form.clientId":user_client,"form.groupCount":(user_group_count !="" ? user_group_count : 0),"form.jiekouCount":(user_moin_count !="" ? user_moin_count : 0),"form.vhcCount":(user_vechile_count!="" ? user_vechile_count : 0),"form.overTime":user_overTime},
		        success: function(json) {
			         if (json.flag==true) {
			            
			         	userId=json.data[0].id;
			         		       
			         	addUserSuccess=true;
			         	//My$("#manager_closecUserWin").click();			         				         	
						//UserMananger.query(1);
						
						
						
			         }else{
			         	My$("#addUsermsg").css("color","red");
						My$("#addUsermsg").text("*"+json.msg);
						addUserSuccess=false;
						My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
		
		if(user_group.length!=0 && userType== "-1" || userType== "10"){
			if(!addUserSuccess){
				return;
			}

			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: false,
			        url: "manager/userAction_addUserIncludeGroup.action",
			        data:{"groupform.userId":userId,"groupform.groupArr":user_group},
			        success: function(json) {
				         if (json.flag==true) {			         	
				         	addUserGroupSuccess=true;		       			         	
				         }else{
				         	My$("#addUsermsg").css("color","red");
							My$("#addUsermsg").text("*"+json.msg);
							
							addUserGroupSuccess=false;
							
							$.ajax({
							        type: "POST",
							        dataType: "json",
							        async: false,
							        url: "manager/userAction_delete.action",
							        data:{"form.id":userId},
							        success: function(json) {
								         if (json.flag==true) {	         	
								         }else{
								         		My$("#addUsermsg").css("color","red");
												My$("#addUsermsg").text("*"+json.msg);
								         }
							        },error: function() {}
							 });
							
							My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
							
				         }
			        },error: function() {}
			});
			
			if(!addUserGroupSuccess){
				return;
			}
			
			if(addUserSuccess && addUserGroupSuccess){
				
				My$("#manager_closecUserWin").click();			         				         	
				UserMananger.query(1);	
			}
		}else{
			if(!addUserSuccess){
				return;
			}
			My$("#manager_closecUserWin").click();			         				         	
			UserMananger.query(1);
		}
	},
	del : function (id){
		initErrorMsg();
		if(confirm(manager.qdyscm)){
			openMask(true);
			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: true,
			        url: "manager/userAction_delete.action",
			        data:{"form.id":id},
			        success: function(json) {
				         if (json.flag==true) {
				         		//My$("#user_"+id).remove();
				         		UserMananger.query(1);		         	
				         }else{
				         		My$("#manager_msg_user").text(json.msg);
				         }closeMask();
			        },error: function() {closeMask();}
			 });
			 
		 }
		
	},
	code : function (id, userName){
		var resourseAddress = "gpsonline/jsp/manager/userLoginCode.jsp?id=" + id + "&username=" + userName;
		var container = {id:"managerWin",dragPanelId:"dragUserCodePanel",closeBtnId:"closeUserCodeWin"};
		initWin(resourseAddress,container);
	},
	resetpwd : function (id, userName){
		var resourseAddress = "gpsonline/jsp/manager/userResetPwd.jsp?id=" + id + "&username=" + userName;
		var container = {id:"managerWin",dragPanelId:"draguserResetPwdPanel",closeBtnId:"closeuserResetPwdWin"};
		initWin(resourseAddress,container);
	},
	openUpdateWindow : function (id,userName,userType,clientID,groupCount,vhcCount,userCount,overTime){
		
	    My$("#userPwd_tr").hide();
	    My$("#reuserPwd_tr").hide();
	    openMask(false);
		initErrorMsg();
		UserMananger.openGroupSelectPaneManager.initGroupSelectPane({isUpdate:true,userId:id});
		UserMananger.initClientSelect({isUpdate:true,clientId:clientID});
		UserMananger.initUserType({isUpdate:true,userType:userType});
		UserMananger.initUserOverTime({isUpdate:true,overTime:overTime});
		
		My$("#open_User_GroupSelectPane_btn").hide();
		My$("#openUpdate_User_GroupSelectPane_btn").show();
		
		
	    My$("#manager_userType_"+userType).attr("selected","selected");
		My$("#userName_title").text(manager.xgyh);		
		
		if(userType== "-1" || userType== "10"){
		
			My$("#user_group_tr").show();
			
			My$("#user_vechile_count_tr").hide();
			My$("#user_moin_count_tr").hide();
			My$("#user_group_count_tr").hide();
		}
		
		if(userType== "0" || userType== "1" || userType== "2"){
			My$("#user_vechile_count_tr").show();
			My$("#user_moin_count_tr").show();
			My$("#user_group_count_tr").show();
			My$("#user_group_tr").hide();
		}
		
		
		
		My$("#addUserButton").hide();
		My$("#updateUserButton").show();
		
		My$("#manager_userContentWin").center();
		My$("#manager_userContentWin").show();	

		My$("#userName").val(userName);
		My$("#user_group_count").val(groupCount),
		My$("#user_moin_count").val(userCount),
		My$("#user_vechile_count").val(vhcCount);
		
		My$("#manager_userID").val(id);
		
		My$("#manager_userContentWin").center();
		My$("#manager_userContentWin").show();	
		
		
	},
	update : function (){
		
		var reg=/^[0-9]+?$/;
		
		My$("#updateUserButton").attr("disabled","disabled");//设置所有的button不可用  
		
		var userName=My$("#userName").val(),
			id=My$("#manager_userID").val(),
			user_group="0",
			userType=My$("#manager_userType  option:selected").val(),
			user_client=My$("#user_client option:selected").val(),
			user_group_count=My$("#user_group_count").val(),
			user_moin_count=My$("#user_moin_count").val(),
			user_vechile_count=My$("#user_vechile_count").val(),
			user_overTime=My$("#update_user_overTime").val();
			
			if(userType== "-1" || userType== "10"){
				user_group=UserMananger.openGroupSelectPaneManager.groupIds;
			}		
		
		if(userName.length==0){
			My$("#userName_Msg").css("color","red");
			My$("#userName_Msg").html(manager.bnwk);
			My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else if(userName.length > 9){
			My$("#userName_Msg").css("color","red");
			My$("#userName_Msg").html("*" + manager.mingchengguochang);
			My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#userName_Msg").html(manager.bnwk);
			My$("#userName_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(userType.length==0){
			My$("#manager_userType_Msg").css("color","red");
			My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#manager_userType_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if((typeof user_client == 'undefined') || user_client.length==0){
			My$("#user_client_Msg").css("color","red");
			My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#user_client_Msg").css("color","rgb(153, 153, 153)");
		}
		
		/*
		if(userType== "-1" || userType== "10"){
		
		    if(user_group.length==0){
				My$("#user_group_Msg").css("color","red");
				My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_group_Msg").css("color","rgb(153, 153, 153)");
			}
		}*/
		
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_group_count.length != 0 && !reg.test(user_group_count)){
				My$("#user_group_count_Msg").css("color","red");
				My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_group_count_Msg").css("color","rgb(153, 153, 153)");
			}
		}
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_moin_count.length != 0 && !reg.test(user_moin_count)){
				My$("#user_moin_count").css("color","red");
				My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_moin_count").css("color","rgb(153, 153, 153)");
			}
		}
		
		if(userType== "0" || userType== "1" || userType== "2"){
			if(user_vechile_count.length != 0 && !reg.test(user_vechile_count)){
				My$("#user_vechile_count_Msg").css("color","red");
				My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
				return;
			}else{
				My$("#user_vechile_count_Msg").css("color","rgb(153, 153, 153)");
			}
		}
		
		My$("#addUsermsg").css("color","rgb(153, 153, 153)");
		My$("#addUsermsg").text(manager.zztj);

		var addUserSuccess=false,addUserGroupSuccess=false;

		$.ajax({
		        type: "POST",
		        dataType: "json",
		        async: false,
		        url: "manager/userAction_update.action",
		        data:{"form.id":id,"form.userName":userName,"form.userType":userType,"form.clientId":user_client,"form.groupCount":(user_group_count !="" ? user_group_count : 0),"form.jiekouCount":(user_moin_count !="" ? user_moin_count : 0),"form.vhcCount":(user_vechile_count!="" ? user_vechile_count : 0),"form.overTime":user_overTime},
		        success: function(json) {
			         if (json.flag==true) {

			         	addUserSuccess=true;
			         	
			         	//My$("#manager_closecUserWin").click();			         				         	
						//UserMananger.query(1);			         	
			         	      
			         	
			         }else{
			         	addUserSuccess=false;
			         	My$("#addUsermsg").css("color","red");
						My$("#addUsermsg").text("*"+json.msg);
						
						My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
	
		if(!addUserSuccess){
				return;
		}
			
			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: false,
			        url: "manager/userAction_addUserIncludeGroup.action",
			        data:{"groupform.userId":id,"groupform.groupArr":user_group.length==0?0:user_group},
			        success: function(json) {
				         if (json.flag==true) {			         	
				         	addUserGroupSuccess=true;		       			         	
				         }else{
				         	My$("#addUsermsg").css("color","red");
							My$("#addUsermsg").text("*"+json.msg);
							
							addUserGroupSuccess=false;
							
							My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
							
				         }
			        },error: function() {}
			});
			
			if(!addUserGroupSuccess){
				return;
			}
			
			if(addUserSuccess && addUserGroupSuccess){
				
				My$("#manager_closecUserWin").click();			         				         	
				UserMananger.query(1);	
			}

	},
	pageSize: 10,
	pageCount : 0,
	nextPage : function(){
		var curPageNum=parseInt(My$("#user_page_num").text());
		if(0<curPageNum && curPageNum< this.pageCount){
			this.query(curPageNum+1);
		}
		
	},
	prevPage : function(){
		var curPageNum=parseInt(My$("#user_page_num").text());
		if(1<curPageNum){
			this.query(curPageNum-1);
		}
		
	},
	startPage : function(){
		if(parseInt(My$("#user_page_num").text())!=1){
			this.query(1);
		}
	},
	endPage : function(){
		if(parseInt(My$("#user_page_num").text())!=this.pageCount){
			this.query(this.pageCount);
		}
	},
	query : function(pageOffset){		
		
		initErrorMsg();
		
		My$("#table_manager_user tr").eq(0).nextAll().remove();
		My$("#table_manager_user tr").eq(0).after("<tr><td><div style='padding:10px; font-size:14px; color:#0099FF;'> loading... </div></td>"+
	                                      "<td>&nbsp;</td></tr>");	
	   var queryValue="";
	   
	   //if($("#user_query_value").attr("isquery")=="true"){
	   		queryValue=$("#user_query_value").val();
	   //}                                  

	   
	   try{
	   		My$("#user_query_btn").attr("disabled","disabled");//设置所有的button不可用
	   		
		    $.ajax({
			        type: "POST",
			        dataType: "json",
			        url: "manager/userAction_query.action",
			        data : {"form.pageOffset":(pageOffset-1)*UserMananger.pageSize,"form.pageSize":UserMananger.pageSize,"form.userName":queryValue},
			        success: function(json) {
			        	 My$("#table_manager_user tr").eq(0).nextAll().remove();	
				         if (json.flag==true) {	
				         	if(json.data.length!=0){
								 if(Manager.modelObject.DelUpdate.userOperate.del && Manager.modelObject.DelUpdate.userOperate.update){
								     for(var i=0;i<json.data.length;i++){
								       	    My$("#table_manager_user").append("<tr id='user_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*UserMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].userName+"</td><td align=\"center\">"+UserMananger.userType(json.data[i].userType)+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\">"+json.data[i].groupCount+"</td><td align=\"center\">"+json.data[i].vhcCount+"</td><td align=\"center\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 150px;\"><span><a href=\"javascript:UserMananger.del("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> | <a href=\"javascript:UserMananger.openUpdateWindow("+json.data[i].id+",'"+json.data[i].userName+"','"+json.data[i].userType+"','"+json.data[i].clientID+"','"+json.data[i].groupCount+"','"+json.data[i].vhcCount+"','"+json.data[i].userCount+"','"+json.data[i].overduetime+"');\" style=\"color:#07F;text-decoration: none;\">"+manager.xiugai+"</a> | <a href=\"javascript:UserMananger.resetpwd(" + json.data[i].id + ",'" + json.data[i].userName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.chongzhimima+"</a></span></td></tr>");/*<a href='javascript:;' onclick=\"showUserManagerMenu(this,"+json.data[i].id+",'"+json.data[i].userName+"');\" style=\"color:#07F;text-decoration: none;\">"+manager.gengduo+"</a>*/
								     }
							     }else if(Manager.modelObject.DelUpdate.userOperate.del){
							     	 for(var i=0;i<json.data.length;i++){
								       	    My$("#table_manager_user").append("<tr id='user_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*UserMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].userName+"</td><td align=\"center\">"+UserMananger.userType(json.data[i].userType)+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\">"+json.data[i].groupCount+"</td><td align=\"center\">"+json.data[i].vhcCount+"</td><td align=\"center\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:UserMananger.del("+json.data[i].id+");\" style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> | <a href=\"javascript:UserMananger.resetpwd(" + json.data[i].id + ",'" + json.data[i].userName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.chongzhimima+"</a></span></td></tr>");
								     }
							     }else if(Manager.modelObject.DelUpdate.userOperate.update){
							     	 for(var i=0;i<json.data.length;i++){
								       	    My$("#table_manager_user").append("<tr id='user_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*UserMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].userName+"</td><td align=\"center\">"+UserMananger.userType(json.data[i].userType)+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\">"+json.data[i].groupCount+"</td><td align=\"center\">"+json.data[i].vhcCount+"</td><td align=\"center\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:UserMananger.openUpdateWindow("+json.data[i].id+",'"+json.data[i].userName+"','"+json.data[i].userType+"','"+json.data[i].clientID+"','"+json.data[i].groupCount+"','"+json.data[i].vhcCount+"','"+json.data[i].userCount+"','"+json.data[i].overduetime+"');\" style=\"color:#07F;text-decoration: none;\">"+manager.xiugai+"</a> | <a href=\"javascript:UserMananger.resetpwd(" + json.data[i].id + ",'" + json.data[i].userName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.chongzhimima+"</a></span></td></tr>");
								     }
							     }else{
							     	 for(var i=0;i<json.data.length;i++){
								       	    My$("#table_manager_user").append("<tr id='user_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*UserMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].userName+"</td><td align=\"center\">"+UserMananger.userType(json.data[i].userType)+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\">"+json.data[i].groupCount+"</td><td align=\"center\">"+json.data[i].vhcCount+"</td><td align=\"center\">"+json.data[i].userCount+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:UserMananger.resetpwd(" + json.data[i].id + ",'" + json.data[i].userName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.chongzhimima+"</a></span></td></tr>");
								     }
							     }
							     
							     var pageCount=0;
							     
							     if( (json.totalCount % (UserMananger.pageSize)) ==0){
							     	  pageCount = json.totalCount/UserMananger.pageSize;
							     }else{
							     	  pageCount = parseInt(json.totalCount/UserMananger.pageSize) + 1;
							     }
							     
							     My$("#user_page_count").text(pageCount);
							     My$("#user_page_num").text(pageOffset);
							     My$("#user_record_count").text(json.totalCount);
							     UserMananger.pageCount=pageCount;
						     }else{
						     	UserMananger.pageCount=0;
						     	My$("#user_page_count").text(0);
							     My$("#user_page_num").text(0);
							     My$("#user_record_count").text(0);
						     }
						     
						     
						     
						     
						     UserMananger.initPageBtn();
						     
				         }else{
			          	 	My$("#manager_msg_user").text(json.msg);                                             
			             }
			        },
	                    /*error: function(XMLHttpRequest, textStatus, errorThrown) {
	                        alert(XMLHttpRequest.status);
	                        alert(XMLHttpRequest.readyState);
	                        alert(textStatus);
	                    }
			        ,*/
			        error: function() {
			             My$("#table_manager_user tr").eq(0).nextAll().remove();
			        }
			});	
		}catch(e){
			    My$("#user_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}finally{
			    My$("#user_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}
	},
	initPageBtn : function(){
		if(parseInt(My$("#user_page_num").text())>=this.pageCount){
			My$("#user_nextPage_Btn").attr("class","un_fenye_s");
			My$("#user_endPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#user_nextPage_Btn").attr("class","en_fenye_s");
			My$("#user_endPage_Btn").attr("class","en_fenye_s");
		}
		
		if(parseInt(My$("#user_page_num").text())<=1){
			My$("#user_startPage_Btn").attr("class","un_fenye_s");
			My$("#user_prevPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#user_startPage_Btn").attr("class","en_fenye_s");
			My$("#user_prevPage_Btn").attr("class","en_fenye_s");
		}		
	},
	userTypeChange : function(){

		var userType=My$("#manager_userType option:selected").val();		
		
		if(userType== "-1" || userType== "10"){
		
			My$("#user_group_tr").show();
			
			My$("#user_vechile_count_tr").hide();
			My$("#user_moin_count_tr").hide();
			My$("#user_group_count_tr").hide();
			
			My$("#user_group_count").val("");
			My$("#user_moin_count").val("");
			My$("#user_vechile_count").val("");
			
			My$("#user_group_count_Msg").css("color","rgb(153, 153, 153)");
			My$("#user_moin_count").css("color","rgb(153, 153, 153)");
			My$("#user_vechile_count_Msg").css("color","rgb(153, 153, 153)");
			
			
		}else if(userType== "0" || userType== "1" || userType== "2"){
		
			My$("#user_group_tr").hide();
			
			My$("#user_vechile_count_tr").show();
			My$("#user_moin_count_tr").show();
			My$("#user_group_count_tr").show();

			My$("#user_group option:first").attr("selected","selected");
			
		}else if(userType==""){
		
			My$("#user_group_tr").hide();
			My$("#user_vechile_count_tr").hide();
			My$("#user_moin_count_tr").hide();
			My$("#user_group_count_tr").hide();
			
			My$("#user_group_count").val("");
			My$("#user_moin_count").val("");
			My$("#user_vechile_count").val("");
			
			My$("#user_group_count_Msg").css("color","rgb(153, 153, 153)");
			My$("#user_moin_count").css("color","rgb(153, 153, 153)");
			My$("#user_vechile_count_Msg").css("color","rgb(153, 153, 153)");
			
			
		}
	},
	initClientSelect : function(params){
	     
		 My$("#user_client").html("");
		  $.ajax({
		        type: "POST",
		        dataType: "json",
		        async:false,
		        url: "manager/clientAction_query.action",
		        async : false,
		        success: function(json) {		     
			         if (json.flag==true) {		
			         	 
			         	 var options = "<option value='' style='width:120px;' selected='selected'>--"+manager.qxzkh+"--</option>"; 
					     
					     for(var i=0;i<json.data.length;i++){
					       	   options+="<option id=\"user_client_"+json.data[i].id+"\" style='width:120px;' value='"+json.data[i].id+"'>"+json.data[i].compyname+"</option>" 
					     }
					     
					     My$("#user_client").html(options);
					     
					     if(params!=null && params.isUpdate && params.clientId){
					     	My$("#user_client_"+params.clientId).attr("selected","selected");
					     }
			         }
		        },error: function(){My$("#user_client").html(options);}
		});	
	},
	initUserType : function(params){
	     
		 My$("#manager_userType").html("");
         var options = "<option id='optionId' value='' style='width:120px;' selected='selected'>--"+manager.qxzyhlx+"--</option>"; 
         if(options!=null && options!='')$("#manager_userType").append(options);
//         console.info("---->"+My$("#usertypeId",window.parent.document).val());
//         console.info("---->"+JSON.stringify(usrtypeName));
         
         switch(My$("#usertypeId",window.parent.document).val()){
         
		     	case "0": My$("#usertypeId",window.parent.document).val() =="0" ?"": (options="<option id='manager_userType_0' style='width:120px;' value='0'>"+usrtypeName.xtgly+"</option>");
		     	if(options!=null && options!='')My$("#manager_userType").append(options);
		     	case "1": My$("#usertypeId",window.parent.document).val() =="1" ?"": (options="<option id='manager_userType_1' style='width:120px;' value='1'>"+usrtypeName.yjgly+"</option>");
		     	if(options!=null && options!='')My$("#manager_userType").append(options);
		     	case "2": My$("#usertypeId",window.parent.document).val() =="2" ?"": (options="<option id='manager_userType_2' style='width:120px;' value='2'>"+usrtypeName.ejgly+"</option>");
		     	if(options!=null && options!='')My$("#manager_userType").append(options);
		     	case "-1": My$("#usertypeId",window.parent.document).val() =="-1" ?"": (options="<option id='manager_userType_-1' style='width:120px;' value='-1'>"+usrtypeName.ptjky+"</option>");
		     	if(options!=null && options!='')My$("#manager_userType").append(options);
		     	case "10": My$("#usertypeId",window.parent.document).val() =="10" ?"": (options="<option id='manager_userType_10' style='width:120px;' value='10'>"+usrtypeName.yszh+"</option>");	  	
		     	if(options!=null && options!=''){
		     		console.info("+++"+options);
		     		My$("#manager_userType").append(options);
		     	}
		 }
	     console.info("+++>"+options);
	    // $("#manager_userType").html(options);
	     //alert(params.userType);
	     if(params!=null && params.isUpdate && params.userType){
	    	 
	     		/*My$("#manager_userType option").each(function(){
	     			My$(this).attr("selected","false");
	     		});*/
	    	 //$("#search").find("option").remove();
	    	//My$("#manager_userType option").attr("selected","selected");
	    	My$("#optionId").attr("selected","selected");
	     }
	},
	userType : function(typeId){
		 switch(typeId){
		     	case 0: return usrtypeName.xtgly;break;
		     	case 1: return usrtypeName.yjgly;break;
		     	case 2: return usrtypeName.ejgly;break;
		     	case -1: return usrtypeName.ptjky;break;
		     	case 10: return usrtypeName.yszh;break;	  	
		  }
	},
	initUserOverTime : function(params){
	  
	  	  if(params!=null && params.isUpdate){
		  	 My$("#update_user_overTime").show(); 
			 My$("#update_user_overTime").val(params.overTime);
		  }else{
		  	  var d = new Date();
			  var vYear = d.getFullYear();
			  var vMon = d.getMonth() + 1;
			  var vDay = d.getDate();
			  var overTime=(vYear+1) + "-" + (vMon < 10 ? "0" + vMon : vMon) + "-" + (vDay < 10 ? "0" + vDay : vDay);
			  My$("#add_user_overTime").show();
			  My$("#add_user_overTime").val(overTime);
		  }

		  	  
	},
	openGroupSelectPaneManager : { groupIds : "",
								   initGroupSelectPane : function (params){
								   		  My$("#user_groupId_Panels").html("");
										  $.ajax({
										        type: "POST",
										        dataType: "json",
										        async:false,
										        url: "manager/groupAction_query.action",
										        success: function(json) {		     
											         if (json.flag==true) {		
											         	 
											         	 var checks = ""; 
													     
													     for(var i=0;i<json.data.length;i++){
													           checks+="<li><input id=\"user_groupId_check_"+json.data[i].id+"\" type=\"checkbox\" name=\"user_group_checkbox\" value=\""+json.data[i].id+"\"></input><span id=\"user_groupId_check_text_"+json.data[i].id+"\">"+json.data[i].groupName+"</span></li>";
													     }
													     
													     if(checks.length==0){
													     	My$("#user_groupId_Panels").html(manager.wkxfz);
													     }else{
													     	My$("#user_groupId_Panels").html("<ul>"+checks+"</ul>");
													     }
									
											         }
										        },error: function(){My$("#user_groupId_Panels").html("");}
										});
										
										if(params!=null && params.isUpdate && params.userId){
									     	$.ajax({
										        type: "POST",
										        dataType: "json",
										        async:false,
										        url: "manager/userAction_userGroup.action",
										        data:{"form.id":params.userId},
										        success: function(json) {		     
											         if (json.flag==true) {
											             
											             var groupNames="";
											             
											             for(var i=0;i<json.data.length;i++){
											            	My$("#user_groupId_check_"+json.data[i]).attr("checked","true");
											            	UserMananger.openGroupSelectPaneManager.groupIds += json.data[i]+",";
											            	if(My$("#user_groupId_check_text_"+json.data[i]).text()!=""){
											            		groupNames+=My$("#user_groupId_check_text_"+json.data[i]).text()+",";
											            	}
											         	 }
											         	 
											         	 My$("#user_group").val(groupNames.substring(0,groupNames.length-1));
											         	
											         	
											         }
										        },error: function(){}
								     		  });
								       }
								       
								       this.groupIds=this.groupIds.substring(0,this.groupIds.length-1); 
										
								   },
								   openGroupSelectPane : function (){
								   								My$("#user_groupId_Panels").show();
									
																My$("#open_User_GroupSelectPane_btn").hide();
																
																My$("#confirm_User_GroupSelectPane_btn").show();
																My$("#canacle_User_GroupSelectPane_btn").show();
														},
								   openUpdateGroupSelectPane : function (){
								   								My$("#user_groupId_Panels").show();
									
																My$("#openUpdate_User_GroupSelectPane_btn").hide();
																
																My$("#confirm_User_GroupSelectPane_btn").show();
																My$("#canacle_User_GroupSelectPane_btn").show();
														},
									confirmGroupSelectPane : function(){
									
										My$("#user_groupId_Panels").hide();
										
										if(My$("#addUserButton").is(":visible")){
											My$("#open_User_GroupSelectPane_btn").show();
										}else{
											My$("#openUpdate_User_GroupSelectPane_btn").show();
										}
										
										My$("#confirm_User_GroupSelectPane_btn").hide();
										My$("#canacle_User_GroupSelectPane_btn").hide();
										
										var groupNames="";
										
										this.groupIds="";
										
										My$("input[name='user_group_checkbox']").each(function(){
											if(My$(this).attr("checked")==true){
									   			UserMananger.openGroupSelectPaneManager.groupIds += My$(this).val()+",";
									   			
									   			groupNames+=My$("#user_groupId_check_text_"+My$(this).attr("id").split("_")[3]).text()+",";
									   		}
									    }); 
									    
									    My$("#user_group").val(groupNames.substring(0,groupNames.length-1));
									    
									    this.groupIds=this.groupIds.substring(0,this.groupIds.length-1); 
									},
								
									canacleGroupSelectPane : function(){
									
										My$("#user_groupId_Panels").hide();
										
										if(My$("#addUserButton").is(":visible")){
											My$("#open_User_GroupSelectPane_btn").show();
										}else{
											My$("#openUpdate_User_GroupSelectPane_btn").show();
										}
										
										My$("#confirm_User_GroupSelectPane_btn").hide();
										My$("#canacle_User_GroupSelectPane_btn").hide();
										
										My$("input[name='user_group_checkbox']").each(function(){
									   		My$(this).attr("checked",false);
									    }); 
									    
									    if(this.groupIds !=""){
									    	 var groupIdArr=this.groupIds.split(",");
									    	 var groupNames="";
									    	 for(var i=0;i<groupIdArr.length;i++){
									            	My$("#user_groupId_check_"+groupIdArr[i]).attr("checked","true");
									            	if(My$("#user_groupId_check_text_"+groupIdArr[i]).text()){
									            		groupNames+=My$("#user_groupId_check_text_"+groupIdArr[i]).text()+",";
									            	}											            	
											 }	
											 My$("#user_group").val(groupNames.substring(0,groupNames.length-1));
									    }
									}	
	}
}


var VechileMananger = {
	openAddWindow : function(){
		initErrorMsg();
		openMask(false);
		
		VechileMananger.initMobileSelect(null);
		VechileMananger.initVehicleTypeIdSelect(null);
		
		VechileMananger.initClientSelect(null);
		VechileMananger.openGroupSelectPaneManager.initGroupSelectPane(null);
		VechileMananger.initOverTimeSelect('add');
		VechileMananger.initForwardSelect("");
		
		My$("#manager_vechileContentWin").center();
		My$("#manager_vechileContentWin").show();
		
		My$("#openperipheralPane_btn").show();
		My$("#openUpdateperipheralPane_btn").hide();
		
		//My$("#peripheral").val("带总里程");
		
	},
	add : function (){
		
		My$("#addVechileButton").attr("disabled","disabled");//设置所有的button不可用   
		
		var reg=/^[A-Za-z0-9]{3,40}$/;
		
		var carName=My$("#carName").val(),
		    groupId=VechileMananger.openGroupSelectPaneManager.groupIds,
			gprsID=My$("#gprsID").val(),
			SIMNum=My$("#SIMNum").val(),
			mobileId=My$("#mobileId  option:selected").val(),
			vehicleTypeId=My$("#vehicleTypeId  option:selected").val(),
			vehicleTypeName=My$("#vehicleTypeId option:selected").html(),
			vechile_clientId=My$("#vechile_clientId  option:selected").val(),
			client_Name=My$("#vechile_clientId option:selected").html(),
			overTime=My$("#vechile_overtime option:selected").val(),
			forwardType=My$("#vechile_data_forward_type option:selected").val();
			
		if(carName.length==0){
			My$("#carName_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#carName_Msg").css("color","rgb(153, 153, 153)");
		}
		
		
		if(groupId.length==0){
			My$("#vechile_groupId_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vechile_groupId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if((typeof vechile_clientId == 'undefined') || vechile_clientId.length==0){
			My$("#vechile_clientId_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vechile_clientId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(!reg.test(gprsID)){
			My$("#gprsID_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#gprsID_Msg").css("color","rgb(153, 153, 153)");
		}
		
		reg=/^[A-Za-z0-9]{5,13}$/;
		
		if(!reg.test(SIMNum)){
			My$("#SIMNum_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#SIMNum_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(mobileId.length==0){
			My$("#mobileId_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#mobileId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(vehicleTypeId.length==0){
			My$("#vehicleTypeId_Msg").css("color","red");
			My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vehicleTypeId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		My$("#addvechilemsg").css("color","rgb(153, 153, 153)");
		My$("#addvechilemsg").text(manager.zztj);
		var wso =  VechileMananger.peripheralPaneManager.ws1.toString();
		var wst =  VechileMananger.peripheralPaneManager.ws2.toString();
		var bjo =  VechileMananger.peripheralPaneManager.bj1.toString();
		var bjt =  VechileMananger.peripheralPaneManager.bj2.toString();
		
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/vechileAction_add.action",
		        data:{"form.carName":carName,"form.clientID":vechile_clientId,"form.gprs":gprsID,"form.sim":SIMNum,"form.mobileId":mobileId,"form.vehicleTypeId":vehicleTypeId,"form.goupListPage":groupId,"form.overTime":overTime,"form.wso":(wso.length == 0 ? "": wso),"form.wst":(wst.length == 0 ? "": wst),"form.bjo":(bjo.length == 0 ? "": bjo),"form.bjt":(bjt.length == 0 ? "": bjt),"form.imgSrc":My$("#vehicleImg").attr("value"), "form.forwardType":forwardType,"form.clientName":client_Name,"form.vehicleTypeName":vehicleTypeName},
		        success:function(json){
			         if (json.flag==true) {
						    
			         	My$("#manager_closecvechileWin").click();
			         	
			         	VechileMananger.query(1);		       
			         	
			         }else{
			         	My$("#addvechilemsg").css("color","red");
						My$("#addvechilemsg").text("*"+json.msg);
						
						My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
	},
	del : function (id,clientid){
		initErrorMsg();
		if(confirm(manager.qdyscm)){
			openMask(true);
			$.ajax({
			        type: "POST",
			        dataType: "json",
			        async: true,
			        url: "manager/vechileAction_delete.action",
			        data:{"form.id":id,"form.clientID":clientid},
			        success: function(json) {
				         if (json.flag==true) {
				         		My$("#vechile_"+id).remove();
				         		
				         		VechileMananger.query(1);		         	
				         }else{
				         		My$("#manager_msg_vechile").text(json.msg);
				         } closeMask();
			        },error: function() { closeMask();}
			 });
			
		 }
		
	},
	code : function (id, carName){
		var resourseAddress = "gpsonline/jsp/manager/carLoginCode.jsp?id=" + id + "&carname=" + carName;
		var container = {id:"managerWin",dragPanelId:"dragCarCodePanel",closeBtnId:"closeCarCodeWin"};
		initWin(resourseAddress,container);
	},
	openUpdateWindow : function (id,carName,clientId,colorId,gprsId,simcode,mobileId,vechileTypeId,imgSrc){
		
		initErrorMsg();
		openMask(false);
		
		My$("#vechile_color_tr").show();
		
		VechileMananger.initMobileSelect({isUpdate:true,mobileId:mobileId});
		VechileMananger.initVehicleTypeIdSelect({isUpdate:true,vehicleTypeId:vechileTypeId});
		VechileMananger.openGroupSelectPaneManager.initGroupSelectPane({isUpdate:true,vechileId:id});

		VechileMananger.initClientSelect({isUpdate:true,clientId:clientId});
		My$("#vechile_clientId").attr("value_",clientId);
		
		VechileMananger.initVehicleColorSelect({isUpdate:true,colorId:colorId});
				
		VechileMananger.openImgPanleManager.init();
		
		VechileMananger.initOverTimeSelect('update', id);
		
		VechileMananger.initForwardSelect(id);
		
		
		if(imgSrc){
		
			if(typeof(mapday_icon_data) != "undefined"){

					var iconFlag = false;
					
					for(var i = 0; i < mapday_icon_data.length ; i++ )
					{
					
						if(mapday_icon_data[i][0] == parseInt(imgSrc))
						{
						
							My$("#vehicleImg").attr("src",mapday_icon_data[i][2]);
							My$("#vehicleImg").attr("title",mapday_icon_data[i][1]);
							My$("#vehicleImg").attr("value",mapday_icon_data[i][0]);
							
							iconFlag = true;
							
						}
						
					}
					
					if(!iconFlag)
					{
					
						My$("#vehicleImg").attr("src","http://mapday.exlive.cn/vhc_icons/pic/0/green_0.gif");
						My$("#vehicleImg").attr("title","车辆1");
						My$("#vehicleImg").attr("value",0);
					}
					
			}else{
				
				if(VechileMananger.openImgPanleManager.loadPanelListener){
					clearInterval(VechileMananger.openImgPanleManager.loadPanelListener);						        			
				}
				
				VechileMananger.openImgPanleManager.loadPanelListener = setInterval(function(){
			 		  
								 		  if(typeof(mapday_icon_data) != "undefined"){
							        		
								        		var iconFlag = false;
					
												for(var i = 0; i < mapday_icon_data.length ; i++ )
												{
												
													if(mapday_icon_data[i][0] == parseInt(imgSrc))
													{
													
														My$("#vehicleImg").attr("src",mapday_icon_data[i][2]);
														My$("#vehicleImg").attr("title",mapday_icon_data[i][1]);
														My$("#vehicleImg").attr("value",mapday_icon_data[i][0]);
														
														iconFlag = true;
														
													}
													
												}
												
												if(!iconFlag)
												{
												
													My$("#vehicleImg").attr("src","http://mapday.exlive.cn/vhc_icons/pic/0/green_0.gif");
													My$("#vehicleImg").attr("title","车辆1");
													My$("#vehicleImg").attr("value",0);
												}
							        			
							        			clearInterval(VechileMananger.openImgPanleManager.loadPanelListener);
							        			
							        			VechileMananger.openImgPanleManager.loadPanelListener = null;
							        	 }
							        	 
						        	 },100);
	
			}
			
		}else{
			My$("#vehicleImg").attr("src","http://mapday.exlive.cn/vhc_icons/pic/0/green_0.gif");
			My$("#vehicleImg").attr("title","车辆1");
			My$("#vehicleImg").attr("value",0);
		}
		
		
		My$("#carName").val(carName);
		My$("#gprsID").val(gprsId);
		My$("#SIMNum").val(simcode);
		My$("#vechileID").val(id);
		
		VechileMananger.peripheralPaneManager.init(true);
		
		My$("#addVechileButton").hide();
		My$("#updateVechileButton").show();
		
		My$("#openperipheralPane_btn").hide();
		My$("#openUpdateperipheralPane_btn").show();
		
		My$("#manager_vechileName").text(manager.xgsb);
		
		My$("#openGroupSelectPane_btn").hide();
		My$("#openUpdateGroupSelectPane_btn").show();
		
		My$("#manager_vechileContentWin").center();
		My$("#manager_vechileContentWin").show();
		
	},
	update : function (){
		My$("#updateVechileButton").attr("disabled","disabled");//设置所有的button不可用   
		
		var reg=/^[A-Za-z0-9]{3,40}$/;
		
		var carName=My$("#carName").val(),
		    //groupId=My$("#vechile_groupId  option:selected").val(),
		    groupId=VechileMananger.openGroupSelectPaneManager.groupIds,
			gprsID=My$("#gprsID").val(),
			SIMNum=My$("#SIMNum").val(),
			id=My$("#vechileID").val(),
			mobileId=My$("#mobileId  option:selected").val(),
			vehicleTypeId=My$("#vehicleTypeId  option:selected").val(),
			vehicleTypeName=My$("#vehicleTypeId option:selected").html(),
			client_Name=My$("#vechile_clientId option:selected").html(),
			vechile_clientId=My$("#vechile_clientId  option:selected").val();
			colorId=My$("#vechile_color  option:selected").val(),
			forwardType=My$("#vechile_data_forward_type option:selected").val();
		if(id.length==0){
			My$("#addvechilemsg").css("color","red");
			My$("#addvechilemsg").text(manager.qxzsb);
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#addvechilemsg").text("");
			My$("#addvechilemsg").css("color","rgb(153, 153, 153)");
		}
			
		if(carName.length==0){
			My$("#carName_Msg").css("color","red");
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#carName_Msg").css("color","rgb(153, 153, 153)");
		}
		
		
	
		if(groupId.length==0){
			//My$("#vechile_groupId_Msg").css("color","red");
			//My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			//return;
			groupId = My$("#vechile_groupId").attr("value_");
			var cc = backGroudIds(); 
//			console.info("cc",cc);
		}else{
			My$("#vechile_groupId_Msg").css("color","rgb(153, 153, 153)");
			
		}
//		console.info("groupId",groupId);
		if((typeof vechile_clientId == 'undefined') || vechile_clientId.length==0){
			//My$("#vechile_clientId_Msg").css("color","red");
			//My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			//return;
			vechile_clientId = My$("#vechile_clientId").attr("value_");
		}else{
			My$("#vechile_clientId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(!reg.test(gprsID)){
			My$("#gprsID_Msg").css("color","red");
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#gprsID_Msg").css("color","rgb(153, 153, 153)");
		}
		
		reg=/^[A-Za-z0-9]{5,13}$/;
		
		if(!reg.test(SIMNum)){
			My$("#SIMNum_Msg").css("color","red");
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#SIMNum_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(mobileId.length==0){
			My$("#mobileId_Msg").css("color","red");
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#mobileId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		if(vehicleTypeId.length==0){
			My$("#vehicleTypeId_Msg").css("color","red");
			My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			return;
		}else{
			My$("#vehicleTypeId_Msg").css("color","rgb(153, 153, 153)");
		}
		
		My$("#addvechilemsg").css("color","rgb(153, 153, 153)");
		My$("#addvechilemsg").text(manager.zztj);
		var wso =  VechileMananger.peripheralPaneManager.ws1.toString();
		var wst =  VechileMananger.peripheralPaneManager.ws2.toString();
		var bjo =  VechileMananger.peripheralPaneManager.bj1.toString();
		var bjt =  VechileMananger.peripheralPaneManager.bj2.toString();
		$.ajax({
		        type: "POST",
		        dataType: "json",
		        url: "manager/vechileAction_update.action",																
		        data:{"form.id":id,"form.carName":carName,"form.clientID":vechile_clientId,"form.gprs":gprsID,"form.sim":SIMNum,"form.colorId":colorId,"form.mobileId":mobileId,"form.vehicleTypeId":vehicleTypeId,"form.goupListPage":groupId,"form.wso":(wso.length == 0 ? "0": wso),"form.wst":(wst.length == 0 ? "0": wst),"form.bjo":(bjo.length == 0 ? "0": bjo),"form.bjt":(bjt.length == 0 ? "0": bjt),"form.imgSrc":My$("#vehicleImg").attr("value"),"form.checkboxGroupListPage":My$("#vechile_groupId").attr("checkboxGroupListPage_"),"form.forwardType":forwardType,"form.clientName":client_Name,"form.vehicleTypeName":vehicleTypeName},
		        success: function(json) {
			         if (json.flag==true) {
			         	
			         	window.parent.updateVehicle(id,My$("#vehicleImg").attr("value"));
						    
			         	My$("#manager_closecvechileWin").click();
	         	
			         	VechileMananger.query(1);		       
			         	
			         }else{
			         	My$("#addvechilemsg").css("color","red");
						My$("#addvechilemsg").text("*"+json.msg);
						
						My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
			         }
		        },error: function() {}
		});
		
		
	},
	openDriverWin : function(vehicleId){
	
		var resourseAddress = "manager/vechileAction_driverInfoWin.action?driver.id=" + vehicleId;
		var container = {id:"managerWin",dragPanelId:"dragDriverPanel",closeBtnId:"closeDriverWin"};
		initWin(resourseAddress,container);
		
	},
	closeDriverWin : function(){
	
		My$("#closeDriverWin").click();
		
	},
	validateDriverData : function(){
	
		if(My$("input[name='fileForm.uploadFile']").val().length != 0 && !checkImgType(My$("input[name='fileForm.uploadFile']"))){
			My$("#drivertMsg").text(manager.qxzhfdtx + ":*.PNG/GIF/JPG/JPEG/BMP");
			return false;
		}
		
		if(My$("input[name='driver.telhpone']").val().length != 0 && !checktelephone(My$("input[name='driver.telhpone']").val())){
			My$("#drivertMsg").text(manager.qsrhfsjhm);
			return false;
		}
		
		if(My$("input[name='driver.idCard']").val().length != 0 && !IdCardValidate(My$("input[name='driver.idCard']").val())){
			My$("#drivertMsg").text(manager.sfzgscw);
			return false;
		}
		
		return true;
	
	},
	updateDriver : function(){
	
		setSubmitMsgStartState("drivertMsg");
		
		if(!VechileMananger.validateDriverData()) return;
		
		closeSubmitBtn("updateDriver");		
		
		var result = submitForm("driverForm",function(result){
		
			if(result.flag){
				
				//刷新当前页面
				
				//关闭驾驶人信息窗口
				VechileMananger.closeDriverWin();
			
			}else{
				
				if(result.code && result.code == 1001){
					My$("#drivertMsg").text(manager.xtycqshcs);
				}else{
					My$("#drivertMsg").text(result.msg);
				}
				
				openSubmitBtn("updateDriver");
				
			}
		
		});

	},
	openVehicleDetailedInfoWin : function(vehicleId){
		
		var resourseAddress = "manager/vechileAction_vehicleDetailedInfoWin.action?vehicleDetailedInfo.id=" + vehicleId;
		
		var container = {id:"managerWin",dragPanelId:"dragvehicleDetailedInfoPanel",closeBtnId:"closevehicleDetailedInfoWin"};
		
		initWin(resourseAddress,container);
		
	},
	closeVehicleDetailedInfoWin : function(){
	
		My$("#closevehicleDetailedInfoWin").click();
		
	},
	validateVehicleDetailedData : function(){
		
		if(My$("input[name='fileForm.uploadFile']").val().length != 0 && !checkImgType(My$("input[name='fileForm.uploadFile']"))){
			My$("#vehicleDetailedInfotMsg").text(manager.qxzhfdtx + ":*.PNG/GIF/JPG/JPEG/BMP");
			return false;
		}
		
		return true;
	
	},
	updateVehicleDetailedInfoWin : function(){
	
		setSubmitMsgStartState("vehicleDetailedInfotMsg");
		
		if(!VechileMananger.validateVehicleDetailedData()) return;
		
		closeSubmitBtn("updatevehicleDetailedInfoBtn");
		
		
		var result = submitForm("vehicleDetailedInfoForm",function(result){
		
			if(result.flag){
				
				//刷新当前页面
				
				//关闭驾驶人信息窗口
				VechileMananger.closeVehicleDetailedInfoWin();
			
			}else{
				
				if(result.code && result.code == 1001){
					My$("#vehicleDetailedInfotMsg").text(manager.xtycqshcs);
				}else{
					My$("#vehicleDetailedInfotMsg").text(result.msg);
				}
				
				openSubmitBtn("updatevehicleDetailedInfoBtn");
				
			}
		
		});
		
	},
	openCarOwnerWin : function(id){
		var resourseAddress = "manager/vechileAction_carOwnerWin.action?form.id=" + id;
		var container = {id:"managerWin",dragPanelId:"dragCarOwnerPanel",closeBtnId:"closeCarOwnerWin"};
		initWin(resourseAddress,container);
	},
	resetCarPass : function(id){
		$.ajax({
	        type: "POST",
	        dataType: "json",
	        async: false,
	        data:{"vhcid":id},
	        url: "manager/vechileAction_resetCarPass.action",
	        success: function(json){
				 $("#reset_tishi").show(500);
				 window.setInterval(hideDiv,2000);
	        }
		});
	},
	closeCarOwnerWin : function(){
		My$("#closeCarOwnerWin").click();
	},
	validateCarOwnerData : function(){
		
		var phone = $.trim(My$("input[name='carOwner.phone']").val());
		if(phone.length > 0 && !checktelephone(phone)){
			My$("#CarOwnerMsg").text("*请输入正确的有机号码[1]");
			return false;
		}
		
		var mobile = $.trim(My$("input[name='carOwner.mobile']").val());
		if(mobile.length > 0 && !checktelephone(mobile)){
			My$("#CarOwnerMsg").text("*请输入正确的有机号码[2]");
			return false;
		}
		
		var email = $.trim(My$("input[name='carOwner.email']").val());
		if(email.length > 0 && !checkEMail(email)){
			My$("#CarOwnerMsg").text("*请输入正确的邮箱地址");
			return false;
		}
		
		var idCard = $.trim(My$("input[name='carOwner.idCard']").val());
		if(idCard.length > 0 && !IdCardValidate(idCard)){
			My$("#CarOwnerMsg").text("*" + manager.sfzgscw);
			return false;
		}
		
		return true;
	},
	updateCarOwner : function(){
	
		setSubmitMsgStartState("CarOwnerMsg");
		
		if(!VechileMananger.validateCarOwnerData()) return;
		
		closeSubmitBtn("updateCarOwnerBtn");
		
		
		var result = submitForm("CarOwnerForm",function(result){
		
			if(result.flag){
				
				//关闭信息窗口
				VechileMananger.closeCarOwnerWin();
			
			}else{
				
				My$("#CarOwnerMsg").text(result.msg);
				
				openSubmitBtn("updateCarOwnerBtn");
				
			}
		
		});
		
	},
	pageSize: 10,
	pageCount : 0,
	nextPage : function(){
		var curPageNum=parseInt(My$("#vechile_page_num").text());
		if(0<curPageNum && curPageNum< this.pageCount){
			this.query(curPageNum+1);
		}
	},
	prevPage : function(){
		var curPageNum=parseInt(My$("#vechile_page_num").text());
		if(1<curPageNum){
			this.query(curPageNum-1);
		}
		
	},
	startPage : function(){
		if(parseInt(My$("#vechile_page_num").text())!=1){
			this.query(1);
		}
	},
	endPage : function(){
		if(parseInt(My$("#vechile_page_num").text())!=this.pageCount){
			this.query(this.pageCount);
		}
	},
	queryType : 0,
	query : function(pageOffset){
		initErrorMsg();
		//alert("111111111");
		My$("#table_manager_vechile tr").eq(0).nextAll().remove();
		My$("#table_manager_vechile tr").eq(0).after("<tr><td><div style='padding:10px; font-size:14px; color:#0099FF;'> loading... </div></td>"+
	                                      "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>");	
	    
	    var queryValue_carName="",queryValue_gprs="",queryValue_sim="";
	   
	    //if($("#vechile_carName_query_value").attr("isquery")=="true"){
	   		queryValue_carName=$("#vechile_carName_query_value").val();
	    //} 
	    
	    //if($("#vechile_gprs_query_value").attr("isquery")=="true"){
	   		queryValue_gprs=$("#vechile_gprs_query_value").val();
	    //}
	    
	    //if($("#vechile_sim_query_value").attr("isquery")=="true"){
	   		queryValue_sim=$("#vechile_sim_query_value").val();
	    //} 
	    try{
	    
	   		My$("#vechile_query_btn").attr("disabled","disabled");//设置所有的button不可用
		    $.ajax({
			        type: "POST",
			        dataType: "json",
			        url: "manager/vechileAction_query.action",
			        async : false,
			        data : {"form.pageOffset":(pageOffset-1)*VechileMananger.pageSize,"form.pageSize":VechileMananger.pageSize,"form.ot":VechileMananger.queryType,"form.carName":queryValue_carName,"form.gprs":queryValue_gprs,"form.sim":queryValue_sim},
			        success: function(json) {
			        	 My$("#table_manager_vechile tr").eq(0).nextAll().remove();
			        	 //console.info(JSON.stringify(json));
				         if (json.flag==true) {
				         	if(json.data.length!=0){
				         	     if(Manager.modelObject.DelUpdate.vechileOperate.del && Manager.modelObject.DelUpdate.vechileOperate.update){
				         	     	 for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_vechile").append("<tr id='vechile_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].carName+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\"><a href='javascript:void(0);' style='color:#07F;text-decoration: none;' onclick='simSearch("+json.data[i].sim+")'>"+json.data[i].sim+"</a></td><td align=\"center\">"+json.data[i].vedio+"</td><td align=\"center\">"+json.data[i].number+"</td><td align=\"center\">"+json.data[i].gprs+"</td><td align=\"center\">"+VechileMananger.getVechileColor(json.data[i].colorId)+"</td><td align=\"center\"  style=\"width: 150px;\"><span><a href=\"javascript:VechileMananger.del("+json.data[i].id+","+json.data[i].clientID+");\" style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> | <a href=\"javascript:VechileMananger.code(" + json.data[i].id + ",'" + json.data[i].carName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.erweima+"</a> | <a href='javascript:;' onclick=\"showVehicleManagerMenu(this,"+json.data[i].id+",'"+json.data[i].carName+"',"+json.data[i].clientID+","+json.data[i].colorId+",'"+(json.data[i].gprs) +"','"+json.data[i].sim +"',"+json.data[i].mobileId+","+json.data[i].vehicleTypeId+","+json.data[i].icon+");\" style=\"color:#07F;text-decoration: none;\">"+manager.gengduo+"</a></span></td></tr>");
							     	 }
				         	     }else if(Manager.modelObject.DelUpdate.vechileOperate.del){
				         	     	 for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_vechile").append("<tr id='vechile_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].carName+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\"><a href='javascript:void(0);' style='color:#07F;text-decoration: none;' onclick='simSearch("+json.data[i].sim+")'>"+json.data[i].sim+"</a></td><td align=\"center\">"+json.data[i].vedio+"</td><td align=\"center\">"+json.data[i].number+"</td><td align=\"center\">"+json.data[i].gprs+"</td><td align=\"center\">"+VechileMananger.getVechileColor(json.data[i].colorId)+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:VechileMananger.del("+json.data[i].id+","+json.data[i].clientID+");\" style=\"color:#07F;text-decoration: none;\">"+manager.shanchu+"</a> | <a href=\"javascript:VechileMananger.code(" + json.data[i].id + ",'" + json.data[i].carName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.erweima+"</a></span></td></tr>");
							     	 }
				         	     }else if(Manager.modelObject.DelUpdate.vechileOperate.update){
				         	     	  for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_vechile").append("<tr id='vechile_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].carName+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\"><a href='javascript:void(0);' style='color:#07F;text-decoration: none;' onclick='simSearch("+json.data[i].sim+")'>"+json.data[i].sim+"</a></td><td align=\"center\">"+json.data[i].vedio+"</td><td align=\"center\">"+json.data[i].number+"</td><td align=\"center\">"+json.data[i].gprs+"</td><td align=\"center\">"+VechileMananger.getVechileColor(json.data[i].colorId)+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:VechileMananger.code(" + json.data[i].id + ",'" + json.data[i].carName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.erweima+"</a> | <a href='javascript:;' onclick=\"showVehicleManagerMenu(this,"+json.data[i].id+",'"+json.data[i].carName+"',"+json.data[i].clientID+","+json.data[i].colorId+",'"+(json.data[i].gprs) +"','"+json.data[i].sim +"',"+json.data[i].mobileId+","+json.data[i].vehicleTypeId+","+json.data[i].icon+");\" style=\"color:#07F;text-decoration: none;\">"+manager.gengduo+"</a></span></td></tr>");
							    	 }
				         	     }else{
				         	     	for(var i=0;i<json.data.length;i++){
							       	    My$("#table_manager_vechile").append("<tr id='vechile_"+json.data[i].id+"' onmouseover='trmouseOver(this);' onmouseout='trmouseOut(this);' class='listrow"+(i%2)+"'><td align=\"center\" style=\"width: 50px;\">"+(i+1+((pageOffset-1)*GroupMananger.pageSize))+"</td><td align=\"center\">"+json.data[i].carName+"</td><td align=\"center\">"+json.data[i].overduetime+"</td><td align=\"center\"><a href='javascript:void(0);' style='color:#07F;text-decoration: none;' onclick='simSearch("+json.data[i].sim+")'>"+json.data[i].sim+"</a></td><td align=\"center\">"+json.data[i].vedio+"</td><td align=\"center\">"+json.data[i].number+"</td><td align=\"center\">"+json.data[i].gprs+"</td><td align=\"center\">"+VechileMananger.getVechileColor(json.data[i].colorId)+"</td><td align=\"center\"  style=\"width: 100px;\"><span><a href=\"javascript:VechileMananger.code(" + json.data[i].id + ",'" + json.data[i].carName + "');\" style=\"color:#07F;text-decoration: none;\">"+manager.erweima+"</a></span></td></tr>");
							     	 }
				         	     }
							    
							     
							     var pageCount=0;
							     
							     if( (json.totalCount % (VechileMananger.pageSize)) ==0){
							     	  pageCount = json.totalCount/VechileMananger.pageSize;
							     }else{
							     	  pageCount = parseInt(json.totalCount/VechileMananger.pageSize) + 1;
							     }
							     VechileMananger.pageCount=pageCount;
							     My$("#vechile_page_count").text(pageCount);
							     My$("#vechile_page_num").text(pageOffset);
							     My$("#vechile_record_count").text(json.totalCount);
						     }else{
						     	 VechileMananger.pageCount=0;
						     	 My$("#vechile_page_count").text(0);
							     My$("#vechile_page_num").text(0);
							     My$("#vechile_record_count").text(0);
						     }
						     
						     
						     
						     My$("#ot_"+VechileMananger.queryType+"_count").html("(<em >"+json.totalCount+"</em>)");
						     
						     VechileMananger.initPageBtn();
						     
				         }else{
			          	 	My$("#manager_msg_vechile").text(json.msg);                                             
			             }
			        },
			        error: function() {
			             My$("#table_manager_vechile tr").eq(0).nextAll().remove();
			        }
			});	
		}catch(e){
			    My$("#vechile_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}finally{
			    My$("#vechile_query_btn").removeAttr("disabled");//去掉button的disabled属性，使button可用
		}
	},
	initPageBtn : function(){
		if(parseInt(My$("#vechile_page_num").text())>=this.pageCount){
			My$("#vechile_nextPage_Btn").attr("class","un_fenye_s");
			My$("#vechile_endPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#vechile_nextPage_Btn").attr("class","en_fenye_s");
			My$("#vechile_endPage_Btn").attr("class","en_fenye_s");
		}
		
		if(parseInt(My$("#vechile_page_num").text())<=1){
			My$("#vechile_startPage_Btn").attr("class","un_fenye_s");
			My$("#vechile_prevPage_Btn").attr("class","un_fenye_s");
		}else{
			My$("#vechile_startPage_Btn").attr("class","en_fenye_s");
			My$("#vechile_prevPage_Btn").attr("class","en_fenye_s");
		}		
	},
	initMobileSelect : function(params){
	     
		 My$("#mobileId").html("");
		
		 var options = "<option value='' style='width:120px;' selected='selected'>--"+manager.qxzcjlx+"--</option>";	
		 if(Manager.dictionary!=null && Manager.dictionary.zidian!=null && Manager.dictionary.zidian.mobileType!=null){
			 var mobiletypejson=Manager.dictionary.zidian.mobileType; 				      						 
		     for(var i=0;i<mobiletypejson.totalCount;i++){
		       	   options+="<option id=\"mobile_"+mobiletypejson.topics[i].id+"\" style='width:120px;' value='"+mobiletypejson.topics[i].id+"'>"+mobiletypejson.topics[i].name+"</option>"
		     }	
	     }				     
	     My$("#mobileId").html(options);
	     if(params!=null && params.isUpdate && params.mobileId){
	     	My$("#mobile_"+params.mobileId).attr("selected","selected");
	     }
	     
	},
	initVehicleTypeIdSelect : function(params){
	     
		 My$("#vehicleTypeId").html("");
		
		 var options = "<option value='' style='width:120px;' selected='selected'>--"+manager.qxzcllx+"--</option>";	
		 if(Manager.dictionary!=null && Manager.dictionary.zidian!=null && Manager.dictionary.zidian.vehicleType!=null){
			 var vechiletypejson=Manager.dictionary.zidian.vehicleType; 				      						 
		     for(var i=0;i<vechiletypejson.totalCount;i++){
		       	   options+="<option id=\"vehicleType_"+vechiletypejson.topics[i].id+"\" style='width:120px;' value='"+vechiletypejson.topics[i].id+"'>"+vechiletypejson.topics[i].use+"</option>"
		     }	
	     }				     
	     My$("#vehicleTypeId").html(options);
	     
	     if(params!=null && params.isUpdate && params.vehicleTypeId){
	     	My$("#vehicleType_"+params.vehicleTypeId).attr("selected","selected");
	     }
	     
	},
	initVehicleColorSelect : function(params){
	     
		 My$("#vechile_color").html("");
		
		 var options = "<option value='' style='width:120px;' selected='selected'>--"+manager.qxzclys+"--</option>";	
		 if(Manager.dictionary!=null && Manager.dictionary.zidian!=null && Manager.dictionary.zidian.color!=null){
			 var colorjson=Manager.dictionary.zidian.color; 				      						 
		     for(var i=0;i<colorjson.totalCount;i++){
		       	   options+="<option id=\"vehicle_color_"+colorjson.topics[i].id+"\" style='width:120px;' value='"+colorjson.topics[i].id+"'>"+colorjson.topics[i].value+"</option>"
		     }	
	     }				     
	     My$("#vechile_color").html(options);
	     
	     if(params!=null && params.isUpdate && params.colorId){
	     	My$("#vehicle_color_"+params.colorId).attr("selected","selected");
	     }
	     
	},
	initClientSelect : function(params){
	     
		 My$("#vechile_clientId").html("");
		  $.ajax({
		        type: "POST",
		        dataType: "json",
		        async:false,
		        url: "manager/clientAction_query.action",
		        success: function(json) {		     
			         if (json.flag==true) {		
			         	 
			         	 var options = "<option style='width:120px;' selected='selected' value='0'>--"+manager.qxzkh+"--</option>"; 
					     
					     for(var i=0;i<json.data.length;i++){
					       	   options+="<option id=\"vechile_clientId_"+json.data[i].id+"\" style='width:120px;' value='"+json.data[i].id+"'>"+json.data[i].compyname+"</option>" 
					     }
					     
					     My$("#vechile_clientId").html(options);
					     
					     if(params!=null && params.isUpdate && params.clientId){
					     	My$("#vechile_clientId_"+params.clientId).attr("selected","selected");
					     }
			         }
		        },error: function(){My$("#vechile_clientId").html(options);}
		});	
	},
	initOverTimeSelect : function(type, vhId){
		 if(type == "add"){
		 	 My$("#vechile_overtime_tr_update").hide();
		 	 My$("#vechile_postime_tr").hide();
		 	 
		     My$("#vechile_overtime_tr").show();
			 My$("#vechile_overtime").html("");
			 
			// console.info("b.",JSON.stringify(Manager.dictionary.vhcoverduetime));
			 
			 /*
			  *  1 一个月后过期
			  *  6 半年后过期
			  *  12 一年后过期
			  */
	      	 var options = 
	      	 			   "<option value='1' style='width:120px;' selected='selected'>"+manager.yiyue+"</option>"+
	      	 			   "<option value='6' style='width:120px;'>"+manager.bannian+"</option>"+
	      	 			   "<option value='12' style='width:120px;'>"+manager.yinian+"</option>";
	      	//增加走定义的时间
	      	 try{
		      	 if(Manager.dictionary.vhcoverduetime){
		      		 console.info(Manager.dictionary.vhcoverduetime.length);
		      		 for ( var i = 0; i < Manager.dictionary.vhcoverduetime.length; i++){
		      			options += "<option value='"+Manager.dictionary.vhcoverduetime[i].value+"' style='width:120px;'>"+Manager.dictionary.vhcoverduetime[i].name+"</option>"
					}
		      	 }
	      	 }catch(e){}
		   
		     My$("#vechile_overtime").html(options);	
	     }else{
	     	 My$("#vechile_overtime_tr_update").show();
		 	 My$("#vechile_postime_tr").show();
		 	 
		     My$("#vechile_overtime_tr").hide();
			 
		     $.ajax({
		        type: "POST",
		        dataType: "json",
		        async:false,
		        url: "json/vehicleAction_byids.action",
		        data: {ids : vhId},
		        success: function(result) {	
			  		
			  		 if(result.data != null && result.data.length > 0){
			  		 		var vehicleDatas = result.data[0];
			  		 		 
					  	    My$("#overTime_").val(vehicleDatas.overduetime.split(" ")[0]);	
							if(vehicleDatas.posavtime != null && vehicleDatas.posavtime.indexOf("19") != 0){	
								My$("#posavtime_").val(vehicleDatas.posavtime);			
						    }else{
						    	My$("#posavtime_").val("");	
						    }
					  }else{
					  	  My$("#overTime_").val("");
					  	  My$("#posavtime_").val("");
					  }			  
			 },
			 error: function(){
			 		My$("#overTime_").val("");
					My$("#posavtime_").val("");
			 }});			     
	     } 			   
	},
	getVechileColor : function(colorId){
		
		if(Manager.dictionary!=null && Manager.dictionary.zidian!=null && Manager.dictionary.zidian.color!=null){
			 var colorjson=Manager.dictionary.zidian.color; 				      						 
		     var colorName="";
		     for(var i=0;i<colorjson.totalCount;i++){
		     	   if(colorId==colorjson.topics[i].id){
		       	   		colorName= colorjson.topics[i].value;
		       	   		break;
		     		}
		     }
		     
		     if(colorName.length==0){
		     	return "其它"
		     }else{
		     	return colorName;
		     }
		     
	     }else{
	     	return colorId;
	     }		
	},
	openImgPanleManager : {
		
		init : function (){
			 if(typeof(mapday_icon_data) == "undefined"){
				  $.getScript("http://vip4.exlive.cn/vhc_icons/icon_jszh_CN.jsp",function(){});
			  }  
		},
		loadPanelListener : null,
		open : function(){
		
			var vehicleImg = My$("#vehicleImg");
			
			var vehicleImgPanels =  My$("#vehicle_img_Panels");
			
			var udpateVehicleImgBtn = My$("#udpate_vehicle_img_btn");
			
			if(vehicleImgPanels.is(":visible")){
				
				vehicleImgPanels.hide();
		
				vehicleImg.css("border","0px");
				
				udpateVehicleImgBtn.show();
				
				return;
			}
			
			udpateVehicleImgBtn.hide();
			
			vehicleImg.attr("border-bottom-width","0px");
			
			vehicleImg.css("border","1px solid rgb(163, 185, 215)");
			
			vehicleImgPanels.show();
			if( vehicleImgPanels.html().length <= 0 ){
				 vehicleImgPanels.html("正在加载...");
				 
				 if(!VechileMananger.openImgPanleManager.loadPanelListener){
				 		clearInterval(VechileMananger.openImgPanleManager.loadPanelListener);
				 }
				 
				 VechileMananger.openImgPanleManager.init();
				 
		 		  VechileMananger.openImgPanleManager.loadPanelListener = setInterval(function(){
		 		  
							 		  if(typeof(mapday_icon_data) != "undefined" && mapday_icon_data.length > 0 ){
						        		
							        		var imgHTML = "";
							        		
							        		for(var i = 0; i < mapday_icon_data.length; i++ ){ 
							        			imgHTML += "<a href=\"javascript:;\" style=\"padding-left: 10px;padding-top: 10px;display: inline-block;\" title=\""+mapday_icon_data[i][1]+"\"  onclick = \"managerIframe.VechileMananger.openImgPanleManager.select('"+mapday_icon_data[i][0]+"',"+"'"+mapday_icon_data[i][1]+"',"+"'"+mapday_icon_data[i][2]+"')\"><img src=\""+mapday_icon_data[i][2]+"\" /></a>";
							        		}
							        		
							        		vehicleImgPanels.html(imgHTML);
						        			
						        			clearInterval(VechileMananger.openImgPanleManager.loadPanelListener);
						        			
						        			VechileMananger.openImgPanleManager.loadPanelListener = null;
						        	 }
					        	 },100);
			}
		},
		select : function(id,title,src){
			My$("#vehicle_img_Panels").hide();
			My$("#vehicleImg").attr("src",src);
			My$("#vehicleImg").attr("title",title);
			My$("#vehicleImg").attr("value",id);
			My$("#vehicleImg").css("border","0px");
			My$("#udpate_vehicle_img_btn").show();
		}
	},
	openGroupSelectPaneManager : { groupIds : "",
								   parentGroupName : "",
								   initGroupSelectPane : function (params){
								   		  My$("#vechile_groupId_Panels").html("");
								   		  VechileMananger.openGroupSelectPaneManager.parentGroupName = "";
										  $.ajax({
										        type: "POST",
										        dataType: "json",
										        async:false,
										        url: "manager/groupAction_query.action",
										        success: function(json) {		
											         if (json.flag==true) {		
											         	 
											         	 var checks = ""; 
													     
													     for(var i=0;i<json.data.length;i++){
													           checks+="<li><input id=\"vechile_groupId_check_"+json.data[i].id+"\" type=\"checkbox\" name=\"vechile_group_checkbox\" value=\""+json.data[i].id+"\"></input><span id=\"vechile_groupId_check_text_"+json.data[i].id+"\">"+json.data[i].groupName+"</span></li>";
													     }
													     
													     if(checks.length==0){
													     	My$("#vechile_groupId_Panels").html(manager.wkxfz);
													     }else{
													     	My$("#vechile_groupId_Panels").html("<ul>"+checks+"</ul>");
													     }
											         }
										        },error: function(){My$("#vechile_groupId_Panels").html("");}
										});
										
										if(params!=null && params.isUpdate && params.vechileId){
									     	$.ajax({
										        type: "POST",
										        dataType: "json",
										        async:false,
										        url: "manager/vechileAction_vechileGroup.action",
										        data:{"form.id":params.vechileId},
										        success: function(json) {
											         if (json.flag==true) {
											             var groupNames="";
											             json.data = arrunique2(json.data); //172
											             for(var i=0;i<json.data.length;i++){
											             	/*追加不可见的分组*/
											             	if(My$("#vechile_groupId_check_"+json.data[i]).length <= 0){
											             		if(My$("#vechile_groupId_Panels").find("ul").length <= 0){
											             			My$("#vechile_groupId_Panels").html("");
											             			My$("#vechile_groupId_Panels").append("<ul></ul>");
											             		}
											             		//My$("#vechile_groupId_Panels ul").prepend("<li><input type=\"checkbox\" name=\"vechile_group_checkbox_no_visable\" readonly=\"readonly\" disabled=\"true\" checked=\"checked\"></input><span>"+parent.equipmentMap[json.data[i]].getName()+"</span></li>");   172  
											             		My$("#vechile_groupId_Panels ul").prepend("<li><input type=\"checkbox\" name=\"vechile_group_checkbox\" readonly=\"readonly\" disabled=\"true\" checked=\"checked\" value=\""+json.data[i]+"\"></input><span>"+parent.equipmentMap[json.data[i]].getName()+"</span></li>");
											             		VechileMananger.openGroupSelectPaneManager.parentGroupName += (parent.equipmentMap[json.data[i]].getName() + ",");					             		
											             	}
											             	
											            	My$("#vechile_groupId_check_"+json.data[i]).attr("checked","true");
											            	VechileMananger.openGroupSelectPaneManager.groupIds += json.data[i]+",";
											            	if(My$("#vechile_groupId_check_text_"+json.data[i]).text()!=""){
											            		groupNames+=My$("#vechile_groupId_check_text_"+json.data[i]).text()+",";
											            	}
											         	 }
											         	 
											         	 My$("#vechile_groupId").val(VechileMananger.openGroupSelectPaneManager.parentGroupName + groupNames.substring(0,groupNames.length-1));
											         	 
											         	 //初始化可选分组ID,防止下级么有权限时不能修改
													     My$("#vechile_groupId").attr("value_",VechileMananger.openGroupSelectPaneManager.groupIds);
														 My$("#vechile_groupId").attr("checkboxGroupListPage_",VechileMananger.openGroupSelectPaneManager.groupIds);
											         }
										        },error: function(){}
								     		  });
								       }
								       
								       this.groupIds=this.groupIds.substring(0,this.groupIds.length-1); 
										
								   },
								   openGroupSelectPane : function (){
								   								My$("#vechile_groupId_Panels").show();
									
																My$("#openGroupSelectPane_btn").hide();
																
																My$("#confirmGroupSelectPane_btn").show();
																My$("#canacleGroupSelectPane_btn").show();
														},
								   openUpdateGroupSelectPane : function (){
								   								My$("#vechile_groupId_Panels").show();
									
																My$("#openUpdateGroupSelectPane_btn").hide();
																
																My$("#confirmGroupSelectPane_btn").show();
																My$("#canacleGroupSelectPane_btn").show();
														},
									confirmGroupSelectPane : function(){
									
										My$("#vechile_groupId_Panels").hide();
										
										if(My$("#addVechileButton").is(":visible")){
											My$("#openGroupSelectPane_btn").show();
										}else{
											My$("#openUpdateGroupSelectPane_btn").show();
										}
										
										My$("#confirmGroupSelectPane_btn").hide();
										My$("#canacleGroupSelectPane_btn").hide();
										
										var groupNames="";
										
										this.groupIds="";
										
										My$("input[name='vechile_group_checkbox']").each(function(){
											if(My$(this).attr("checked")==true){
									   			VechileMananger.openGroupSelectPaneManager.groupIds += My$(this).val()+",";
									   			
									   			groupNames+=My$("#vechile_groupId_check_text_"+My$(this).attr("id").split("_")[3]).text()+",";
									   		}
									    }); 
									    
									    My$("#vechile_groupId").val(VechileMananger.openGroupSelectPaneManager.parentGroupName + groupNames.substring(0,groupNames.length-1));
									    
									    this.groupIds=this.groupIds.substring(0,this.groupIds.length-1); 
									},
								
									canacleGroupSelectPane : function(){
									
										My$("#vechile_groupId_Panels").hide();
										
										if(My$("#addVechileButton").is(":visible")){
											My$("#openGroupSelectPane_btn").show();
										}else{
											My$("#openUpdateGroupSelectPane_btn").show();
										}
										My$("#confirmGroupSelectPane_btn").hide();
										My$("#canacleGroupSelectPane_btn").hide();
										
										My$("input[name='vechile_group_checkbox']").each(function(){
									   		My$(this).attr("checked",false);
									    }); 
									    
									    if(this.groupIds !=""){
									    	 var groupIdArr=this.groupIds.split(",");
									    	 var groupNames="";
									    	 for(var i=0;i<groupIdArr.length;i++){
									            	My$("#vechile_groupId_check_"+groupIdArr[i]).attr("checked","true");
									            	if(My$("#vechile_groupId_check_text_"+groupIdArr[i]).text()!=""){
									            		groupNames+=My$("#vechile_groupId_check_text_"+groupIdArr[i]).text()+",";	
									            	}										            	
											 }	
											 My$("#vechile_groupId").val(VechileMananger.openGroupSelectPaneManager.parentGroupName + groupNames.substring(0,groupNames.length-1));
									    }
									}	
	},
	peripheralPaneManager : {	   ws1 : [],
								   ws2 : [],
								   bj1 : [],
								   bj2 : [],
								   init : function (isUpdate){
								   			
								   			if(My$("#peripheral_ws_Panels").html() && My$("#peripheral_bj_Panels").html()){
								   					My$("input[name='peripheral_ws1_checkbox']").each(function(){
												   		My$(this).attr("checked",false);
												    });
												    My$("input[name='peripheral_ws2_checkbox']").each(function(){
												   		My$(this).attr("checked",false);
												    });
												    My$("input[name='peripheral_bj1_checkbox']").each(function(){
												   		My$(this).attr("checked",false);
												    });
												    My$("input[name='peripheral_bj2_checkbox']").each(function(){
												   		My$(this).attr("checked",false);
												    });
 
								   			}else{	
													var dic = Manager.dictionary;
													
													if(dic == null){
														return;
													}
													
													var ws1 = dic.ws.ws1,
														ws2 = dic.ws.ws2,
														bj1 = dic.bj.bj1,
														bj2 = dic.bj.bj2;
														
													var checks = "";	
													for(var i=0 ;i<ws1.length ; i++){ 
													
//														if(ws1[i].value=='带总里程'){
//															checks+="<li><input id=\"peripheral_ws1_check_"+ws1[i].id+"\" type=\"checkbox\" name=\"peripheral_ws1_checkbox\" checked = \"true\"  value=\""+ws1[i].id+"\" title='"+ws1[i].value+"'></input><span>"+ws1[i].value+"</span></li>";
//														}else{
															checks+="<li><input id=\"peripheral_ws1_check_"+ws1[i].id+"\" type=\"checkbox\" name=\"peripheral_ws1_checkbox\" value=\""+ws1[i].id+"\" title='"+ws1[i].value+"'></input><span>"+ws1[i].value+"</span></li>";
//														}
													}
													
													for(var i=0 ;i<ws2.length-1 ; i++){
													
														checks+="<li><input id=\"peripheral_ws2_check_"+ws2[i].id+"\" type=\"checkbox\" name=\"peripheral_ws2_checkbox\" value=\""+ws2[i].id+"\" title='"+ws2[i].value+"'></input><span>"+ws2[i].value+"</span></li>";
													
													}
													My$("#peripheral_ws_Panels").html("<ul>"+checks+"</ul>");
													
													checks = "";
													
													for(var i=0 ;i<bj1.length ; i++){
														checks+="<li><input id=\"peripheral_bj1_check_"+bj1[i].id+"\" type=\"checkbox\" name=\"peripheral_bj1_checkbox\" value=\""+bj1[i].id+"\" title='"+bj1[i].value+"'></input><span>"+bj1[i].value+"</span></li>";
													}													
													
													for(var i=0 ;i<bj2.length ; i++){
														checks+="<li><input id=\"peripheral_bj2_check_"+bj2[i].id+"\" type=\"checkbox\" name=\"peripheral_bj2_checkbox\" value=\""+bj2[i].id+"\" title='"+bj2[i].value+"'></input><span>"+bj2[i].value+"</span></li>";
													}
													
													My$("#peripheral_bj_Panels").html("<ul>"+checks+"</ul>");
													
													checks = "";
											}
											if(isUpdate){
												$.ajax({
										        type: "POST",
										        dataType: "json",
										        async:false,
										        url: "manager/vechileAction_getvehicleSW_BJ.action",
										        data:{"form.id":My$("#vechileID").val()},
										        success: function(json) {	
										        	console.info(JSON.stringify(json));
											         if (json.flag==true) {
											         	 if(json.data.length>0){
												         	 VechileMananger.peripheralPaneManager.ws1 = json.data[0].ws.ws1;
														   	 VechileMananger.peripheralPaneManager.ws2 = json.data[0].ws.ws2;
														     VechileMananger.peripheralPaneManager.bj1 = json.data[0].bj.bj1;
														     VechileMananger.peripheralPaneManager.bj2 = json.data[0].bj.bj2;
													     }
											         }
										        },error: function(){}
								     		  });
												
											}
											
											var ws1 = VechileMananger.peripheralPaneManager.ws1;
										   		ws2 = VechileMananger.peripheralPaneManager.ws2;
										        bj1 = VechileMananger.peripheralPaneManager.bj1;
										    	bj2 = VechileMananger.peripheralPaneManager.bj2;
										    
										    if(ws1.length !=0){
										    	 for(var i=0;i<ws1.length;i++){
										            	My$("#peripheral_ws1_check_"+ws1[i]).attr("checked","true");															            								            	
												 }	
										    }
										     if(ws2.length !=0){
										    	 for(var i=0;i<ws2.length;i++){
										            	My$("#peripheral_ws2_check_"+ws2[i]).attr("checked","true");															            	
												 }	
										    }
										     if(bj1.length !=0){
										    	 for(var i=0;i<bj1.length;i++){
										            	My$("#peripheral_bj1_check_"+bj1[i]).attr("checked","true");															            								            	
												 }	
										    }
										     if(bj2.length !=0){
										    	 for(var i=0;i<bj2.length;i++){
										            	My$("#peripheral_bj2_check_"+bj2[i]).attr("checked","true");															            								            	
												 }	
										    }
										    
										    var inputValue = [];
																
					 					    My$("input[name='peripheral_ws1_checkbox']").each(function(){
					 					    
												if(My$(this).attr("checked")==true){
										   			inputValue.push(My$(this).attr("title"));
										   		}
										   		
										    }); 
										    
										    My$("input[name='peripheral_ws2_checkbox']").each(function(){
					 					    
												if(My$(this).attr("checked")==true){
										   			inputValue.push(My$(this).attr("title"));
										   		}
										   		
										    }); 
										    
										     My$("input[name='peripheral_bj1_checkbox']").each(function(){
					 					    
												if(My$(this).attr("checked")==true){
										   			inputValue.push(My$(this).attr("title"));
										   		}
										   		
										    }); 
										    
										     My$("input[name='peripheral_bj2_checkbox']").each(function(){
					 					    
												if(My$(this).attr("checked")==true){
										   			inputValue.push(My$(this).attr("title"));
										   		}
										   		
										    }); 
										    
										    My$("#peripheral").val(inputValue.toString());
											
											
								   },
								   openPane : function (){		
								   								VechileMananger.peripheralPaneManager.init(false);
								   								
								   								My$("#vechile_peripheral_Panels").show();
									
																My$("#openperipheralPane_btn").hide();															
																
																My$("#confirmperipheralPane_btn").show();
																My$("#canacleperipheralPane_btn").show();
														},
								   UpdatePane : function (){
								   								
								   								VechileMananger.peripheralPaneManager.init(false);

								   								My$("#vechile_peripheral_Panels").show();
																My$("#openUpdateperipheralPane_btn").hide();
																My$("#confirmperipheralPane_btn").show();
																My$("#canacleperipheralPane_btn").show();
														},
									confirm : function(){		
																VechileMananger.peripheralPaneManager.ws1 = [];
														   		VechileMananger.peripheralPaneManager.ws2 = [];
														        VechileMananger.peripheralPaneManager.bj1 = [];
														    	VechileMananger.peripheralPaneManager.bj2 = [];
																
																My$("#vechile_peripheral_Panels").hide();
																
																if(My$("#addVechileButton").is(":visible")){
																
																	My$("#openperipheralPane_btn").show();
																	
																}else{
																	
																	My$("#openUpdateperipheralPane_btn").show();
																}
																
																My$("#confirmperipheralPane_btn").hide();
																My$("#canacleperipheralPane_btn").hide();
																
																var inputValue = [];
																
										 					    My$("input[name='peripheral_ws1_checkbox']").each(function(){
										 					    
																	if(My$(this).attr("checked")==true){
															   			VechileMananger.peripheralPaneManager.ws1.push(My$(this).val());
															   			inputValue.push(My$(this).attr("title"));
															   		}
															   		
															    }); 
															    
															    My$("input[name='peripheral_ws2_checkbox']").each(function(){
										 					    
																	if(My$(this).attr("checked")==true){
															   			VechileMananger.peripheralPaneManager.ws2.push(My$(this).val());
															   			inputValue.push(My$(this).attr("title"));
															   		}
															   		
															    }); 
															    
															     My$("input[name='peripheral_bj1_checkbox']").each(function(){
										 					    
																	if(My$(this).attr("checked")==true){
															   			VechileMananger.peripheralPaneManager.bj1.push(My$(this).val());
															   			inputValue.push(My$(this).attr("title"));
															   		}
															   		
															    }); 
															    
															     My$("input[name='peripheral_bj2_checkbox']").each(function(){
										 					    
																	if(My$(this).attr("checked")==true){
															   			VechileMananger.peripheralPaneManager.bj2.push(My$(this).val());
															   			inputValue.push(My$(this).attr("title"));
															   		}
															   		
															    }); 
															    
															    My$("#peripheral").val(inputValue.toString());
															    
															    
									},
								
									canacle : function(){
																My$("#vechile_peripheral_Panels").hide();
																
										
																if(My$("#addVechileButton").is(":visible")){
																	My$("#openperipheralPane_btn").show();
																}else{
																	My$("#openUpdateperipheralPane_btn").show();
																}
																
																My$("#confirmperipheralPane_btn").hide();
																My$("#canacleperipheralPane_btn").hide();
																
																My$("input[name='peripheral_ws1_checkbox']").each(function(){
															   		My$(this).attr("checked",false);
															    });
															    My$("input[name='peripheral_ws2_checkbox']").each(function(){
															   		My$(this).attr("checked",false);
															    });
															    My$("input[name='peripheral_bj1_checkbox']").each(function(){
															   		My$(this).attr("checked",false);
															    });
															    My$("input[name='peripheral_bj2_checkbox']").each(function(){
															   		My$(this).attr("checked",false);
															    }); 
															    
															    var ws1 = VechileMananger.peripheralPaneManager.ws1;
															   		ws2 = VechileMananger.peripheralPaneManager.ws2;
															        bj1 = VechileMananger.peripheralPaneManager.bj1;
															    	bj2 = VechileMananger.peripheralPaneManager.bj2;
															    
															    var inputValue = [];
															    
															    if(ws1.length !=0){
															    	 for(var i=0;i<ws1.length;i++){
															            	My$("#peripheral_ws1_check_"+ws1[i]).attr("checked","true");
															            	inputValue.push(My$("#peripheral_ws1_check_"+ws1[i]).attr("title"));							            	
																	 }	
															    }
															     if(ws2.length !=0){
															    	 for(var i=0;i<ws2.length;i++){
															            	My$("#peripheral_ws2_check_"+ws2[i]).attr("checked","true");
															            	inputValue.push(My$("#peripheral_ws2_check_"+ws2[i]).attr("title"));							            	
																	 }	
															    }
															     if(bj1.length !=0){
															    	 for(var i=0;i<bj1.length;i++){
															            	My$("#peripheral_bj1_check_"+bj1[i]).attr("checked","true");
															            	inputValue.push(My$("#peripheral_bj1_check_"+bj1[i]).attr("title"));							            	
																	 }	
															    }
															     if(bj2.length !=0){
															    	 for(var i=0;i<bj2.length;i++){
															            	My$("#peripheral_bj2_check_"+bj2[i]).attr("checked","true");
															            	inputValue.push(My$("#peripheral_bj2_check_"+bj2[i]).attr("title"));							            	
																	 }	
															    }
										
									}
	},
	initForwardSelect : function(vhcId){
		
		if(My$("#vechile_data_forward_type").html().length <= 0){
		
			parent.doRequest("manager/vechileAction_vhc_data_forward_types.action", "", function(result){
				
				var options = [];
				options.push("<option style=\"width:120px;\" value=\"\">请选择</option>");
				
				try{
					for(var i = 0; i < result.length; i++){
						options.push("<option style=\"width:120px;\" value=\"" + result[i].type + "\">" + result[i].name + "</option>");
					}
				}catch(e){}
				
				My$("#vechile_data_forward_type").append(options.join(""));
			});
		}
		
		if(vhcId != ""){
			parent.doRequest("manager/vechileAction_forward_by_vhcId.action", {"form.id" : vhcId}, function(result){
				try{
					My$("#vechile_data_forward_type option[value='"+result[0]+"']").attr("selected", "selected");
				}catch(e){}
				
			});
		}else{
			My$("#vechile_data_forward_type option[value='']").attr("selected", "selected");
		}		
	}	
}



var trclass="";
function trmouseOver(el){
  trclass=My$(el).attr("class");
  My$(el).attr("class",trclass+" highlight");
}

function trmouseOut(el){
  My$(el).attr("class",trclass);
}

function frame(framecontentId,framemovetitleId,closebuttonId){
		My$("#"+closebuttonId).click(function(event){
			stopBubble(event);
		   My$("#"+framecontentId).hide(); 
		   initform(framecontentId);      
		});
		My$("#"+framemovetitleId).mousedown(function(dom){
					     var top1=My$("#"+framecontentId).css("top");
						 var left1=My$("#"+framecontentId).css("left");
						 var x=dom.clientX;
						 var y=dom.clientY;
						 var x1=Math.abs(x-parseInt(left1));
						 var y1=Math.abs(y-parseInt(top1));
						 $("body",parent.document).mousemove(function(dom){
						 	  var x=dom.clientX;
						      var y=dom.clientY;  
						      My$("#"+framecontentId).css({"top":y-y1,"left":x-x1});
						 	});
					}).mouseup(function(){
					   $("body",parent.document).unbind("mousemove"); 	
					});
}

function initform(id){
	if(id=="clientContentWin"){
		
		My$("#maskPanel").show();
		
   		My$("#companyName").val("");
		My$("#companyPhone").val("");
		My$("#companyAddress").val("");
		My$("#clientID").val("");
		My$("#addclientmsg").css("color","rgb(153, 153, 153)");
		My$("#addclientmsg").text(manager.bnwk);
		
		My$("#addClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		My$("#updateClientButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		
		My$("#manager_clientName").text(manager.tjkh);
		
		My$("#addClientButton").show();
		My$("#updateClientButton").hide();
    }else if(id=="manager_groupContentWin"){

		My$("#groupName").val("");
		My$("#userCount").val("");
		My$("#vechileCount").val("");
		My$("#groupID").val("");

		My$("#groupName_Msg").css("color","rgb(153, 153, 153)");
		My$("#selectClient_Msg").css("color","rgb(153, 153, 153)");
		My$("#userCountMsg").css("color","rgb(153, 153, 153)");
		My$("#vechileCountMsg").css("color","rgb(153, 153, 153)");
		
		My$("#addgroupmsg").css("color","rgb(153, 153, 153)");
		My$("#addgroupmsg").html("&nbsp;");
		
		My$("#addGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		My$("#updateGroupButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		
		My$("#manager_groupName").text(manager.tjfz);
		
		My$("#addGroupButton").show();
		My$("#updateGroupButton").hide();
    }else if(id=="manager_vechileContentWin"){

		My$("#carName").val("");
		My$("#gprsID").val("");
		My$("#SIMNum").val("");
		My$("#vechileID").val("");
		My$("#vechile_groupId").val("");
		My$("#vechile_clientId").val("");
		
		VechileMananger.openGroupSelectPaneManager.groupIds ="";
		
		
		My$("#vechile_groupId_Panels").hide();
										
		My$("#openGroupSelectPane_btn").show();
		My$("#openUpdateGroupSelectPane_btn").hide();
		
		My$("#confirmGroupSelectPane_btn").hide();
		My$("#canacleGroupSelectPane_btn").hide();

		My$("#carName_Msg").css("color","rgb(153, 153, 153)");
		My$("#vechile_groupId_Msg").css("color","rgb(153, 153, 153)");
		My$("#gprsID_Msg").css("color","rgb(153, 153, 153)");
		My$("#SIMNum_Msg").css("color","rgb(153, 153, 153)");
		My$("#mobileId_Msg").css("color","rgb(153, 153, 153)");
		My$("#vehicleTypeId_Msg").css("color","rgb(153, 153, 153)");
		My$("#vechile_clientId_Msg").css("color","rgb(153, 153, 153)");
		My$("#vechile_groupId_Msg").css("color","rgb(153, 153, 153)");
		My$("#vechile_groupId_Msg").show();
		
		My$("#addvechilemsg").css("color","rgb(153, 153, 153)");
		My$("#addvechilemsg").html(" &nbsp;");
		
		My$("#addVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		My$("#updateVechileButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		
		My$("#vehicleImg").attr("src","http://mapday.exlive.cn/vhc_icons/pic/0/green_0.gif");
		My$("#vehicleImg").attr("value","0");
		My$("#vehicleImg").attr("title","车辆1");
		My$("#vehicle_img_Panels").hide();
		My$("#vehicleImg").css("border","0px");
		My$("#udpate_vehicle_img_btn").show();
		
		if(VechileMananger.openImgPanleManager.loadPanelListener){
				clearInterval(VechileMananger.openImgPanleManager.loadPanelListener);						        			
		}
		
		
		My$("#manager_vechileName").text(manager.tjsb);
		My$("#vechile_color_tr").hide();
		My$("#vechile_overtime_tr").hide();
		My$("#vechile_overtime_tr_update").hide();
		
		My$("#addVechileButton").show();
		My$("#updateVechileButton").hide();
		
		
		VechileMananger.peripheralPaneManager.ws1 = [];
   		VechileMananger.peripheralPaneManager.ws2 = [];
        VechileMananger.peripheralPaneManager.bj1 = [];
    	VechileMananger.peripheralPaneManager.bj2 = [];
    	My$("#peripheral").val("");
    	
    	My$("#vechile_peripheral_Panels").hide();
													
		My$("#openperipheralPane_btn").show();
		My$("#openUpdateperipheralPane_btn").hide();
		My$("#confirmperipheralPane_btn").hide();
		My$("#canacleperipheralPane_btn").hide();


    }else if(id == "manager_userContentWin"){
    	
    	My$("#userName").val("");
		My$("#userPwd").val("");
		My$("#reuserPwd").val("");
		My$("#user_group_count").val("");
		My$("#user_moin_count").val("");
		My$("#user_vechile_count").val("");
		My$("#manager_userID").val("");
		My$("#user_group").val("");
		

		My$("#userName_Msg").css("color","rgb(153, 153, 153)");
		My$("#manager_userType_Msg").css("color","rgb(153, 153, 153)");
		//My$("#userPwd_Msg").text(manager.bnwk);
		My$("#userPwd_Msg").css("color","rgb(153, 153, 153)");
		My$("#reuserPwd_Msg").text(manager.bnwk);
		My$("#reuserPwd_Msg").css("color","rgb(153, 153, 153)");
		My$("#user_client_Msg").css("color","rgb(153, 153, 153)");
		My$("#user_group_count_Msg").css("color","rgb(153, 153, 153)");
		My$("#user_moin_count").css("color","rgb(153, 153, 153)");
		My$("#user_vechile_count_Msg").css("color","rgb(153, 153, 153)");
		
		My$("#addUsermsg").html("&nbsp;");
		My$("#addUsermsg").css("color","rgb(153, 153, 153)");
		
		My$("#addUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		My$("#updateUserButton").removeAttr("disabled");//去掉button的disabled属性，使button可用
		
		My$("#addUserButton").show();
		My$("#updateUserButton").hide();
		
		My$("#user_group_tr").hide();
		My$("#user_vechile_count_tr").hide();
		My$("#user_moin_count_tr").hide();
		My$("#user_group_count_tr").hide();
		My$("#user_client_tr").show();
		My$("#manager_userType_tr").show();
		
		My$("#userPwd_tr").show();
	    My$("#reuserPwd_tr").show();
		
		My$("#open_User_GroupSelectPane_btn").show();
		My$("#openUpdate_User_GroupSelectPane_btn").hide();
		
		My$("#add_user_overTime").hide();
		My$("#update_user_overTime").hide();
		
		My$("#userName_title").text(manager.tjyh);
		
		
		
		UserMananger.openGroupSelectPaneManager.groupIds ="";
		
		My$("#user_groupId_Panels").hide();
		My$("#openUpdate_User_GroupSelectPane_btn").hide();
		My$("#confirm_User_GroupSelectPane_btn").hide();
		
    }
    
    closeMask();
    initErrorMsg();
}

function initErrorMsg(){
	My$("#manager_msg_client").text("");
	My$("#manager_msg_group").text("");
	My$("#manager_msg_user").text("");
	My$("#manager_msg_vechile").text("");
}

function winToCenter(){
	My$("#clientContentWin").center();
	My$("#manager_groupContentWin").center();
	My$("#manager_vechileContentWin").center();
	My$("#manager_userContentWin").center();
	if(My$("#maskPanel").is(":visible")){
		My$('#maskcontent').center();
		My$("#maskPanel").css({"height":My$(document).height(),"width":My$(document).width()});
	}
} 
(function($) {  
    jQuery.fn.center = function () {  
         this.css('position','absolute');  
         this.css('top', ( $(document).height() - this.height() ) /2 +$(document).scrollTop() + 'px');  
         this.css('left', ( $(document).width() - this.width() ) / 2+$(document).scrollLeft() + 'px');  
         return this;  
    }  
})(jQuery);  //调用：My$("#macoArea").center();

function stopBubble(e){  
        // 如果传入了事件对象，那么就是非ie浏览器  
        if(e&&e.stopPropagation){  
            //因此它支持W3C的stopPropagation()方法  
            e.stopPropagation();  
        }else{  
            //否则我们使用ie的方法来取消事件冒泡  
            window.event.cancelBubble = true;  
        }  
}

function openMask(isDelete){
	My$("#maskPanel").css({"height":$(window).height()+20,"width":$(window).width()+20}).show();		
	if(isDelete){
		My$("#maskcontent").show();
		My$('#maskcontent').center();
	}
	
}
function closeMask(){
    My$("#maskPanel").hide();
    My$("#maskcontent").hide();
}

function My$(target){
	if($(target).length > 0){
		return $(target);
	}else{			
		return $(target,parent.document);
	}
}

function submitForm(formId,fun){
	 
	 My$("#"+formId).ajaxSubmit({
								dataType : "json",
								success : function (json) {
									fun(json);
								},
								error : function(){
									fun({flag:false,code:1001});
								}
							});
	
}

function getAJAXHtml(resourceAddress){
	
	var result = "";
	
	$.ajax({type:"POST",
		    dataType:"html",
			async:false,
			url:resourceAddress.split("?")[0], 
			data : resourceAddress.split("?").length > 1 ? resourceAddress.split("?")[1] : {},
	        success:function (html) {
		     	result = html;
	    	},error:function(e){}
	 });
	 
	 return result;
	
}

function initWin(resourceAddress,container){
	
	var containerDIV = My$("#"+container.id);
	
	openMask(false);
	
	containerDIV.html(getAJAXHtml(resourceAddress));
	
	frame(container.id,container.dragPanelId,container.closeBtnId);
	
	containerDIV.show();
	
	containerDIV.center();
	
}

function closeSubmitBtn(btnId){
	My$("#" + btnId).attr("disabled","disabled");
}

function openSubmitBtn(btnId){
	My$("#" +  btnId).removeAttr("disabled");
}

function setSubmitMsgStartState(msgId){
	My$("#" +  msgId).html(manager.zztj);
}

function setSubmitMsgEndState(msgId){
	My$("#" +  msgId).html(manager.tjjs);
}


function checkImgType(imgFile){
 
   var filepath=imgFile.val();
   var extStart=filepath.lastIndexOf(".");
   var ext=filepath.substring(extStart,filepath.length).toUpperCase();
   if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"&&ext!=".BMP"){

	  imgFile.focus();
	   
	   if ( $.browser.msie) {  //判断浏览器
	   
	       imgFile.select();
           document.execCommand("delete");
           
	   }
	   
	   imgFile.val("");
	   
	   return false;
   }
   return true;
}

var Wi = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1 ];// 加权因子   
var ValideCode = [ 1, 0, 10, 9, 8, 7, 6, 5, 4, 3, 2 ];// 身份证验证位值.10代表X   
function IdCardValidate(idCard) {   
    idCard = $.trim(idCard.replace(/ /g, ""));   
    if (idCard.length == 15) {   
        return isValidityBrithBy15IdCard(idCard);   
    } else if (idCard.length == 18) {   
        var a_idCard = idCard.split("");// 得到身份证数组   
        if(isValidityBrithBy18IdCard(idCard)&&isTrueValidateCodeBy18IdCard(a_idCard)){   
            return true;   
        }else {   
            return false;   
        }   
    } else {   
        return false;   
    }   
}

/**  
 * 判断身份证号码为18位时最后的验证位是否正确  
 * @param a_idCard 身份证号码数组  
 * @return  
 */  
function isTrueValidateCodeBy18IdCard(a_idCard) {   
    var sum = 0; // 声明加权求和变量   
    if (a_idCard[17].toLowerCase() == 'x') {   
        a_idCard[17] = 10;// 将最后位为x的验证码替换为10方便后续操作   
    }   
    for ( var i = 0; i < 17; i++) {   
        sum += Wi[i] * a_idCard[i];// 加权求和   
    }   
    valCodePosition = sum % 11;// 得到验证码所位置   
    if (a_idCard[17] == ValideCode[valCodePosition]) {   
        return true;   
    } else {   
        return false;   
    }   
}   
/**  
 * 通过身份证判断是男是女  
 * @param idCard 15/18位身份证号码   
 * @return 'female'-女、'male'-男  
 */  
function maleOrFemalByIdCard(idCard){   
    idCard = trim(idCard.replace(/ /g, ""));// 对身份证号码做处理。包括字符间有空格。   
    if(idCard.length==15){   
        if(idCard.substring(14,15)%2==0){   
            return 'female';   
        }else{   
            return 'male';   
        }   
    }else if(idCard.length ==18){   
        if(idCard.substring(14,17)%2==0){   
            return 'female';   
        }else{   
            return 'male';   
        }   
    }else{   
        return null;   
    }   
//  可对传入字符直接当作数组来处理   
// if(idCard.length==15){   
// alert(idCard[13]);   
// if(idCard[13]%2==0){   
// return 'female';   
// }else{   
// return 'male';   
// }   
// }else if(idCard.length==18){   
// alert(idCard[16]);   
// if(idCard[16]%2==0){   
// return 'female';   
// }else{   
// return 'male';   
// }   
// }else{   
// return null;   
// }   
}   
 /**  
  * 验证18位数身份证号码中的生日是否是有效生日  
  * @param idCard 18位书身份证字符串  
  * @return  
  */  
function isValidityBrithBy18IdCard(idCard18){   
    var year =  idCard18.substring(6,10);   
    var month = idCard18.substring(10,12);   
    var day = idCard18.substring(12,14);   
    var temp_date = new Date(year,parseFloat(month)-1,parseFloat(day));   
    // 这里用getFullYear()获取年份，避免千年虫问题   
    if(temp_date.getFullYear()!=parseFloat(year)   
          ||temp_date.getMonth()!=parseFloat(month)-1   
          ||temp_date.getDate()!=parseFloat(day)){   
            return false;   
    }else{   
        return true;   
    }   
}   
  /**  
   * 验证15位数身份证号码中的生日是否是有效生日  
   * @param idCard15 15位书身份证字符串  
   * @return  
   */  
  function isValidityBrithBy15IdCard(idCard15){   
      var year =  idCard15.substring(6,8);   
      var month = idCard15.substring(8,10);   
      var day = idCard15.substring(10,12);   
      var temp_date = new Date(year,parseFloat(month)-1,parseFloat(day));   
      // 对于老身份证中的你年龄则不需考虑千年虫问题而使用getYear()方法   
      if(temp_date.getYear()!=parseFloat(year)   
              ||temp_date.getMonth()!=parseFloat(month)-1   
              ||temp_date.getDate()!=parseFloat(day)){   
                return false;   
        }else{   
            return true;   
        }   
  }   
  
  function checktelephone(value) {

	    var RegCellPhone = /^([0-9]{11})?$/;
	    
	    var RegCellPhone2 = /^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$/; 
	    
	    var falg=value.search(RegCellPhone2);
	    
	    if (falg==-1){
	      
			return false;
	    
	    }else{
	    
	    	return true;
	    	
	    }
	} 
	
/*
 *验证邮箱地址是否合法
 */
function checkEMail(str){   
   var result=str.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/);   
   if(result==null) return false;   
    return true;   
}
	
	//弹出菜单开始
function showVehicleManagerMenu(element,id,carName,clientId,colorId,gprsId,simcode,mobileId,vechileTypeId,imgSrc){
  	
   	
   if(My$("#vehicleManagerItem")) My$("#vehicleManagerItem").remove();
   My$(parent.window.document.body).append("<div class=\"downMenus\" id=\"vehicleManagerItem\" style=\"display: none;\">"+
												"<div class=\"secondMenus\" id=\"vehicleManagerItemSecondMenus\" style=\"z-index:1000;\">"+
												  "<ul>"+
												  	  "<li onclick=\"managerIframe.VechileMananger.openUpdateWindow("+id+",'"+carName+"',"+clientId+","+colorId+",'"+(gprsId) +"','"+simcode +"',"+mobileId+","+vechileTypeId+","+imgSrc+");\">"+manager.jbxx+"</li>"+
												  	  "<li onclick=\"managerIframe.VechileMananger.openVehicleDetailedInfoWin("+id+");\">"+manager.xxxx+"</li>"+
												  	  "<li onclick=\"managerIframe.VechileMananger.openDriverWin("+id+");\">"+manager.jsyxx+"</li>"+
												  	  "<li onclick=\"managerIframe.VechileMananger.openCarOwnerWin(" + id + ");\">"+manager.chezhuxinxi+"</li>"+
												  	  "<li onclick=\"managerIframe.VechileMananger.resetCarPass(" + id + ");\">"+manager.chongzhimima+"</li>"+
												  "</ul>"+
												"</div>"+
										"</div>");
   
   My$("#vehicleManagerItem").show();
   My$("#vehicleManagerItemSecondMenus").show();

   // 取得元素的左下角坐标
   var offset = My$(element).offset();
   var left_x = offset.left;
   var down_y = offset.top+My$(element).height();
   
   var mh=My$(window).height();
   
   var h= My$("#vehicleManagerItem").height();
   
   if(mh<h+down_y){ //超 高
   	 down_y=down_y-h+15;
   }
   
   //更改二级菜单样式并显示
   My$("#vehicleManagerItemSecondMenus").css({"left":left_x-90,"top":down_y-25,"width":70});
   
   My$("#vehicleManagerItem").bind({
		mouseleave:function(){
		   My$("#vehicleManagerItemSecondMenus").hide();
	   }
   });
   
    // 鼠标点击二级菜单效果
	  My$("#vehicleManagerItemSecondMenus li").bind({
		  mouseenter:function(){
			    My$(this).addClass("lihover");
		  },
		  mouseleave:function(){
			    My$(this).removeClass("lihover");
		  },
		  click: function(){
		      My$("#vehicleManagerItemSecondMenus").hide();
		  }
	});

}

//用户管理弹出菜单--更过
function showUserManagerMenu(element,id,userName){
  	
   	
   if(My$("#userManagerItem")) My$("#userManagerItem").remove();
	
   My$(parent.window.document.body).append("<div class=\"downMenus\" id=\"userManagerItem\" style=\"display: none;\">"+
										"<div class=\"secondMenus\" id=\"userManagerItemSecondMenus\" style=\"z-index:1000;\">"+
										  "<ul>"+
										  	  "<li onclick=\"managerIframe.UserMananger.resetpwd("+id+",'"+userName+"');\">"+manager.chongzhimima+"</li>"+
										  	  "<li onclick=\"managerIframe.UserMananger.code("+id+",'"+userName+"');\">"+manager.erweima+"</li>"+										  
										  "</ul>"+
										"</div>"+
								"</div>");
   
   My$("#userManagerItem").show();
   My$("#userManagerItemSecondMenus").show();

   // 取得元素的左下角坐标
   var offset = My$(element).offset();
   var left_x = offset.left;
   var down_y = offset.top+My$(element).height();

   var mh=My$(window).height();
   
   var h= My$("#userManagerItem").height();
   
   if(mh<h+down_y){ //超 高
   	 down_y=down_y-h+15;
   }
   
   //更改二级菜单样式并显示
   My$("#userManagerItemSecondMenus").css({"left":left_x-90,"top":down_y-25,"width":70});
   
   My$("#userManagerItem").bind({
		mouseleave:function(){
		   My$("#userManagerItemSecondMenus").hide();
	   }
   });
   
    // 鼠标点击二级菜单效果
	  My$("#userManagerItemSecondMenus li").bind({
		  mouseenter:function(){
			    My$(this).addClass("lihover");
		  },
		  mouseleave:function(){
			    My$(this).removeClass("lihover");
		  },
		  click: function(){
		      My$("#userManagerItemSecondMenus").hide();
		  }
	});

}

function openFileWindow(){
	My$("input[name='fileForm.uploadFile']").click();
}

function synchronousFileInput(){
	My$("#fileFormViewInput").val(My$("input[name='fileForm.uploadFile']").val());
}

function arrunique(arr) {
    var result = [], isRepeated;
    for (var i = 0, len = arr.length; i < len; i++) {
        isRepeated = false;
        for (var j = 0, len = result.length; j < len; j++) {
            if (arr[i] == result[j]) {   
                isRepeated = true;
                break;
            }
        }
        if (!isRepeated) {
            result.push(arr[i]);
        }
    }
    return result;
}
//取除重复  172
function arrunique2(arr) {
    var result = [], isRepeated;
    var str = "";
    for (var i = 0; i < arr.length; i++) {
        isRepeated = false;
        if(str.indexOf(arr[i]) == -1){
        	str += arr[i]+",";
        	result.push(arr[i]);
        }
    }
    return result;
}
function  hideDiv(){
	$("#reset_tishi").hide(800);
}
function simSearch(sim){
	openPopuWin($("#serverUrl").val() +"/gpsonline/jsp/sim_search.jsp?simCode="+sim);
}
function openPopuWin(html_src_){
	var popuWin = $("#popuWin");
	$.ajax({
		 type:"GET",
		 dataType:"html",
		 async:false,
		 url:html_src_, 
	     success:function (html) {
	     	popuWin.html(html);
	     	frame("popuWin","movePopuWin","closePopuWin");
	    	popuWin.show();
	    	popuWin.center();
    	 },error:function(e){
    	 }
	 });
	
}
