function outputEmpty(width,height,bgcolor,pos)
{
width=parseInt(width);
height=parseInt(height);
document.write("<table width="+width+" height="+height+" cellpadding=0 cellspacing=0 border=0 align="+pos+"  bgcolor="+bgcolor+">");
document.write("<tr><td  width='100%' height='100%'></td></tr>");
document.write("</table>");
}



function outputBgImg(width,height,bgImg,pos)
{
width=parseInt(width);
height=parseInt(height);
document.write("<table width="+width+" height="+height+" cellpadding=0 cellspacing=0 border=0 align="+pos+" background=images/"+bgImg+">");
document.write("<tr><td  width='100%' height='100%'></td></tr>");
document.write("</table>");
}



function turn1(x)
{
x.className='have';
}
function turn2(x)
{
x.className='noHave';
}

function turn3(x)
{
x.className='turn3_have';
}
function turn4(x)
{
x.className='turn4_noHave';
}


function displaySub(d1,sub)
{
leftop=0;
topop=0;
topop+=d1.offsetHeight;
while(d1!=null)
{
leftop+=d1.offsetLeft;
topop+=d1.offsetTop;
d1=d1.offsetParent;
}
sub.style.visibility="visible"
sub.style.pixelLeft=leftop;
sub.style.pixelTop=topop;
}

function hiddenSub(sub)
{
sub.style.visibility="hidden";
}

function turn1(x)
{
x.className='have';
}
function turn2(x)
{
x.className='noHave';
}



function newimg(imgurl) { 
newwin=window.open('about:blank','','width=10,height=10,left=150,top=150,status=yes'); //先新打开一个小窗口
newwin.document.open();
newwin.document.write('<html><title></title>'); //把窗口的大小调整到与图片一样大。
newwin.document.write('<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" onBlur="self.close()">'); 
newwin.document.write('<a href="####"><img id=img1 src='+imgurl+' alt="点击关闭窗口"'); 
newwin.document.write(' onClick="window.close()"'); 
newwin.document.write(' onload="self.resizeTo(this.offsetWidth+10,this.offsetHeight+49);" border="0"></a>'); 
newwin.document.write('</body></html>');
newwin.document.close();
newwin.focus();
}

/*调用的实例
<td width="100" height="100" align="center" bgcolor="#FFFFFF">
	<a href="####">
		<img src="honor/dPB11.JPG" onload="javascript:DrawImage(this,100,100);" border="0" onClick="newimg('honor/dsy/dPB11.JPG')"></a>
</td>

*/
var flag=false;
function DrawImage(ImgD,FitWidth,FitHeight)
{
	var image=new Image();
  	image.src=ImgD.src;
   	if(image.width>0 && image.height>0)
		{
    			flag=true;
    			if(image.width/image.height>= FitWidth/FitHeight)
				{
     					if(image.width>FitWidth)
						{  
     							ImgD.width=FitWidth;
     							ImgD.height=(image.height*FitWidth)/image.width;
     						}
					else
						{
     							ImgD.width=image.width;  
     							ImgD.height=image.height;
     						}
     					//ImgD.alt="点击图片放大("+image.width+"×"+image.height+")";
     				}
    			else
				{
     					if(image.height>FitHeight)
						{  
     							ImgD.height=FitHeight;
     							ImgD.width=(image.width*FitHeight)/image.height;     
     						}
					else
						{
     							ImgD.width=image.width;  
     							ImgD.height=image.height;
     						}
     					//ImgD.alt="点击图片放大("+image.width+"×"+image.height+")";
     				}
   		 }
}










