var nowAlbum = 0; var maxAlbum = 1; function switchAlbum(down) { if(down) { if(nowAlbum + 1 < maxAlbum) { $('albumbox_'+nowAlbum).style.display = 'none'; nowAlbum++; $('albumbox_'+nowAlbum).style.display = ''; } } else { if(nowAlbum - 1 >= 0) { $('albumbox_'+nowAlbum).style.display = 'none'; nowAlbum--; $('albumbox_'+nowAlbum).style.display = ''; } } initSwitchButton(); } function initSwitchButton(){ $('sabdown').style.display = maxAlbum-nowAlbum == 1 ? 'none' : ''; $('sabup').style.display = nowAlbum ? '' : 'none'; } window.onload = function () {initSwitchButton();}