﻿var theTimer=null;
var bannerAD=new Array();
var bannerADlink=new Array();
var adNum=0;  //想换页的图片，按照这个模式递推添加
bannerAD[4]="闪动页面/儿童公园.jpg";
bannerADlink[4]="http://news.baoanren.com/Bule_NewsInfo.aspx?newId=7f784a85-494d-4875-bd69-3cd7adb591dc";
bannerAD[3]="闪动页面/园博园.jpg";
bannerADlink[3]="http://news.baoanren.com/Bule_NewsInfo.aspx?newId=b1cf6210-44b5-443a-b007-b282973cd60b ";
bannerAD[2]="闪动页面/世界之窗2.jpg";
bannerADlink[2]="http://news.baoanren.com/Bule_NewsInfo.aspx?newId=d4c34b07-285e-4628-9164-afce4a7508b1";
bannerAD[1]="闪动页面/民俗村.jpg";
bannerADlink[1]="http://news.baoanren.com/Bule_NewsInfo.aspx?newId=e5a37b90-5941-4336-ac6b-021b6105fdbe";
bannerAD[0]="闪动页面/东部华侨城副本.jpg";
bannerADlink[0]="http://news.baoanren.com/Bule_NewsInfo.aspx?newId=a8335948-672c-4a17-95fc-589f9630ba8c";

var preloadedimages=new Array();
for (i=1;i<bannerAD.length;i++){
preloadedimages[i]=new Image();
preloadedimages[i].src=bannerAD[i];
}

function setTransition(){
if (document.all){
document.images.bannerADrotator.filters.revealTrans.Transition=23;//换页种类 1－23种，23为随机任意换页
document.images.bannerADrotator.filters.revealTrans.apply();
}
}

function playTransition(){
if (document.all)
document.images.bannerADrotator.filters.revealTrans.play();
}

function nextAd(){
    if(adNum<bannerAD.length-1)
    {
        adNum++ ;
    }
    else{ 
        adNum=0;
    }
    SetbtnBG(adNum);
    setTransition();
    document.images.bannerADrotator.src=bannerAD[adNum];
    document.images.bannerADrotator.parentNode.href=bannerADlink[adNum];
    playTransition();
    theTimer=setTimeout("nextAd()", 4000); //换页时间
}

function selectImg(index){
    adNum=index;
    SetbtnBG(index);
    setTransition();
    document.images.bannerADrotator.src=bannerAD[adNum];
    document.images.bannerADrotator.parentNode.href=bannerADlink[adNum];
    playTransition();
}
//function jump2url(){
//jumpUrl=bannerADlink[adNum];
//jumpTarget='_blank';
//if (jumpUrl != ''){
//if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
//else location.href=jumpUrl;
//}
//}
//function displayStatusMsg() {
//status=bannerADlink[adNum];
//document.returnValue = true;
//}
function SetbtnBG(index){
    document.getElementById("pagediv1").style.backgroundColor="#fcfff8";
    document.getElementById("pagediv2").style.backgroundColor="#fcfff8";
    document.getElementById("pagediv3").style.backgroundColor="#fcfff8";
    document.getElementById("pagediv4").style.backgroundColor="#fcfff8";
    document.getElementById("pagediv5").style.backgroundColor="#fcfff8";
    if(index==0){
        document.getElementById("pagediv1").style.backgroundColor="#55afee";
    }else if(index==1){
        document.getElementById("pagediv2").style.backgroundColor="#55afee";
    }else if(index==2){
        document.getElementById("pagediv3").style.backgroundColor="#55afee";
    }else if(index==3){
        document.getElementById("pagediv4").style.backgroundColor="#55afee";
    }else{
        document.getElementById("pagediv5").style.backgroundColor="#55afee";
    }
}


function getAllballot(){
   var ls= document.getElementById("list_ballot").getElementsByTagName("input");
   var ids="";
   for(var i=0;i<ls.length; i++){
        if(ls[i].checked==true){
            ids+=ls[i].id.substr(8,ls[i].id.length-8)+",";
        }
   }
   if(ids==""){
        alert("请至少选择一项");
   }
   else{
        var par=escape(ids);
        window.open("ballot.aspx?ids="+par);
   }
}
