
var oImg 
function fiximgwin(url,w,h){ 
 if(arguments.length==1){       //如果图像大小未定义 
    oImg=new Image()            //创建图像对象 
    oImg.src=url                //设置图像源 
    Size(url)                   //调用Size函数获取图像尺寸 
 } 
//如果已取得图像尺寸，打开固定大小的窗口 
 //else window.open(url,"","width="+w+",height="+h) showModelessDialog
 else

openwindow=window.showModelessDialog(url,"Img","dialogWidth:"+w+"px;dialogHeight:"+h+"px;center: Yes; status: No;") 
openwindow.document.write("<html>") 
openwindow.document.write("<head>") 
openwindow.document.write("<title>Item...</title>") 
//openwindow.document.write("<script language='JavaScript' src='../Script/CloseWindow.js'></script->") 
openwindow.document.write("</head>") 
//openwindow.document.write("<body bgcolor=#ffffff  onload='resize()' onclick='cls();' style='cursor:hand'>") 
openwindow.document.write("<base target='_self'>") 
openwindow.document.write("<a href='javascript:window.close()'><img src="+url+" width="+oImg.width+" height="+oImg.height+" border='0' alt='Close this window!'></a>") 
openwindow.document.write("</body>") 
openwindow.document.write("</html>") 
openwindow.document.close()

} 
function Size(url){ 
 if(oImg.width&&oImg.height)       //如果已取得图像尺寸 
//将图像尺寸加上一定尺寸后返回给fiximgwin()函数， 
//其中18和25的表现见下图右下角所示 
fiximgwin(url,oImg.width+6,oImg.height+25)   
 else setTimeout("Size(url)",10) 
}



