﻿var textFromHeight = 0;         //焦点字框高度 (单位为px)
var textStyle = "f12";           //焦点字class style (不是连接class)
var textLinkStyle = "#FDFDFF"; //焦点字连接class style
var buttonLineOn = "#9B001A";           //button下划线on的颜色var buttonLineOff = "#000";          //button下划线off的颜色var TimeOut = 3000;              //每张图切换时间 (单位毫秒);
var imgUrl = new Array();
var imgLink = new Array();
var imgtext = new Array();
var imgAlt = new Array();
var adNum = 0;
var theTimer = 0;

function changeimg(n) {
    adNum = n;
    window.clearInterval(theTimer);
    adNum = adNum - 1;
    nextAd();
}
function goUrl() {
    window.open(imgLink[adNum], '_blank');
}
function playTran() {
    if (document.all)
        imgInit.filters.revealTrans.play();
}
var key = 0;
function nextAd() {
    if (adNum < count) adNum++;
    else adNum = 1;

    if (key == 0) {
        key = 1;
    } else if (document.all) {
        imgInit.filters.revealTrans.Transition = 23;
        imgInit.filters.revealTrans.apply();
        playTran();
    }
    document.images.imgInit.src = imgUrl[adNum];
    document.images.imgInit.alt = imgAlt[adNum];
    document.getElementById('link' + adNum).style.background = buttonLineOn;
    for (var i = 1; i <= count; i++) {
        if (i != adNum) { document.getElementById('link' + i).style.background = buttonLineOff; }
    }
    document.getElementById("focustext").innerHTML = imgtext[adNum];
    theTimer = setTimeout("nextAd()", TimeOut);
}
var count = 0;
function loadImgplayer(imgplayerid,imgWidth,imgHeight,imgsrc1,imgsrc2,imgsrc3) {

    var i = 1;
    imgUrl[i] = imgsrc1;
    imgtext[i] = '<A HREF="http://jsq.99sushe.com/" TARGET="_blank" class="' + textLinkStyle + '"><font color="#000000">99宿舍加速器</font></A>';
    imgLink[i] = 'http://jsq.99sushe.com/';
    imgAlt[i] = '99宿舍加速器';
    i++;
    imgUrl[i] = imgsrc2;
    imgtext[i] = '<A HREF="http://jsq.99sushe.com/agent.html" TARGET="_blank" class="' + textLinkStyle + '"><font color="#000000">加速器代理</font></A>';
    imgLink[i] = 'http://jsq.99sushe.com/agent.html';
    imgAlt[i] = '加速器代理';
    i++;
    imgUrl[i] = imgsrc3;
    imgtext[i] = '<A HREF="http://jsq.99sushe.com/" TARGET="_blank" class="' + textLinkStyle + '"><font color="#000000">加速器在线充值</font></A>';
    imgLink[i] = 'http://jsq.99sushe.com/';
    imgAlt[i] = '加速器在线充值';
    i++;
    //开始写页面
    //焦点字框高度样式表 开始    
    document.write("<style type='text/css'>");
    document.write("#imgTitle { left: 0px; overflow: hidden;  position: relative; text-align: right; }");
    document.write("#imgTitle_up { left: 0px; height: 1px; text-align: left;   }");
    document.write("#imgTitle_down:{ left: 0px; text-align: right;}");
    document.write(".imgClass { border-right: #000 0px solid; border-top: #000 0px solid; border-left: #000 0px solid;border-bottom: #000 0px solid;}");
    document.write("#txtFrom{vertical-align: middle;text-align: center;}");
    document.write(".button{padding-right: 7px;padding-left: 7px;background: #e5d8da;padding-bottom: 2px;margin: 0px;font: bold 9px sans-serif;border-left: #fff 1px solid;padding-top: 2px;text-decoration: none;}");
    document.write("A.button{ color: #ffffff; font-family: sans-serif;background-color: #000000;text-decoration: none;}");
    document.write("A.button:link {color: #ffffff; font-family: sans-serif; background-color: #000000; text-decoration: none;}");
    document.write("A.button:visited {color: #ffffff;font-family: sans-serif;background-color: #000000;text-decoration: none;}");
    document.write("A.button:hover{background: #fff;color: #fff;font-family: sans-serif;text-decoration: none;}");
    document.write(".buttonDiv {  background: #000000; float: left;vertical-align: middle;width: 26px;height: 1px;text-align: center;}");
    document.write(".trans { width: 90px;}");
    document.write('#focuseFrom{width:' + (imgWidth + 2) + ';margin: 0px; padding:0px;height:' + (imgHeight + textFromHeight) + 'px; overflow:hidden;}');
    document.write('#txtFrom{height:' + textFromHeight + 'px;line-height:' + textFromHeight + 'px;width:' + imgWidth + 'px;overflow:hidden;}');
    document.write('#imgTitle{width:' + imgWidth + ';top:-' + (textFromHeight + 22) + 'px;height:18px}');
    document.write('</style>');
    
    //焦点字框高度样式表 结束
    
    for (i = 1; i < imgUrl.length; i++) {
        if ((imgUrl[i] != "") && (imgLink[i] != "") && (imgtext[i] != "") && (imgAlt[i] != "")) {
            count++;
        } else {
            break;
        }
    }
    var focus_html = '';
    focus_html += '<div id="focuseFrom">';
    focus_html += '<div style="width:' + imgWidth + 'px;height:' + imgHeight + 'px;line-height:' + imgHeight + 'px;overflow:hidden;position:relative;text-align:center;padding-left:0px;"><a target=_self href="javascript:goUrl()" style="position:static;+position:absolute;top:50%;left:50%;"><img style="filter:revealTrans(duration=1,transition=5);position:static;+position:relative;top:-50%;left:-50%;vertical-align:middle;Max-width:' + imgWidth + 'px;Max-height:' + imgHeight + 'px;" src="javascript:nextAd()"  border=0 vspace="0" name="imgInit" /></a></div>';
    focus_html += '<div id="txtFrom"><span id="focustext" class="' + textStyle + '"></span></div>';
    focus_html += '<div id="imgTitle">';
    focus_html += ' <div id="imgTitle_down"> <a class="trans"></a>';
    //数字按钮代码开始    
for (var i = 1; i < imgUrl.length; i++) { focus_html += '<a id="link' + i + '"  href="javascript:changeimg(' + i + ')" class="button" style="cursor:hand" title="' + imgAlt[i] + '" onFocus="this.blur()">' + i + '</a>'; }
    //数字按钮代码结束
    focus_html += '</div>';
    focus_html += '</div>';
    focus_html += '</div>';
    document.getElementById(imgplayerid).innerHTML = focus_html;
    changeimg(1);
}

