function operationFontFormatter(cellvalue, options, rowObject){
	if(parseInt(cellvalue)==0){
		return '<span style="color:#E4E4E4">'+cellvalue+'</span>'
	}else {
		return cellvalue
	}
}
$(function(){
	var gridTable = "#attendanceList", mainTitle = '考勤信息导出csv';
	var orgIdList=[],userIdList=[];
	var colname=['用户id','姓名','部门','工号','职位','出勤天数','休息天数', '工作时长', '迟到次数', '迟到时长', '严重迟到次数', '严重迟到时长','旷工迟到天数','早退次数','早退时长','上班缺卡次数','下班缺卡次数','旷工天数','（天）','（小时）','（天）','（小时）','事假（天）','年假（天）','探亲假（天）','病假（天）','调休（天）','产假（天）','陪产假（天）','婚假（天）','例假（天）','丧假（天）','工作日加班（小时）','休息日加班（小时）','节假日加班（小时）'];
	var model=[
	    {name: 'userId',label:'用户id', index: 'userId', width: 80, align: 'center',hidden:true,hidedlg:true,frozen : true,title:false },
	    {name: 'userName',label:'姓名', index: 'userName', width: 70,frozen : true,title:false },
	    {name: 'orgName',label:'部门', index: 'orgName',formatter:departmentFmatter, width: 200, title:false },
	    {name: 'jobNumber',label:'工号', index: 'jobNumber', width: 70,align: 'center',title:false },
	    {name: 'position',label:'职位', index: 'attendanceVo.position', width: 200,title:false },
	    {name: 'attendanceVo.attendanceDay',label:'出勤天数', index: 'attendanceVo.attendanceDay', width: 70,align: 'center',title:false,formatter:operationFontFormatter },
	    {name: 'attendanceVo.restDay',label:'休息天数', index: 'attendanceVo.restDay', width: 75,  align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.workTimeDisplayName',label:'工作时长', index: 'attendanceVo.workTimeDisplayName', width: 150,  align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.lateNumber',label:'迟到次数', index: 'attendanceVo.lateNumber', width: 75, align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.lateTimeDisplayName',label:'迟到时长', index: 'attendanceVo.lateTimeDisplayName', width: 75, align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.seriousLateNumber',label:'严重迟到次数', index: 'attendanceVo.seriousLateNumber', width: 100, align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.seriousLateTimeDisplayName',label:'严重迟到时长', index: 'attendanceVo.seriousLateTimeDisplayName', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.absenteeismLateDay',label:'旷工迟到天数', index: 'attendanceVo.absenteeismLateDay', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.leaveEarlyNumber',label:'早退次数', index: 'attendanceVo.leaveEarlyNumber', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.leaveEarlyTimeDisplayName',label:'早退时长', index: 'attendanceVo.leaveEarlyTimeDisplayName', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.workMissNumber',label:'上班缺卡次数', index: 'attendanceVo.workMissNumber', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.offWorkMissNumber',label:'下班缺卡次数', index: 'attendanceVo.offWorkMissNumber', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.absenteeismDay',label:'旷工天数', index: 'attendanceVo.absenteeismDay', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.travelingDay',label:'出差（天）', index: 'attendanceVo.travelingDay', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.travelingTime',label:'出差（小时）', index: 'attendanceVo.travelingTime', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.goOutDay',label:'外出（天）', index: 'attendanceVo.goOutDay', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.goOutTime',label:'外出（小时）', index: 'attendanceVo.goOutTime', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.leaveHoliday',label:'事假（天）', index: 'attendanceVo.leaveHoliday', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.annualLeave',label:'年假（天）', index: 'attendanceVo.annualLeave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.visitFamily',label:'探亲（天）', index: 'attendanceVo.visitFamily', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.sickLeave',label:'病假（天）', index: 'attendanceVo.sickLeave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.paidLave',label:'调休（天）', index: 'attendanceVo.paidLave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.maternityLeave',label:'产假（天）', index: 'attendanceVo.maternityLeave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.paternityLeave',label:'陪产假（天）', index: 'attendanceVo.paternityLeave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.marriageHoliday',label:'婚假（天）', index: 'attendanceVo.marriageHoliday', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.officialHoliday',label:'例假（天）', index: 'attendanceVo.officialHoliday', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.funeralLeave',label:'丧假（天）', index: 'attendanceVo.funeralLeave', width: 90,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.workOverTime',label:'工作日加班（小时）', index: 'attendanceVo.workOverTime', width: 125,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.restOverTime',label:'休息日加班（小时）', index: 'attendanceVo.restOverTime', width: 125,align: 'center',title:false,formatter:operationFontFormatter},
	    {name: 'attendanceVo.holidayOverTime',label:'节假日加班（小时）', index: 'attendanceVo.holidayOverTime', width: 125,align: 'center',title:false,formatter:operationFontFormatter}
	];
	var groupheader=[
		{startColumnName: 'attendanceVo.travelingDay', numberOfColumns: 2,titleText: '<span style="color:#656565">出差</span>'},
		{startColumnName: 'attendanceVo.goOutDay', numberOfColumns: 2,titleText: '<span style="color:#656565">外出</span>'},
		{startColumnName: 'attendanceVo.leaveHoliday', numberOfColumns: 10,titleText: '<span style="color:#656565">请假</span>'},
		{startColumnName: 'attendanceVo.workOverTime', numberOfColumns: 3, titleText: '<span style="color:#656565">加班时长-按加班规则计算</span>'}
	];
	function departmentFmatter(cellvalue, options, rowObject){
		var cellval=cellvalue.replace(/\s{1,}/g,",");
		var arr=cellval.split(',');
		var returndiv='';
		for(var i=0;i<arr.length-1;i++){
			if(arr[i].length){
				returndiv+='<span class="yk_DMbackground">'+arr[i]+' '+'</span>'
			}
		}
		return returndiv;
	}
	function init(){
		var start=getDateTime();
		$(".startdate_input").val(start);
		$(".date-start-choice").datetimepicker({
		    language:  "zh-CN",
		    weekStart: 1,
		    todayBtn:  1,
		    autoclose: 1,
		    todayHighlight: 1,
		    startView: 2,
		    minView: 2,
		    forceParse: 0,
		    format: "yyyy-mm-dd"
		});
		var today=getDateTime('today');
		$(".enddate_input").val(today);
		$(".date-end-choice").datetimepicker({
		    language:  "zh-CN",
		    weekStart: 1,
		    todayBtn:  1,
		    autoclose: 1,
		    todayHighlight: 1,
		    startView: 2,
		    minView: 2,
		    forceParse: 0,
		    format: "yyyy-mm-dd",
		    startDate:start,
		    endDate:today
		});
		pushData();
		loadGrid(colname,model,$(".startdate_input").val(),$(".enddate_input").val());
	}
	$("#attendanceTypeId option[value='1']").prop("selected",true);
	init();
	function loadGrid(colName,model,start,end){
		var postdata;
		if(start&&end){
			postdata={
				'startTime':start,
				'endTime':end
			}
		}
		postdata.userState=$("#attendanceTypeId option:selected").attr("value");
		orgIdList.length=0;userIdList.length=0;
		var i=0;j=0;
		$(".attendanceSelect .chooseDepartOrPersonSpan").each(function(){
			var type=$(this).attr("type");
			if(type.indexOf("icon-folder-close")!=-1){
				postdata['orgIdList['+i+']'] = $(this).attr("dataid");
				i++
			}else if(type.indexOf("icon-user")!=-1){
				postdata['userIdList['+j+']'] = $(this).attr("dataid");
				j++
			}
		})
		sxUtil.jqGrid("#attendanceList",{
	    	url : '/attendanceManagement/do_list',
	    	postData:postdata,
	  		colNames:colName,
		  	colModel:model ,
	    	rowNum:10,
	    	page:1,
		    pager: '#attendanceListPage',
	 		rownumbers:false,
	 		multiselect:false,
	 		shrinkToFit:false,
	 		sortable:false,
	 		loadComplete : function(data) {
	 		// 无数据时列表中间显示'暂无数据'字样
				if( data.records<=0 ){
					if( $("#attendanceList").parent().find('.tableNorecords').length <= 0 ){
						$("#attendanceList").parent().append('<div class="tableNorecords">暂无数据...</div>'); 
					}
				}else{
					$('.tableNorecords').remove();
				};
				// 页数小于等于1页时, 切换上下页按钮不亮, 添加页码元素
				$("#attendanceList").parents('.ui-jqgrid').find('.ui-pager-table').attr('datatotalrow',data.total);
				$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parents('tr').css('position','relative');
				$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<p class="tiaozhi">跳至<span style="margin-left:0.43rem;">页</span></p>')
				$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-selbox').find('option').each(function(i,ele){
					$(ele).text( $(ele).text().split(' ')[0]+' 条/页' )
				});
				if( data.total<=1 ){
					$("#attendanceList").parents('.ui-jqgrid').find('.ui-icon-seek-next').parent().addClass('ui-state-disabled');
					$("#attendanceList").parents('.ui-jqgrid').find('.ui-icon-seek-prev').parent().addClass('ui-state-disabled');
					$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle active" style="margin-left:1px">1</span>')
				}else{
					if( data.total<=10 ){//页数小于等于10
						for( var i=0;i<data.total;i++ ){
							if( (i+1) == data.page ){
								$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle active">'+(i+1)+'</span>');
							}else{
								$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
							};
						};
						i = null;
					}else{//大于10页
						for( var i=0;i<data.total;i++ ){
							//data.page页 一定要显示出来  并且 data.page 页的左右相邻的4页一定要显示出来 
							//当右侧相邻的页数小于等于5页就到尽头时,则都显示出来,大于5页时,则显示4页+...+最后一页
							//当左侧相邻的页数小于等于5页就到尽头时,则都显示出来,大于5页时,则显示第一页+...+4页
							
							if( (i+1) < data.page ){//data.page的左侧
								if( data.page > 6 ){//左侧相邻的页数大于5页
									if( (i+1) == 1 ){
										$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
										$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<i>.....</i>');
									};
									var leftFourPage = [data.page-1,data.page-2,data.page-3,data.page-4];
									if( leftFourPage.indexOf( (i+1) ) != -1 ){
										$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
									};
								}else{//左侧相邻的页数小于等于5页
									$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
								};
							}else if( (i+1) == data.page ){//显示 data.page 页
								$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle active">'+(i+1)+'</span>');
							}else{//data.page的右侧
								if( data.total-data.page <= 5 ){//右侧相邻的页数小于等于5页
									$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
								}else{//右侧相邻的页数大于5页
									var rightFourPage = [data.page+1,data.page+2,data.page+3,data.page+4,data.total];
									if( rightFourPage.indexOf( (i+1) ) != -1 ){
										$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<span class="newPageEle">'+(i+1)+'</span>');
									};
									if( (i+1) == (data.page+5) ){
										$("#attendanceList").parents('.ui-jqgrid').find('.ui-pg-input').parent().append('<i>.....</i>');
									};
								};
							};
						};
						i = null;
					};
				};
	 			
	 			if(!data.records){
	 				new $.zui.Messager('筛选结果：暂无数据', {
						type : 'success',
						time : 1500
					}).show();
	 			}
	 			var notfrozen=$("#attendanceList_frozen").parent().prev().prev().find("#attendanceList");
	 			$("#attendanceList_frozen tr").each(function(index,item){
	 				if($(this).attr("id")){
	 					var heig=notfrozen.find('tr').eq(index).height();
	 					$(this).height(heig);
	 				}
	 			})
	 		}
		},true);
		if(start&&end){
			var newstart=new Date(start);
			var newend=new Date(end);
			while(newstart<=newend){
				var w1 = getMyDay(newstart);
				var w2=getStandardDate(newstart);
				var w1html;
				if(w1=="六"||w1=="日"){
					w1html='<span style="color:#CDC9C9">'+w1+'</span>'
				}else {
					w1html='<span style="color:#656565">'+w1+'</span>'
				}
				groupheader.push({
					startColumnName: 'attendanceVo.day'+w2, 
					numberOfColumns: 1, 
					titleText: w1html
				});
				newstart.setDate(newstart.getDate()+1);
			}
		}
		$("#attendanceList").jqGrid('setGroupHeaders', {
	 		useColSpanStyle: true, 
		 	groupHeaders:groupheader  
		});
		jQuery("#attendanceList").jqGrid('setFrozenColumns');
		$(".jqg-third-row-header").eq(0).find("th[id^='attendanceList_attendanceVo.day']").each(function(){
			var week=getMyDay(new Date(getDateString($(this).find(".ui-jqgrid-sortable").text())));
			if(week=="六"){
				$(this).find(".ui-jqgrid-sortable").css({"color":"#CDC9C9"});
			}else if(week=="日"){
				$(this).find(".ui-jqgrid-sortable").css({"color":"#CDC9C9"});
			}
		})
	}
	//查询点击
	$(".query").off("click").on("click",function(){
		reloadData();
	})
	//开始时间点击
	$(".attendance-header").delegate(".date-start-choice","click",function(){
		var end=$(".enddate_input").val();
		$('.date-start-choice').datetimepicker('setEndDate', end);
	})
	$(".startdate_input").change(function(){
		reloadData();
	})
	//结束时间点击
	$(".attendance-header").delegate(".date-end-choice","click",function(){
		var start=$(".startdate_input").val();
		$('.date-end-choice').datetimepicker('setStartDate', start);
	})
	$(".enddate_input").change(function(){
		reloadData();
	})
	/* 部门／人员的选择 */
	$(".attendanceSelect").unbind("click").bind("click",function(){
		chooseDepartOrPerson({
			dialogId:'.myModal-attendanceSendRange',//弹框的选择器
			chooseSure:'.attendanceChooseSure',//弹框确认按钮的选择器
			saveResultBox:'.sendArea',//点确定后存放选择结果的容器的选择器
			atLeastOne:false,//是否需要至少选择一个部门或成员, 默认为false
			atLeastWord:'全公司',//当可以不选择部门或成员时, 结果框里显示的文字或元素
			chooseDepart:true,//是否选择部门
			choosePerson:true//是否选择人员
		})
	});
	$("#myModal-adjustDepartment").delegate(".attendanceChooseSure","click",function(){
		reloadData();
	})
	/* 是否禁用启用的选择 */
	$("#attendanceTypeId").change(function(){
		reloadData();
	})
	function reloadData(){
		pushData();
		//清空之前的表格重新渲染
		$(".attendance-datagrid").remove();
		$(".yk_rightcontent .base-extend .listBackBox").append('<div class="col-xs-12 attendance-datagrid businessTable" style="padding:0.1rem 0.2rem 0 0.2rem;float:none;"><table id="attendanceList"></table> <div id="attendanceListPage"></div></div>');
		loadGrid(colname,model,$(".startdate_input").val(),$(".enddate_input").val());
	}
	function pushData(){
		//数据初始化
		colname.length=35;
		model.length=35;
		groupheader.length=4;
		//获取选择的日期重新循环
		var startdate=$(".startdate_input").val();
		var enddate=$(".enddate_input").val();//后期完成成员的选择后加在后面
		var sdate=new Date(startdate.replace(/-/,"/"));
		var ndate=new Date(enddate.replace(/-/,"/"));
		var day=ndate.getDate();
		for(var i=1;sdate<=ndate;i++){
			/* var index = i-1; */
			var time = getStandardDate(sdate);
			colname.push(time);
			var detailDay='attendanceVo.day'+time;
			var onedate={name:detailDay,label:'具体日期',index:detailDay,width: 120,title:false,formatter:operationFontFormatter};
			model.push(onedate);
			sdate.setDate(sdate.getDate()+1);
		}
	}
	function getDateTime(today){
		var date=new Date(getCurrentDayTime());
		var year=date.getFullYear();
		var month=date.getMonth()+1;
		var day='01';
		if(month<10){
			month='0'+month;
		}
		if(today){
			day=date.getDate();
			if(day<10){
				day='0'+day;
			}
		}
		return year+'-'+month+'-'+day
	}
	function getStandardDate(date){
		var y=date.getFullYear().toString();
		var m=date.getMonth()+1;
		var d=date.getDate();
		m<10?m="0"+m:m=m.toString();
		d<10?d="0"+d:d=d.toString();
		return y+m+d;
	}
	function getMyDay(date){
		var week;
		if(date.getDay()==0) week="日"
		if(date.getDay()==1) week="一"
		if(date.getDay()==2) week="二"
		if(date.getDay()==3) week="三"
		if(date.getDay()==4) week="四"
		if(date.getDay()==5) week="五"
		if(date.getDay()==6) week="六"
		return week;
	}
	function getDateString(str){
		var array=[];
		array.push(str.substring(0,4));
		array.push(str.substring(4,6));
		array.push(str.substring(6,8));
		return array.join("/");
	}
	
	//刷新
	$('#refresh').click(function(){
		orgIdList.length=0;userIdList.length=0;
		$(".sendArea").html("全公司");
		$("#myModal-adjustDepartment .yk_check_main").empty();
		$(".startdate_input").val(null);
		$(".enddate_input").val(null);
		var start=getDateTime();
		$(".startdate_input").val(start);
		var today=getDateTime('today');
		$(".enddate_input").val(today);
		$('.date-start-choice').datetimepicker('setEndDate', today);
		$('.date-end-choice').datetimepicker('setStartDate', start);
		$("#attendanceTypeId option").prop("selected",false);
		$("#attendanceTypeId option[value='1']").prop("selected",true);
		reloadData();
	});
	
	//导入的时候，请参考"长安银科资产管理有限公司_考勤报表_20180201-20180228模版.xlsx"模版，此模版能正常导入
	$('#importExcel').click(function(e){
		$(".yk_content .base-extend").find('#myModal-importExcel').remove().end().append('<div class="modal fade businessDialog" id="myModal-importExcel" data-backdrop="static"><div class="modal-dialog" style="width:7rem"><div class="modal-header"><button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" style="font-size:0.18rem">×</span><span class="sr-only">关闭</span></button><span class="modal-title">Excel导入</span></div><div class="modal-content"></div><div class="modal-footer"><button type="button" class="btn btn-default btn-white btn-info closeImportExcelBtn" data-dismiss="modal">关闭</button><button type="button" class="btn btn-primary btn-white btn-info colorbtn importExcelBtn">导入</button></div></div></div>');
		$("#myModal-importExcel").modal('show');
		$("#myModal-importExcel .modal-content").load('/excelData/import?moduleName='+'attendance'+'&template='+'attendance');
		$("#myModal-importExcel .importExcelBtn").click(function(){
			$('#importForm').submit(); 
			$("#myModal-updateUserInfo").modal('show');
		})
		$("#myModal-importExcel .closeImportExcelBtn").click(function(){
			$('#importForm').resetForm();
			$("#myModal-importExcel").modal('hide');
		})
		$("#myModal-importExcel .close").click(function(){
			$('#importForm').resetForm();
			$("#myModal-importExcel").modal('hide');
		})
	});
	function getParameter(){
		var postdata='';
		var start=$(".startdate_input").val();
		var end=$(".enddate_input").val();
		var orgId='';var userId='';
		orgIdList.length=0;userIdList.length=0;
		var i=0;j=0;
		$(".attendanceSelect .chooseDepartOrPersonSpan").each(function(){
			var type=$(this).attr("type");
			if(type.indexOf("icon-folder-close")!=-1){
				orgId+='&orgIdList['+i+']='+$(this).attr("dataid");
				i++
			}else if(type.indexOf("icon-user")!=-1){
				userId+='&userIdList['+j+']='+$(this).attr("dataid")
				j++
			}
		})
		postdata='startTime='+start+'&endTime='+end+orgId+userId;
		postdata+='&userState='+$("#attendanceTypeId").val()
		return postdata;
	}
	/* 导出报表 */
	$('#exportAttendanceCsv').click(function () {
		var postdata=getParameter();
		$(this).parent().find(".exportCsv").attr("href",'/attendanceManagement/exportForCsv?'+postdata);
		$(this).parent().find(".exportCsv").get(0).click();
	});
	/* 导出CSV */
	$('#exportAttendanceExcel').click(function () {
		var postdata=getParameter();
		$(this).parent().find(".exportExcel").attr("href",'/attendanceManagement/exportForExcel?'+postdata);
		$(this).parent().find(".exportExcel").get(0).click();
	});
	$(".attendance-datagrid").delegate("table tr td","mouseenter",function(){
		var id;
		if($(this).parent().parent().parent().attr("id")=='attendanceList'){
			id=$(this).parent().attr("id");
		}else if($(this).parent().parent().parent().attr("id")=='attendanceList_frozen'){
			id=$(this).parent().attr("id");
		}
		$("#attendanceList_frozen").find("tr[id='"+id+"']").css("backgroundColor","#f0f9ff");
		$("#attendanceList").find("tr[id='"+id+"']").css("backgroundColor","#f0f9ff");
	})
	$(".attendance-datagrid").delegate("table tr td","mouseleave",function(){
		var id;
		if($(this).parent().parent().parent().attr("id")=='attendanceList'){
			id=$(this).parent().attr("id");
		}else if($(this).parent().parent().parent().attr("id")=='attendanceList_frozen'){
			id=$(this).parent().attr("id");
		}
		$("#attendanceList_frozen").find("tr[id='"+id+"']").css("backgroundColor","");
		$("#attendanceList").find("tr[id='"+id+"']").css("backgroundColor","");
	})
})