﻿function closewin()
{
	parent.window.opener=null;
	parent.window.open('','_self');
	parent.window.close();
}
function backwin()
{
	window.history.back();
}
function requireValue(propertyStr)
{
	var valueArray=new Array();
	if (trim(propertyStr)=="")
	{
		return true;
	}
	else
	{
		valueArray=propertyStr.split(',');

		if (valueArray.length>0)
		{
			for(i=0;i<valueArray.length;i++)
			{
				var obj=eval("document.thisForm."+valueArray[i]);
				if (trim(obj.value)=="")
				{
					alert("请填写！");
					obj.style.backgroundColor="#FF99CC";
					obj.focus();
					return false;
				}
				else
				{
					obj.style.backgroundColor="#FFFFFF";
				}
			}
		}
	}
	return true;
}
function trim(str) 
{
  return str.replace(/(^\s*)|(\s*$)/g,"");
}
function calendar(obj)
{
	//window.open("/backadmin/inc/Calendar.asp?objname="+objname,"Calendar","status=0,toolbar=0,menubar=0,resizable=0,scrollbars=0,width=300,height=168,top=170,left=290");
	//window.showModalDialog("/backadmin/inc/Calendar.asp?objname="+objname,'Calendar','dialogHeight:160px;dialogWidth:300px;dialogTop:300px; dialogLeft:500px;center:yes;scroll:no;status:no;resizable:no;edge:raised;help:no;unadorned:yes');
	var objwin=window.showModalDialog('/backadmin/inc/Calendar.asp','Calendar','dialogHeight:160px;dialogWidth:300px;dialogTop:300px; dialogLeft:500px;center:yes;scroll:no;status:no;resizable:no;edge:raised;help:no;unadorned:yes');
	try
	{
		if(typeof(objwin)=="undefined") 
		{
		  return;
		 }
		else
		{
			obj.value=objwin;
		}
	
	}catch(e){return;}

	  
		
		
}
function selectvalue(modulename,depth,selfobj,childorparentobj)
{
//<input type="button" class="selectbutton" name="selectvaluebutton" id="selectvaluebutton" value="▼" onclick="selectvalue('pubkecheng',2,thisForm.lb1,thisForm.lb);">
	var selfobjvalue=selfobj.value;
	var parentobjvalue=childorparentobj.value;
	//alert(parentobjvalue);
	var objwin=window.showModalDialog('/backadmin/inc/selectvalue.asp?modulename='+modulename+'&depth='+depth+'&selfobjvalue='+selfobjvalue+'&parentobjvalue='+parentobjvalue,'selectvalue','dialogHeight:180px;dialogWidth:260px;dialogTop:300px; dialogLeft:500px;center:yes;scroll:auto;status:no;resizable:no;edge:raised;help:no;unadorned:yes');
	try
	{
		if(typeof(objwin)=="undefined") 
		{
		  return;
		 }
		else
		{
			selfobj.value=objwin;
			if ((objwin!=selfobjvalue) && (depth==1))
			{
				childorparentobj.value="";
			}
			 
		}
	
	}catch(e){return;}
}
function checkuploadfile(path,filename)
{
	var webaddress="http://www.bomo.com.cn";
	window.open(path+filename);
}
function WebGoPage(pagenum,pagename)
{
 	document.thisForm.page.selectedIndex=pagenum-1
	document.thisForm.action=pagename;
	document.thisForm.target='_self'; 
	document.thisForm.submit ();
}
function newWinInfo(moduleName,MainType,MainID,submitTarget,openlocalFlag)
	{
		//有个问题，如果功能的submitTarget变更了，则要取修改相应的程序。
		//moduleName：是数据主体， 
		//onclick="newWinInfo(''Customer'',''modify'','''+Customer.ID+''',''/CustomerInfo.do'',''open'');" 
		/*
			xsl调用方法
			<a style="cursor:pointer">
				<xsl:attribute name="onClick">
					javaScript:newWinInfo("Customer","view","<xsl:value-of select="./@CusID" />","/CustomerInfo.do","open");
				</xsl:attribute>
				<font color="blue">
				<xsl:value-of select="./@CusName" />
				 </font>
			</a>
		*/
	 
		
		if (trim(moduleName)==""){alert("moduleName为空，要传入数据表名称，请检查！");return false;} 
		else if (trim(MainType)==""){alert("MainType为空，请检查！");return false;}
		else if (trim(MainID)==""){alert("MainID为空，请检查！");	return false;}
		else if (trim(submitTarget)==""){alert("submitTarget为空，请检查！");return false;}
		else if (trim(openlocalFlag)==""){alert("openlocalFlag为空，请检查！");return false;}
		
		var BackupMainType=document.thisForm.MainType.value;
		document.thisForm.MainType.value=trim(MainType);
		document.thisForm.MainID.value=trim(MainID);
		
		if (trim(openlocalFlag)=="open")
		{
			document.thisForm.target="_blank";
			document.thisForm.action=submitTarget;
			document.thisForm.submit();
			document.thisForm.MainType.value=BackupMainType;
			return true;
		}
		else if (trim(openlocalFlag)=="local")
		{
			document.thisForm.target="_self";
			document.thisForm.action=submitTarget;
			document.thisForm.submit();
			document.thisForm.MainType.value=BackupMainType;
			return true;
			 
		}
		else{alert("openlocalFlag的值不是open或local，请检查！");return false;}
	}
	function GoList(MainType,PageName)
	{
		//document.thisForm.submitFlag.value='';
		document.thisForm.MainType.value=trim(MainType);
		document.thisForm.target='_self'; 
		document.thisForm.action=PageName;
		
		document.thisForm.submit ();
		
	}
	
	function GoList2(MainType,PageName)
	{
		document.thisForm.submitFlag.value='';
		document.thisForm.MainType.value=trim(MainType);
		document.thisForm.target='_self'; 
		document.thisForm.action=PageName;
		
		document.thisForm.submit ();
		
	}
	function GoSearch(submitFlag,MainType,PageName)
	{
		 
		document.thisForm.submitFlag.value=trim(submitFlag);
		document.thisForm.MainType.value=trim(MainType);
		document.thisForm.action=PageName;
		document.thisForm.target='_self'; 
		document.thisForm.submit ();
		
	}
	function infoWin(ID,submitFlag,submitAction,submitTarget,datamode,modulename,parameter1,parameter2)
	{
		//onclick="infoWin('9','modify','pubkechenginfo.asp','_blank','1','pubkecheng','parameter1','parameter2');"
		//datamode 0 donothing, 1 getdata ,2savedate
		document.thisForm.ID.value=ID;
		document.thisForm.submitFlag.value=submitFlag;
		document.thisForm.target=submitTarget;
		if (datamode=="2")
		{
			if (!confirm("操作后，数据无法恢复，您确认操作吗？"))
			{
				return false;
			}
		}
		document.thisForm.datamode.value=datamode;
		document.thisForm.action=submitAction;
		document.thisForm.submit();
		document.thisForm.datamode.value="0";
		return true;
		 
	}
	 
