document.write('<link rel="stylesheet" href="/welcome/2007wel/wel_banner.css" type="text/css" />');
var imgWidth=568;
var imgHeight=170;
var _timeOut_=5000;
var timeOut=_timeOut_;
var timeOut2=_timeOut_/2;
var adNum=0; var target="_blank"; var button_Texton='#000000'; var button_Textoff='#ffffff';
var buttonLineOn="#99CC33"; var buttonLineOff="#333333"; 
var imgUrl=new Array();
var imgText=new Array();
var imgLink=new Array();
var imgAlt=new Array();

var ver=2; var firstTime=true;
document.write('<div id="ad_pic" class="block02">');
document.write('<div id="f_div">');
document.write('<div id="f_imgDiv">');


imgUrl[1]='http://addons.books.com.tw/G/ADbanner/2010/12/elmer_568x170.jpg';
imgText[1]='大象艾瑪';
imgLink[1]='http://www.books.com.tw/exep/activity/activity.php?id=0000028720&sid=0000028720&page=1'; 
imgUrl[2]='http://addons.books.com.tw/G/ADbanner/2010/11/cite568170_2.jpg';
imgText[2]='城邦品牌週';
imgLink[2]='http://www.books.com.tw/activity/2010/11/cite/'; 
imgUrl[3]='http://www.books.com.tw/2011magazine/EZJapan/2/568170.jpg';
imgText[3]='借物少女';
imgLink[3]='http://www.books.com.tw/2011magazine/EZJapan/2/'; 
imgUrl[4]='http://addons.books.com.tw/G/ADbanner/2010/12/2010sale_books568x170.jpg';
imgText[4]='歲末年終慶';
imgLink[4]='http://www.books.com.tw/exep/activity/activity.php?id=0000028891&sid=0000028891&page=1'; 
imgUrl[5]='http://www.books.com.tw/food/activity/2010/12/yearsfood/yearsfood_568x170.jpg';
imgText[5]='年菜預購中';
imgLink[5]='http://www.books.com.tw/food/activity/2010/12/yearsfood/'; 
imgUrl[6]='http://addons.books.com.tw/G/ADbanner/2010/12/08010201216181/08010201216181_568170.jpg';
imgText[6]='國際電玩展';
imgLink[6]='http://tickets.books.com.tw/progshow/08010201216181'; 

function b_change(n){
adNum=n; window.clearInterval(theTimer);  adNum=adNum-1; change();
}

//計算筆數
var count=0;
for (var i=0;i<imgUrl.length;i++) {
if( (imgUrl[i]!="") && (imgText[i]!="")&& (imgLink[i]!="")) {
count++;
} else {
break;
}
}
//重寫css的寬
var each_width=Math.ceil((imgWidth-(count-1))/count);
var last_width=imgWidth-each_width*(count-1)-(count)+1;
function change(){
if(adNum<(imgUrl.length-1))adNum++;
else adNum=1;
theTimer=setTimeout("change()", timeOut);
document.getElementById("f_img").src=imgUrl[adNum];
//var f_img=document.getElementById("f_img");
//f_img.src=imgUrl[adNum];
document.getElementById("f_imgLink").href=imgLink[adNum];
for (var i=1;i< count;i++){
 if (i !=adNum){
 document.getElementById('b'+i).className="button";
 }
 document.getElementById('b'+adNum).className="on"; }
}
document.write('<a id="f_imgLink" href="'+imgLink[adNum]+'" target=_blank><img id="f_img" src="" width='+imgWidth+' height='+imgHeight+' border="0"></a>');
document.write('</div>');
document.write('<div id="f_infoDiv">');
document.write('<div id="f_buttonDiv">');
for (var i=count-1;i>=1;i--){
document.write('<div id="div_bg'+i+'" class="bg"><a id="b'+i+'" href="javascript:b_change('+i+')" class="button">'+imgText[i]+'</a></div>');
}
document.write('</div>');
document.write('</div>');
document.write('</div>');
document.write('</div>'); change(); 
