﻿function initSlide(playID, playTextID, imgListID, cssHover, cssCommon, funcTemp, funcInterval, playName) {
    var cssPlayText = { "position": "relative", "height": "20px",  "zIndex": "10002" }; //文本位置
    var cssPlayTextUL = {  "height": "24px", "display": "block", "filter": "Alpha(Opacity=80)", "opacity": "0.8" }; //文本位置的Ul
    var cssPlayTextUlLi = { "float": "left", "display": "block", "textAlign": "center", "margin": "1px", "cursor": "pointer" }; //文本位置的Li
    var cssPlayListA = { "display": "block", "position": "absolute", "overflow": "hidden" }; //图像超链接
    playName.currentIndex = 0;
    playName.count = $("#" + imgListID + " a").size();
    var playHeight = $("#" + playID).height(); //播放位置的高度
    var playWidth = $("#" + playID).width(); //播放位置的宽度

    cssPlayText.marginTop = playHeight - (cssCommon.width.replace("px", "")*1)-8;  //对播放数字的位置进行设置
    
    cssPlayText.marginLeft = playWidth - playName.count * (cssCommon.width.replace("px", "") * 1 + 4) - 7; //对播放数字的位置进行设置	
    $("#" + imgListID + " img").css({ "height": playHeight, "width": playWidth }); //强制设置图片高度和宽度
    $("#" + imgListID + " a").css(cssPlayListA);
    $("#" + playID + " a:not(:first-child)").hide();
    var playText = $("<ul></ul>").css(cssPlayTextUL);

    for (var i = 1; i <= playName.count; i++) {
        var temp = $("<li>" + i + "</li>").css(cssPlayTextUlLi).click(function() {
            var j = $(this).text() - 1;
            playName.currentIndex = j;

            if (j >= playName.count) return;
            $("#" + imgListID + " a").filter(":visible").fadeOut(500).parent().children().eq(j).fadeIn(1000);
            $(this).css(cssHover).siblings().css(cssCommon)
        });
        if (i == 1) {
            temp.css(cssHover);
        }
        else {
            temp.css(cssCommon);
        }
        playText.append(temp);
    }
    $("#" + playID).append($("#" + playTextID).append(playText).css(cssPlayText));
    funcTemp = setInterval(funcInterval, 4000);
    $("#" + playID + "").hover(function() { clearInterval(funcTemp) }, function() { funcTemp = setInterval(funcInterval, 4000); });

}