 //打开影像
   function openImage(flag){
	   //获取当前网址
       var curWwwPath = window.document.location.href;
       //获取主机地址之后的目录
       var pathName = window.document.location.pathname;
       var pos = curWwwPath.indexOf(pathName);
       //获取主机地址
       var localhostPath = curWwwPath.substring(0, pos);
	   
	   var caseSource = $("#caseSource").val();
	var claimNo = $("#claim-no").val();
	var iscommon= $("#isBpo").val();
	if(flag=="1"){//赔案影像
		if("1"==caseSource && iscommon=="Y"){
			callEcm(claimNo,"");
		}else{
			window.open(localhostPath+'/claimserver/inspection/clmtask/imageInfo.do?claimNo='+claimNo,"影像");
		}
	}
	if(flag=="2"){
		if("1"==caseSource){
			callEcm(claimNo,"2");
		}else{
			window.open(localhostPath+'/claimserver/inspection/clmtask/imageInfo.do?claimNo='+claimNo+'&flag=2',"保单影像");
		}
	}
 }
   
   
$(function(){
	if ($("#pageFrom").val() !='' && '' == $("#first").val()) {
		  $("#idd").hide();
		  $("#a").hide();
		  $("#first").val("1");
		  getHumanQuery();
		
	}else if('1' == $("#first").val()){
		 $("#idd").hide();
		 $("#a").hide();
	}
	
	
	
});





function queryClaimForPid(){
	var channelType = $("#channelType").val();
	var pid = $("#pid").val();
	
	if($("#pid").val() == $("#pid").attr("placeholder")){
		pid='';
	}
	
	
	if(pid ==null || pid ==""){
		alert("查询条件不能为空！");
		return false;
	}
//	if(checkIdentityCard(pid)){
//		
//		//document.forms["formId"].submit();	
//		SkipByPost("queryclmhistory.do",{pid:pid,channelType:channelType});
//	};
	
	SkipByPost("queryclmhistory.do",{pid:pid,channelType:channelType});	
}


function queryClaimForMany(){
	var channelType = $("#channelType").val();
	var endDateFrom = $("#endDateFrom").val();
	var endDateTo = $("#endDateTo").val();
	var pid1 = $("#pid1").val();
	var bussinessFlag = $("#bussinessFlag").val();
	var claimNo = $("#claimNo").val();
	var reportNo = $("#reportNo").val();
	var registerNo = $("#registerNo").val();
	
	if(pid1=='' && claimNo=='' && endDateFrom=='' && endDateTo =='' && reportNo==''&& registerNo==''){
		alert("外包状态需和其他状态组合查询！！");
		
	}else if( endDateFrom!='' && endDateTo ==''){
		
		 alert("请输入终止结案查询时间！！");
	}else if(endDateFrom =='' && endDateTo !=''){
		
		alert("请输入起始结案查询时间！！");
	}else if(claimNo!='' && claimNo.length!=15){
		alert("赔案号长度必须为15位");
		return false;
	}else if(reportNo!='' && registerNo!=''){
		alert("寿险报案号和产险立案号只能输入一个，请根据勾选险种正确输入！");
		return false;
	}else if(pid1!=''||claimNo.length==15||(endDateFrom !='' && endDateTo !='')||reportNo!=''||registerNo!=''||bussinessFlag!=''){
		
			//document.forms["formId2"].submit();	
		SkipByPost("clmhistoryAdvancedQuery.do",{pid1:pid1,claimNo:claimNo,endDateFrom:endDateFrom,endDateTo:endDateTo,channelType:channelType,reportNo:reportNo,registerNo:registerNo,bussinessFlag:bussinessFlag});
		
	}
}


function getHumanQuery(){
	//var channelType = $("#channelType2").val();
	/*$("#claimNo").val($("#claimNo05").val());*/
	$("#pid1").val($("#pid2").val());
	$("#channelType").val($("#channelType2").val());
	//var pid1 = $("#pid2").val();
	//SkipByPost("clmhistoryAdvancedQuery.do",{pid1:pid1,channelType:channelType});
	document.forms["formId2"].submit();	
	
}




function claimdetail(no,claimState,claimSubState){
	var channelType =null; 
	var pageFrom = $("#pageFrom").val();
	var searchPid = null;
	var searchClaimNo = null;
	var searchEndDateFrom = null;
	var searchEndDateTo = null;
	var searchReportNo = null;
	var searchRegisterNo = null;
	var searchPid05 = null;
	var searchClaimNo05 = null;
	if(pageFrom==''|| pageFrom==undefined){
		channelType = $("#channelType").val();
		searchPid = $("#searchPid").val();	
		searchClaimNo = $("#searchClaimNo").val();
		searchEndDateFrom = $("#searchEndDateFrom").val();
		searchEndDateTo = $("#searchEndDateTo").val();
		searchReportNo = $("#searchReportNo").val();
		searchRegisterNo = $("#searchRegisterNo").val();
	}else{
		channelType = $("#channelType2").val();
		searchPid05 = $("#pid").val();	
		searchClaimNo05 = $("#claimNo05").val();
	}
	
	
	SkipByPost("clmtaskdetailQuery.do",{claimNo:no,searchPid:searchPid,searchClaimNo:searchClaimNo,searchEndDateFrom:searchEndDateFrom,searchEndDateTo:searchEndDateTo,pageFrom:pageFrom,searchPid05:searchPid05,searchClaimNo05:searchClaimNo05,channelType:channelType,claimState:claimState,claimSubState:claimSubState,searchReportNo:searchReportNo,searchRegisterNo:searchRegisterNo});
}



function gohistory(){
	
	var params={};
	params['pageFrom']=$("#pageFrom").val();
	
	if($("#pageFrom").val()==''||$("#pageFrom").val()==undefined){
		params['channelType']=$("#channelType").val();
		params['pid1']=$("#searchPid").val();
		params['claimNo']=$("#searchClaimNo").val();
		params['endDateFrom']=$("#searchEndDateFrom").val();
		params['endDateTo']=$("#searchEndDateTo").val();
		params['reportNo']=$("#searchReportNo").val();
		params['registerNo']=$("#searchRegisterNo").val();
	}else{
		params['channelType']=$("#channelType2").val();
		params['pid1']=$("#searchPid05").val();
		params['first']='1';
		params['pid']=$("#searchPid05").val();
		params['claimNo05']=$("#searchClaimNo05").val();
	}
	
	
	
	
	SkipByPost("clmhistoryAdvancedQuery.do",params);
	
	
}




//回车查询
function enterQuery(){
	 var event = window.event||arguments.callee.caller.arguments[0];
	 if(event.keyCode==13){
		 queryClaimForPid();
	 }
}

//单选

$(".radio_yes,.radio_no").click(function(){ 
	  
	  if($(this).is(".radio_yes")){
	    
		$(this).removeClass("radio_yes");
		$(this).addClass("radio_no"); 
	  
	  }
	  
	  else{
			var obj=  $(".radio_yes");
			obj.removeClass("radio_yes");          
			obj.addClass("radio_no"); 
			$(this).removeClass("radio_no");
	        $(this).addClass("radio_yes");
	        $("#channelType").val($(this).attr("channelValue"));
	}
    
	  
});


function enterAdjustment(inputUrl,claimNos){
	var params = {};
	params["claimNo"] = claimNos;
	
	//AJAX提交
	 $.ajax({
		 type:"POST",
		 url: inputUrl,
		 dataType:"json",
		 contentType:"application/json",
		 data:JSON.stringify(params),	
		 error:function(){
			alert("理算详情页面展示失败！");
			 return;
		 },
		 success:function(data){
			 if (data.successFlag == 'Y') {
				var skipFlag = data.skipFlag;//1跳理算页面
				
				if (skipFlag == '1') {
					
					var claimNo = data.claimNo;
					var claimAuditTaskNo = data.claimAuditTaskNo;
					var claimState = data.claimState;
					var claimSource = data.claimSource;
					var taskType = data.taskType;
					var customerno = data.customerno;
					var regDate = data.regDate;
					
					params = {};
					params["claimNo"] = claimNo;
					params["claimAuditTaskNo"] = claimAuditTaskNo;
					params["claimState"] = claimState;
					params["claimSource"] = claimSource;
					params["taskType"] = taskType;
					params["customerno"] = customerno;
					params["regDate"] = regDate;
					
					//隐藏变量
					var channelType =null; 
					var pageFrom = $("#pageFrom").val();
					var searchPid = null;
					var searchClaimNo = null;
					var searchEndDateFrom = null;
					var searchEndDateTo = null;
					var searchReportNo = null;
					var searchRegisterNo = null;
					var searchPid05 = null;
					var searchClaimNo05 = null;
					if(pageFrom==''|| pageFrom==undefined){
						channelType = $("#channelType").val();
						searchPid = $("#searchPid").val();	
						searchClaimNo = $("#searchClaimNo").val();
						searchEndDateFrom = $("#searchEndDateFrom").val();
						searchEndDateTo = $("#searchEndDateTo").val();
						searchReportNo = $("#searchReportNo").val();
						searchRegisterNo = $("#searchRegisterNo").val();
					}else{
						channelType = $("#channelType2").val();
						searchPid05 = $("#pid").val();	
						searchClaimNo05 = $("#claimNo05").val();
					}
					
					params["channelType"] = channelType;
					params["searchPid"] = searchPid;
					params["searchClaimNo"] = searchClaimNo;
					params["searchEndDateFrom"] = searchEndDateFrom;
					params["searchEndDateTo"] = searchEndDateTo;
					params["searchReportNo"] = searchReportNo;
					params["searchRegisterNo"] = searchRegisterNo;
					params["searchPid05"] = searchPid05;
					params["searchClaimNo05"] = searchClaimNo05;
					
					
					
					//判断是否寿组合贴牌
					var lifeClaimStatus = $("#lifeClaimStatus").val();
					var caseSource = $("#caseSource").val();
					var lifeFLag = $("#lifeFLag").val();
					if(caseSource=='2'&&lifeFLag=='1'){
						params["lifeClaimStatus"] = lifeClaimStatus;
					}else{
						params["lifeClaimStatus"] = '0';
					}
					
					SkipByPost("/claimserver/adjustment/adjustmentInfo.do", params);
				}
			 } 
		 }
	 });
}