var flag=false;

function DrawImage_sy_s(ImgD){

var image=new Image();
var iwidth = 120; //定义允许图片宽度
var iheight = 98; //定义允许图片高度
image.src=ImgD.src;
if(image.width>0 && image.height>0){
flag=true;
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;
}
}
} 
//调用：<img src="图片" onload="javascript:DrawImage_sy_s(this)">
//-->




//函数说明
//功能：显示随机轮显的广告图片
//参数  w ：宽度
//      h：高度
//		s_url： 图片地址字符串，多个使用英文逗号隔开
//		s_link：图片连接地址字符串，多个使用英文逗号隔开
//		s_second：轮显时间 单位 秒
function show_random_img(w,h,s_url,s_link,s_second)
{
document.write("<iframe width='"+w+"'height='"+h+"'scrolling='no' frameborder='0'src='/response_random_img.htm?w="+w+"&h="+h+"&s_url="+s_url+"&s_link="+s_link+"&s_second="+s_second+"'></iframe>");
}


