//弹出窗口
function openwindow(url,width,height,name)
{
	window.open(url,name,"width="+width+",height="+height+",left="+(window.screen.width-width)/2+",top="+(window.screen.height-(height+50))/2+'",menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no');
}

//跳转菜单
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//弹出图片窗口
function fiximgwin(url)
{
 var imgwin=window.open('','img','width=1,height=1')//打开一个空白窗口，并初始化大小
 imgwin.focus()//使窗口聚焦，成为当前窗口
 var HTML="<html>\r\n<head>\r\n<title>图片浏览</title>\r\n</head>\r\n<body leftmargin=\"0\" topmargin=\"0\" style=\"margin:0;background-color:#buttonface;border: 1px double buttonface\">\r\n<div align=center><img src=\""+url+"\" onload=\"window.resizeTo(this.width+10,this.height+30);window.moveTo((screen.width-this.width)/2,(screen.height-this.height)/2)\"></div>\r\n</body>\r\n</html>"//这里是关键代码，在图片加载完后调用resizeTo()和moveTo()方法调整窗口大小和位置
 var doc=imgwin.document
 doc.open("text/html","replace") //指定文档的多用途网际邮件扩充协议
 doc.write(HTML)//向空白窗口写入代码
 doc.close()//关闭输入流，并强制发送数据显示。
}

//表单输入限制
function regInput(obj, reg, inputStr)
{
	var docSel	= document.selection.createRange()
	if (docSel.parentElement().tagName != "INPUT")	return false
	oSel = docSel.duplicate()
	oSel.text = ""
	var srcRange	= obj.createTextRange()
	oSel.setEndPoint("StartToStart", srcRange)
	var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
	return reg.test(str)
}

//导出到Excel
function preview() { 

window.clipboardData.setData("Text",document.all('table1').outerHTML);

try

{

var ExApp = new ActiveXObject("Excel.Application")

var ExWBk = ExApp.workbooks.add()

var ExWSh = ExWBk.worksheets(1)

ExApp.DisplayAlerts = false

ExApp.visible = true

}  

catch(e)

{

alert("对不起，要使用此功能必须将本站加入“受信任的站点”而且系统已经安装了Excel！")

return false

} 

 ExWBk.worksheets(1).Paste;	

 }

