////前台相关脚本
function gid(id) {
    return document.getElementById(id);
}
		//循环滚动
//id:最外围的容器
//id1:当前内容容器
//id2:空容器,用于替换id1的
//d:滚动方向,horizontal:横向  vertical:纵向
//m:滚动参数
function ScrollImgLeft(id, id1, id2,d,m) {
    //滚动速度为20
    var speed = 30;
    //取得DOM对象中的ID
    var scroll_begin = gid(id1);
    var scroll_end = gid(id2);
    var scroll_div = gid(id);
    //scroll_begin的html代码复制到scroll_end中
    scroll_end.innerHTML = scroll_begin.innerHTML;

    //滚动函数
    function Marquee() {
        //scroll_div.scrollLeft初始为0，运行else，当scrollLeft>offsetWidth时，运行scroll_div.scrollLeft-=scroll_begin.offsetWidth，循环滚动。
        if (d = "horizontal") {
            if (scroll_end.offsetWidth - scroll_div.scrollLeft <= 0)
                scroll_div.scrollLeft -= scroll_begin.offsetWidth
            else
                scroll_div.scrollLeft++
        } 
        if (d = "vertical") {
            if (scroll_end.offsetHeight <= scroll_div.scrollTop)
                scroll_div.scrollTop -= scroll_begin.offsetHeight;
            else
                scroll_div.scrollTop++;
        }
    }
    m = setInterval(Marquee, speed)
    //onmouseover停止滚动
    scroll_div.onmouseover = function() { clearInterval(m) }
    //onmouseout继续滚动
    scroll_div.onmouseout = function() { m = setInterval(Marquee, speed) }
}

function WritePicture(id, pics, links, texts, w, h) {
    var text_height = 18
    var swf_height = h + text_height

    var htmlobj = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="' + w + '" height="' + swf_height + '"><param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/resource/image/playswf.swf"><param name=wmode value=transparent><param name="quality" value="high"><param name="menu" value="false"><param name=wmode value="opaque"><param name="FlashVars" value="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + w + '&borderheight=' + h + '&textheight=' + text_height + '"><embed src="/resource/image/playswf.swf" wmode="opaque" FlashVars="pics=' + pics + '&links=' + links + '&texts=' + texts + '&borderwidth=' + w + '&borderheight=' + h + '&textheight=' + text_height + '" menu="false" bgcolor="#DADADA" quality="high" width="' + w + '" height="' + swf_height + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';

    document.getElementById(id).innerHTML = htmlobj;
}
