// JavaScript Document
  function   doPrintSetup(){    
  document.write("<object   classid=clsid:8856F961-340A-11D0-A96B-00C04FD705A2   height=0   id=WB   width=0></object>");   
  WB.ExecWB(8,1)    
  } 
var prints;
function isok(file)
{ 
if(window.XMLHttpRequest)
{xmlhttp=new XMLHttpRequest();
 if(xmlhttp.overrideMimeType)xmlhttp.overrideMimeType('text/xml')
 }
else if(window.ActiveXObject)
{try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}//测试是否IE
   catch (e)
           {
		     try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}//是否IE5.5
				 catch(e2)
				 {
				 xmlhttp=false;
				 }
            }
 }
  xmlhttp.open("GET",file,false);
  xmlhttp.send(null);
  if(xmlhttp.readyState==4)
  {  
  if(xmlhttp.status==200)
    {   //url存在 
        prints='print.php';
    }
  else 
    {if(xmlhttp.status==404) prints='../print.php'; //url不存在   
     else prints='../print.php';//其他状态 
    } 
  } 
} 


function preview2() { 
isok('print.php');
bdhtml=window.document.body.innerHTML; 
sprnstr="<!--startprint-->"; 
eprnstr="<!--endprint-->"; 

prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); 
prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); 
prnhtml=prnhtml+"<br><p class='noprint'  align=center><input type='button' onclick='window.print();window.close();' value='开始打印'></p>";
showModalDialog(prints,window, 'dialogWidth:800px; dialogHeight:800px; status:0');
}
