﻿var nowIndex = 1;
var tt;
function change_img() {
    if (document.all) {
        $("#pic")[0].filters[0].Apply();
        $("#pic")[0].filters[0].Play(duration = 2);
    }
    $("#pic").attr("src", imgList[nowIndex]);
    $("#pic_url").attr("href", urlList[nowIndex]);
    $("#pic_title").html(titleList[nowIndex]);
    if (nowIndex < imgList.length) {
        $("#pic_txt").html(txtList[nowIndex] + " <a href=\"" + urlList[nowIndex] + "\" class=\"red\">[详细]</a>");
    }
    $("a.bxx").removeClass("bxx");
    $("a.axx").eq(nowIndex).addClass("bxx");
    nowIndex++;
    if (nowIndex >= imgList.length) nowIndex = 0;
    tt = setTimeout('change_img()', 4000);
}

function changeimg(n) {
    nowIndex = n;
    window.clearInterval(tt);
    change_img();
}

function ShowImg() {
    var html = '<div class="ad_t">';
    html += ('<a id="pic_url" href="' + urlList[0] + '"><img id="pic" src="' + imgList[0] + '" style="border:0px;filter:progid:dximagetransform.microsoft.wipe(gradientsize=1.0,wipestyle=4, motion=forward)" width="240" height="160" /></a>');
    html += ('<div style="filter:alpha(style=1,opacity=10,finishOpacity=90);opacity:0.8;background:#333;width:100%-2px;text-align:right;top:-12px;position:relative;height:12px">');
    for (var i = 0; i < imgList.length; i++) {
        html += ('<a href="javascript:changeimg(' + i + ');" class="axx" target="_self">' + (i + 1) + '</a>');
    }
    html += ('</div></div><div class="ad_b"><div id="o1"><div class="lx_tit" id="pic_title">' + (titleList.length == 0 ? "" : titleList[0]) + '</div><div id="pic_txt">' + (txtList.length == 0 ? "" : (txtList[0] + ' <a href="' + urlList[0] + '" class="red">[详细]</a>')) + '</div></div>');
    $("#picpp").html(html);
    tt = setTimeout('change_img()', 4000);
}

ShowImg();