function DrawImage(ImgD,nW,nH){
   var image=new Image();
   image.src=ImgD.src;
   //if(image.readyState!="complete")return false;//确保图片完全加载
   if(image.width>0 && image.height>0){
    if(image.width/image.height>= nW/nH){
     if(image.width>nW){  
		 ImgD.width=nW;
		 ImgD.height=image.height/image.width*nW;
     }else{
		 ImgD.width=image.width;  
		 ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    else{
     if(image.height>nH){  
		 ImgD.height=nH;
		 ImgD.width=image.width/image.height*nH;     
     }else{
		 ImgD.width=image.width;  
		 ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    }
   else{
    ImgD.src="";
    ImgD.alt=""
    }
}

function SetImgAutoSize(img,MaxWidth,MaxHeight) 
{ 
 //var img=image;//获取图片
 //var MaxWidth=200;//设置图片宽度界限
 //var MaxHeight=100;//设置图片高度界限
 var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比
 var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比
 if(img.readyState!="complete")return false;//确保图片完全加载
 if(WidthHeight>=MaxWidth/MaxHeight){
	if(img.offsetWidth>MaxWidth){
	  img.width=MaxWidth;
	  img.height=MaxWidth*HeightWidth;
	}
 }
 else{
 	if(img.offsetHeight>MaxHeight){
	  img.height=MaxHeight;
	  img.width=MaxHeight*WidthHeight;
	 }
 }
}


function openerUrl(pageurl){
	if(top.opener){
		if(top.opener.opener){
		top.opener.opener.location=pageurl;	
		}else{
		top.opener.location=pageurl;
		}
	}else{
		top.location=pageurl;
	}
}