




//分页提交
function pageSubmit(theForm,action) {
    theForm.elements["pageHelper.action"].value = action;
	theForm.action.value="query";
    theForm.submit();
}
function pageSubmitsmrt(theForm,action) {
    theForm.elements["pageHelper.action"].value = action;
	theForm.action.value="detail_1_id";
    theForm.submit();
}

function pageSubmitpsat(theForm,action) {
    theForm.elements["pageHelper2.action"].value = action;
	theForm.action.value="psatquery";
    theForm.submit();
}
function pageSubmitmeif(theForm,action) {
    theForm.elements["pageHelper1.action"].value = action;
	theForm.action.value="query";
    theForm.submit();
}
//根据form.action分页提交
function pageQuery(theForm,action,method) {
    theForm.elements["pageHelper.action"].value = action;
	theForm.action.value=method;
    theForm.submit();
}

//全选框处理
function allselect(theForm){
	if (typeof(theForm.choice)!="undefined")
		{
			if(theForm.all.checked)
			{
				if(theForm.choice[0]==null) theForm.choice.checked = true;
				for(var i=0; theForm.choice[i]!=null; i++){
					theForm.choice[i].checked = true;
			}
		}
	else {
			if(theForm.choice[0]==null) theForm.choice.checked = false;
			for(var i=0; theForm.choice[i]!=null; i++)
			{
				theForm.choice[i].checked = false;
			}
		}
	}
}

//判断是否选择了一项
function CheckOptions(theForm)
{
	if(theForm.choice==null) return false;

	if(theForm.choice[0]==null)
	{
		return theForm.choice.checked;
	}

	for(var i=0; theForm.choice[i]!=null; i++)
	{
		if(theForm.choice[i].checked)
			return true;
	}
	return false;
}

//用于授权
function au(theForm){
	    var a = window.showModalDialog("/CHDBPS/common/authentic.jsp", "授权","dialogHeight:200px;dialogWidth:200px;help:no;status:no;");
		if (typeof (a) != "undefined")
		{
			theForm.acctno.value = a[0];
			theForm.acctpw.value = a[1];
			return true;
		}
		else{
			theForm.action.value="query";
			return false;
		}
}

//用于多项功能操作,参数为（form,action,是否验证form,是否有多项数据,是否需要授权）
function exec_op(theForm,action,va_flag,mu_flag,au_flag)
{
	theForm.action.value = action;

	if(va_flag){
		if(!validateForm(theForm)){
			return false;
		}
	}
	
	if(mu_flag){
		if(!CheckOptions(theForm))
		{
			alert("请至少选择一项要操作的数据！");
			return false;
		}
	}
	
	if(au_flag){
		return au(theForm);
	} 
	
	return true;
}
//用于提示
function ny(){
     return confirm("确定该业务操作吗？");
}
//用于提示
function link_dl_confirm(action,parm1,parm11,parm2,parm22){
     if(confirm("确定吗？"))
	 {
		window.location.href="/"+action+"?"+parm1+"="+parm11+"&"+parm2+"="+parm22;
	 }
	 else
	 {
	 }
}
//用于多项功能操作,参数为（form,action,是否验证form,是否有多项数据,是否需要授权）
function exec_op(theForm,action,va_flag,mu_flag,au_flag,ny_flag)
{
	theForm.action.value = action;

	if(va_flag){
		if(!validateForm(theForm)){
			return false;
		}
	}
	
	if(mu_flag){
		if(!CheckOptions(theForm))
		{
			alert("请至少选择一项要操作的数据！");
			return false;
		}
	}
	
	if(au_flag){
		return au(theForm);
	} 
	if(ny_flag){
		return ny(theForm);
	} 
	return true;
}


//用于多项功能操作,参数为（form,action,是否验证form,是否有多项数据,是否需要授权）
function exec_op(theForm,action,va_flag,mu_flag,au_flag,ny_flag,op_flag)
{
	theForm.action.value = action;

	if(va_flag){
		if(!validateForm(theForm)){
			return false;
		}
	}
	
	if(mu_flag){
		if(!CheckOptions(theForm))
		{
			alert("请至少选择一项要操作的数据！");
			return false;
		}
	}
	
	if(au_flag){
		return au(theForm);
	} 
	if(ny_flag){
		return ny(theForm);
	}
	if(op_flag){
		var aa=window.open('','b','top=250,left=350,height=300,width=500,resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no');
		theForm.target=b;
		theForm.submit();
	} 
	return true;
}


//分页提交
function pageSubmits(theForm,action) {

    theForm.elements["pageHelper.action"].value = action;
	theForm.action.value="querys";
    theForm.submit();
}

//4>=
//5<=
function compareDate(date1,date2,logic){
	switch(logic){
		case 1:
			return (date1 > date2);
			break;
		case 2:
			return (date1 == date2);
			break;
		case 3:
			return (date1 < date2);
			break;
		case 4:
			return (date1 >= date2);
			break;
		case 5:
			return (date1 <= date2);
			break;
		default:
			return false;
	}
}


//function compareDate(date1,date2,logic){
//	switch(logic){
//		case 1:
//			return (date1 > date2);
//			break;
//		case 2:
//			return (date1 == date2);
//			break;
//		case 3:
//			return (date1 < date2);
//			break;
//		default:
//			return false;
//	}
//}

function SelectTime(obj, hasTime) {
	if (!obj) return false;
	if (typeof (obj.value) != "string") return false;
	var date = obj.value;
	var thisDate = window.showModalDialog("/CHDBPS/js/calendar/calendar.htm", new Array(date, hasTime),"dialogHeight:260px;dialogWidth:280px;help:no;status:no;");
	if (typeof (thisDate) != "undefined") obj.value = thisDate.toString();
}


