/**
 *  archive.js
 *  Neatens up archive page
 *  Requires prototype.js 1.5.0
 */

var current = 0;

//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// Check document is loaded
Event.observe(window, 'load', function() {

	// Hide all the issue lists
	$A($$('.issueList')).each(function(node) {
		$(node).hide();
	} );
	
	// Add click functionality to volume list links
	var id, n;
	$A($$('#volumeList a')).each(function(node) {
		$(node).observe('click', function(e) {
			Event.stop(e);
			id = node.innerHTML;
			n = id.replace(/^\D*(\d+).*$/g, '$1');
			
			// Hide currently selected list
			if (current)
				$('volList' + current).hide();
				
			// Select new list
			$('volList' + n).show();
			current = n;
		} );
	} );
} );
