﻿function pL(){
    liBind();
    bannBind();
}
function liBind(){
    var imgul=$("imgul");
    lis=imgul.getElementsByTagName("li");
//    for(var i=0;i<lis.length;i++){
//        lis[i].onmouseover=liMouseOver;
//        lis[i].onmouseout=liMouseOut;
//    }
}
function liMouseOver(){
    this.style.backgroundColor="#820002";
}
function liMouseOut(){
    this.style.backgroundColor="#373737";
}
var id=0;
var lis;
var imgSwap;
var imgShade;
var hiddenValue=100;
var showValue=0;
function bannBind(){
    var imglist=$("imglist");
    lis[id].style.backgroundColor="#820002";
    imglist.style.backgroundImage="url("+imgUrl[id++]+")";
    imgSwap=setTimeout(bannSwap,3000);
}
function bannSwap(){
    imgShade=setInterval(bannHidden,100);
}
function bannHidden(){
    var imglist=$("imglist");
    hiddenValue-=20;
    imglist.style.filter="alpha(opacity="+hiddenValue+")";
    imglist.style.opacity=hiddenValue/100;
    if(hiddenValue==0){
        clearInterval(imgShade);
        hiddenValue=100;
        lis[(id-1)<0 ? (lis.length-1) : (id-1)].style.backgroundColor="#373737";
        lis[id].style.backgroundColor="#820002";
        imglist.style.backgroundImage="url("+imgUrl[id++]+")";
        if(id>=imgUrl.length){
            id=0;
        }
        else{
        }
        imgShade=setInterval(bannShow,200);
    }
}
function bannShow(){
    var imglist=$("imglist");
    showValue+=20;
    imglist.style.filter="alpha(opacity="+showValue+")";
    imglist.style.opacity=showValue/100;
    if(showValue==100){
        clearInterval(imgShade);
        showValue=0;
        imgShade=setTimeout(bannSwap,3000);
    }
}

/* class */
function $() {
    if (arguments.length == 1) return get$(arguments[0]);
    function get$(el){
        if (typeof el == 'string') el = document.getElementById(el);
        return el;
    }
}

/**/
window.onload=pL;

var imgUrl=new Array();