function rollArchive(direction) { if (direction == 1 || direction == -1) { pagenumber += direction; new Effect.Appear('rollload', {duration: .2}); } else if (direction == 'home') { pagenumber = 1; } checkRollingElements(); if (pagenumber > 1) { new Ajax.Updater({success: 'dynamiccontent'}, 'http://www.cebucitizenspresscouncil.org/wp-content/themes/Cutline 1.1-3ColumnSplit/theloop.php', {method: 'get', parameters: 'paged='+pagenumber+'&rollingarchives=1', onSuccess: rollSuccess, onFailure: rollError}); $('primarycontent').style.display = 'none'; } else { $('dynamiccontent').innerHTML = null; // Remove rolling archives $('primarycontent').style.display = 'block'; // Bring back the frontpage rollRemoveLoad(); } } function rollGotoPage(gotopage) { pagenumber = (gotopage - 1); rollArchive(1); } function rollSuccess() { rollRemoveLoad(); if (pagenumber > 1) { // If we've moved into the archives, setCookie('rollpage', pagenumber); // set a cookie so we can return to that page. } else if (pagenumber = 1) { deleteCookie('rollpage'); } } function rollError() { } function rollRemoveLoad() { new Effect.Fade('rollload', {duration: .2}); } // Needs to be run when a direction is picked, but not when you click the link the notice provides. FIX IT function rollRemoveNotices() { } function checkRollingElements() { if (pagenumber == 1) { $('rollprevious').className = null; $('rollprevious').onclick = function() { PageSlider.setValueBy(1); return false; }; $('rollnext').className = 'inactive'; $('rollnext').onclick = null; } else if (pagenumber > 1) { $('rollnext').className = null; $('rollnext').onclick = function() { PageSlider.setValueBy(-1); return false; }; } if (pagenumber >= pagecount) { $('rollprevious').className = 'inactive'; $('rollprevious').onclick = null; } else { $('rollprevious').className = null; $('rollprevious').onclick = function() { PageSlider.setValueBy(1); return false; }; } $('rollpages').innerHTML = 'Page '+pagenumber+' of '+pagecount; // Insert page count } function initRollingArchives() { pagenumber = 1; checkRollingElements(); rollRemoveLoad(); /*if (getCookie('rollpage') != null) { $('rollnotices').innerHTML = 'This session you were last seen on page '+getCookie('rollpage')+'. Reset'; new Effect.Highlight('rollnotices'); } else { $('rollnotices').style.display = 'none'; }*/ if (pagecount > 1) { $('rollprevious').onclick = function() { PageSlider.setValueBy(1); return false; }; } else { $('rollingarchives').style.display = 'none'; } $('rollingarchives').style.display = null; // Show Rolling Archives } // Initialize the Rolling Archives Event.observe(window, 'load', initRollingArchives, false);