
function $(obj){
     return document.getElementById(obj);
}
//初始化
function loadimg()
{         
     
     if(window.IndexFlash!=null && IndexFlash.length>0){
             var SlideButtonUL=$("fla_btm");
                    
             for(var i=0;i<IndexFlash.length-1;i++){
	         var E_li=document.createElement("li");
                 E_li.id=	SlideButtonUL.id+i;
                 if(i==0){
                      E_li.className="act";
                 }
                 E_li.appendChild(document.createTextNode(IndexFlash[i][0]));
                 E_li.onmouseover=function(){
                    setSlideTimeout(this.id.replace("fla_btm",""));
                 }
                 SlideButtonUL.appendChild(E_li);              
  		
             }

              $('fla_lnk').href=IndexFlash[0][2];
              $('fla_img').src=IndexFlash[0][1];
          

    }   
   

}

//首页切换图片
function showimg(par)
{
    if(isNaN(par))return;
    par=parseInt(par);
    if(IndexFlash[par]==null)return;
    var ulObj=$("fla_btm");
    var bgImg=$("fla_img");
    var bglnk=$("fla_lnk");
    var sum=IndexFlash.length;
         
    for(var i=0;i<ulObj.childNodes.length;i++){
  	ulObj.childNodes[i].className="";
		
    }
    if($("fla_btm"+[par])!=null)   $("fla_btm"+[par]).className="act";
    setCo();
    bgImg.src = IndexFlash[par][1];
    bglnk.href = IndexFlash[par][2];
    playCo();
        
}

function setSlideTimeout(par){
     
     setTimeout(function(){return showimg(par)},200);
}

function setCo()
{
   if (document.all)
   {
      $("fla_img").filters.revealTrans.Transition=Math.floor(Math.random()*23);
      $("fla_img").filters.revealTrans.apply();
  }
}
function playCo()
{
    if (document.all)      $("fla_img").filters.revealTrans.play();
}

//自动轮换图片
function AutoSlide(){
  var start=0;
  var long=4000; //时间
  var fla_btm=$("fla_btm"); 
  var self=this;
  this.autoshow=function()
  {
	start++;
	if (start>window.IndexFlash.length) {start=0;}
	showimg(start);
  }
  var Flash	   = setInterval(this.autoshow,long);
  if(fla_btm!=null){
    fla_btm.onmouseover = function() {clearInterval(Flash)}
    fla_btm.onmouseout  = function() {Flash=setInterval(self.autoshow,long)}
  }
}

function move(){
	$("demo").scrollTop=demo.scrollTop+40;
}

//自动移动记录
function SlideOrder(){
  var _self=this;
  var speed		= 50;//滚动速度
  var rows		= 40;//每行高度
  var stim		= 80; //停留时间倍数 * speed
  var stop=0;
  var demo1=$("demo1")
  var demo2=$("demo2");
  var demo =$("demo");
  demo2.innerHTML= demo1.innerHTML;
  
  this.Marquee=function(){
   
    if(demo.scrollTop%rows==0 && stop<=stim){
      stop++;
      return;
    }
   
    stop = 0;
    if(demo2.offsetTop-demo.scrollTop<=0)
      demo.scrollTop-=demo1.offsetHeight
    else{
      demo.scrollTop++
    }
  }
  var MyMar	   = setInterval(this.Marquee,speed);
  demo.onmouseover = function() {clearInterval(MyMar);}
  demo.onmouseout  = function() {MyMar=setInterval(_self.Marquee,speed);}
}