/*----------------------------------------------------------
  -- 目的： 打印任何内容
  -- 输入： s 需要打印的内容字符串
-----------------------------------------------------------*/ 
function printany(s) {
	if (s=="") return; 
	var sTitle=document.title;
	sTitle=sTitle.split("-");
	sTitle=sTitle[0];
	win=window.open("","_blank","left=50,top=50,height=500,width=780,menubar=no,status=0,titlebar=0,toolbar=0,scrollbars=1");
	win.document.clear();
	win.document.write("<title>"+sTitle+"</title>");
	win.document.write('<link rel="stylesheet" type="text/css" href="../css/print.css">');
	win.document.write('<object id="ieWeb" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>');
	win.document.write("<body bgcolor='white' onload="+'"'+"setTimeout('self.close()',10*1000)"+'">');
	win.document.write(s);
	win.document.write("</body>");
	win.document.close();
	//win.print();
	win.ieWeb.ExecWB(7,1);
}

/*----------------------------------------------------------
  -- 目的： 构建需要打印的内容
  -- 输入： s 需要打印的内容字符串,sC 标题
-----------------------------------------------------------*/ 
function printpg(s) {
	var sTitle=document.title;
	var argv = printpg.arguments;  
	var nArg = printpg.arguments.length;  
	var sC = (nArg >1) ? argv[1] : document.title.split("-")[0];  

	s=ContentArea.innerHTML;
	var re = new RegExp("></td>","gi");
	s=s.replace(re,">&nbsp;</td>");
	//去掉所有链接
	re = "/<a [^>]*>|<\x2fa>|[↑↓]<\x2fa>/ig";
	s=s.replace(re,"");
	re=new RegExp("cellSpacing=1","gi");
	s=s.replace(re,"cellspacing=0");
	sTitle='<table align="center" width="95%"><tr><td>'+ sTitle
			+'</td><td  align="right">http://'+window.location.hostname+'</td></tr>';
	sTitle+='<tr><td colspan="2"><hr size="1"></td></tr></table>' ;
	var sStr='<table align="center" width="90%" border="0" align="center">'
			 +'<tr><td>'
		 	 +s
		  	 +"</td></tr></table>";
	sStr=sTitle+'<br><P align="center"><font size="+1">'+sC+'</font></p>' + sStr;
	printany(sStr);
}

/*----------------------------------------------------------
  -- 目的：打印当前页面
  -- 输入：
  -- 返回： 
  -- 日期：2002-11-27
  -- 编码：Qingze Cheng  
  -- 版权：云因信息（YunYin.com）
  -- 修改：
-----------------------------------------------------------*/ 
function printcd() {
	var sTitle=document.title;
	var sC = document.title.split("-")[0];
	var s = ContentArea.innerHTML;
	var re = new RegExp("></td>","gi");
	s=s.replace(re,">&nbsp;</td>");
	re = new RegExp("<a [^>]*>|<\x2fa>","gi");
	s=s.replace(re,"");
	re=new RegExp("cellSpacing=1","gi");
	s=s.replace(re,"cellspacing=0");

	win=window.open("","_blank","left=50,top=50,height=500,width=780,menubar=no,status=0,titlebar=0,toolbar=0,scrollbars=1");
	
	var sStr='<table align="center" width="95%" class="tblTitle"><tr><td>'+ sTitle
		  +'</td><td  align="right">http://'+window.location.hostname+'</td></tr>';
	   sStr+='<tr><td colspan="2"><hr size="1"></td></tr></table>' ;
	//sStr+='<center align="center"><font size="+1">'+sC+'</font></center>'+s;
	sStr+=s;
	win.document.clear();
	win.document.write("<title>"+sTitle+"</title>");
	win.document.write('<link rel="stylesheet" type="text/css" href="../css/print.css">');
	win.document.write('<object id="ieWeb" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>');
	win.document.write("<body bgcolor='white' onload="+'"'+"setTimeout('self.close()',20*1000)"+'">');
	win.document.write(sStr);
	win.document.write("</body>");
	win.document.close();
	win.ieWeb.ExecWB(7,1);
}
/*----------------------------------------------------------
  -- 目的：自定义打印
  -- 输入：frm 表单,s 配置参数
  -- 日期：2002-11-25
  -- 编码：Qingze Cheng  
  -- 版权：云因信息（YunYin.com）
  -- 修改：2003-05-20
-----------------------------------------------------------*/ 
function printc(frm,s) {
	if (s=="") return;
	var sUo=frm.action;
	//取得调用此函数的程序的地址，来自出版社还是经销商
	sPath=window.location.pathname;
	sPathArr=sPath.split("/");
	frm.action="../print/print.cfm?sRscFile=../"+sPathArr[1]+"/"+s;
	frm.target="printset";
	var sAttr="left=100,top=90,width=500,height=470,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1";
	newWin= window.open("","printset",sAttr);
	//alert(frm.action);
	frm.submit();
	newWin.focus();
	frm.action=sUo;
	frm.target="_self";
}

/*----------------------------------------------------------
  -- 目的：导出数据
  -- 输入：frm 表单,s 配置参数
-----------------------------------------------------------*/ 
function expdatat(frm,s) {
	if (s=="") return;
	printc(frm,s+"&sUway=E");	
}

/*----------------------------------------------------------
  -- 目的：导出数据-详细
  -- 输入：
-----------------------------------------------------------*/ 
function expdata(frm) {
	var argv = expdata.arguments;  
	var nArg = expdata.arguments.length;  
	//如果没有传参数，则会取最后一个form.
	if (nArg ==0 ) frm=document.forms[document.forms.length-1];
	frm.sExpData.value=ContentArea.innerHTML;
	frm.submit();
}


/*----------------------------------------------------------
  -- 目的：导出数据-详细.
  -- 输入：s 格式,sF-文件名称 
-----------------------------------------------------------*/ 
function expdoc(frm,s,sF){
	//if (s=="") return;
	var argv = expdoc.arguments;  
	var nArg = expdoc.arguments.length;  
	//2006.8.31,chenjia,如果输入3个参数,则按参数值导出.
	if (nArg==3) {
		frm=argv[0];
		s=argv[1];
		sF=argv[2];
	} else if (nArg==2) {
		frm=document.forms[document.forms.length-1];
		s=argv[0];
		sF=argv[1];
	} else {
		frm=document.forms[document.forms.length-1];
		sF=document.title;
		s="word";	
	}
	// sF=encodeURIComponent(sF);
	var sUo=frm.action;
	frm.sExpData.value=ContentArea.innerHTML;
	frm.action="expdata.cfm?PopUse=1&sFile="+sF+"&sFormat="+s;
	frm.submit();
	frm.action=sUo;
}

/*----------------------------------------------------------
  -- 目的： 发送页面内容
  -- 输入： s 类型
  -- 修改:pipw,2003-08-06,增加发送类型"P"
-----------------------------------------------------------*/ 
function send(s) {
	var argv = send.arguments;  
	var nArg = argv.length;  
	var sC=document.title.split("-")[0];
	var s = (nArg >0) ? argv[0] : ""; 
	var sPg="sendinfo.cfm?";
	var sH="left=100,top=100,width=660,height=470";
	if (s=="D") {
		sPg="mailsend.cfm?iHTML=1&";
		sH="left=100,top=100,width=620,height=500";
	}
	if (s=="P") {
		sPg="sendinfop.cfm?";
	}
	// sC=encodeURIComponent("发送信息-"+sC);
	sC="发送信息-"+sC;
	winSend = window.open(sPg+ "PopUse=1&sSubject="+sC, "_blank", sH+",toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0"); 
	winSend.focus();
}

/*----------------------------------------------------------
  -- 目的： 自定义打印
  -- 输入： s 参数
-----------------------------------------------------------*/ 
function printcdf(s) {
	if (s=="") return;
	var sAttr="left=100,top=100,width=750,height=500,toolbar=0,location=0,directories=0,status=0,menuBar=1,scrollBars=1,resizable=1";
	prWin = window.open("../print/printcd.cfm?"+s,"_blank",sAttr);
	prWin.focus();
}

/*----------------------------------------------------------
  -- 目的： 发送消息
  -- 输入： s 参数
-----------------------------------------------------------*/ 

function sendbook(s) {
	newWindow = window.open("sendinfo.cfm?sSubject="+s+"&PopUse=1","_blank","left=100,top=100,width=600,height=400,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=0,resizable=0"); 
	newWindow.focus();
}
/*---------------------------------------------------------------------------
  目的：输出内容到指定设备
  说明：
  输入：sD 输出设备名称 
  返回：
---------------------------------------------------------------------------*/ 
function prtRpt(frm,sD){
	var sUo=frm.action;
	sUo2=sUo.replace("?","&");
	
	frm.action="print2dev.cfm?sPrg="+sUo2+"&sOutPut2Dev="+sD+"&sFile="+document.title.split("-")[0]+"&PopUse=1"; 
	if (sD=="print") {
		frm.target="rptWin"; 
		var sAttr="left=50,top=50,width=800,height=600,toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollBars=1,resizable=1";
		rptWin= window.open("","rptWin",sAttr);
	}
	frm.submit();
	frm.action=sUo; 
	frm.target="_self"; 
}


