var curr_pic = 0; var max_pic = 2; startgallery(); function startgallery(){ if( curr_pic >= max_pic ){ curr_pic = 0; }else{ curr_pic = curr_pic + 1; } new Effect.Opacity( 'home_hd_box' , { duration:4.0, from:1.0, to:1.0, queue: {position:'end', scope: 'homegall'}} ); new Effect.Opacity( 'home_hd_box' , { duration:1.0, from:1.0, to:0.0, afterFinish: switchpic, queue: {position:'end', scope: 'homegall'}} ); new Effect.Opacity( 'home_hd_box' , { duration:0.5, from:0.0, to:0.0, queue: {position:'end', scope: 'homegall'}} ); new Effect.Opacity( 'home_hd_box' , { duration:1.0, from:0.0, to:1.0, afterFinish: startgallery, queue: {position:'end', scope: 'homegall'}} ); } function switchpic( ){ if( curr_pic == "0" ){ $('home_hd_box').innerHTML = 'Gallery' } else if( curr_pic == "1" ){ $('home_hd_box').innerHTML = 'Gallery' } else if( curr_pic == "2" ){ $('home_hd_box').innerHTML = 'Gallery' } }