function autoSizeImg(Contents,offsetWidth,offsetHeight,vlmiddle){
var o=Contents.getElementsByTagName("IMG");
var cwidth= window.getComputedStyle?window.getComputedStyle(Contents,null).width:Contents.currentStyle["width"];
var cheight=window.getComputedStyle?window.getComputedStyle(Contents,null).height:Contents.currentStyle["height"];
var ncwidth=parseInt(cwidth);
var ncheight=parseInt(cheight);

for(var i=0;i<o.length;i++){
var img=o[i];
var iw=img.width;
var ih=img.height;


 var   s1   =   ncwidth/ncheight;   
 var   s2   =   iw/ih;   
      if(s1>s2)   {img.height=ih>ncheight?ncheight:ih;img.width=img.height*(s2);if(img.width>ncwidth) img.width=ncwidth;}  
      else     {img.width=iw>ncwidth?ncwidth:iw;img.height=img.width/s2;if(img.height>ncheight) img.height=ncheight; }


if(vlmiddle==true) img.style.marginTop=((ncheight-img.height)/2)+"px";




}

}



<!-- 
//图片按比例缩放 

function changeImg(ImgD,iwidth,iheight,offsetmiddle){ 
 var image=new Image(); 
// var iwidth = 200;  //定义允许图片宽度 
// var iheight =200;  //定义允许图片高度 
 image.src=ImgD.src; 
 if(image.width>0 && image.height>0){ 
 if(image.width/image.height>= iwidth/iheight){ 
  if(image.width>iwidth){   
  ImgD.width=iwidth; 
  ImgD.height=(image.height*iwidth)/image.width; 
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
//  ImgD.alt=image.width+"×"+image.height; 
  } 
 else{ 
  if(image.height>iheight){   
  ImgD.height=iheight; 
  ImgD.width=(image.width*iheight)/image.height;   
  }else{ 
  ImgD.width=image.width;   
  ImgD.height=image.height; 
  } 
//  ImgD.alt=image.width+"×"+image.height; 
  } 
 } 
 
 //if(ImgD.width>image.width) ImgD.width=image.width;
  //if(ImgD.height=image.height) ImgD.height=image.height;
 
 if(offsetmiddle==null) offsetmiddle=-1;
if(offsetmiddle!=-1) ImgD.style.marginTop=((iheight-ImgD.height)/2+offsetmiddle)+"px";
//else   ImgD.style.marginTop=((iheight-ImgD.height)/2)+"px";
}  
//--> 


function setTransition(){
if (document.all){
  document.getElementById("bannerADrotator").filters.revealTrans.Transition=Math.floor(Math.random()*23);
  document.getElementById("bannerADrotator").filters.revealTrans.apply();
}
}

function playTransition(){
if (document.all)
  document.getElementById("bannerADrotator").filters.revealTrans.play();
}

function nextAd(){
setTransition();
playTransition();
theTimer=setTimeout("nextAd()", 6000);
}


function addBookmark(title,url) {
if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title,url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite(url,title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
}

