// JavaScript Document

//图片比例缩小
function DrawImage(thisp,w,h){
var a=new Image();   
a.src=thisp.src; 
if (a.width<w && a.height<h) {
thisp.width=a.width;/*使用原始图片大小*/ 
thisp.height=a.height;   
}else{
if(a.width/a.height>w/h){
   thisp.height=w*a.height/a.width; /*不对图片拉伸*/ 
   thisp.width=w;
}else{
   thisp.width=h*a.width/a.height; 
   thisp.height=h;
}
}
}


//广告图片向左滚动
function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
      scroll_div.scrollLeft-=scroll_begin.offsetWidth
    else
      scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}



