window.addEvent('domready', function() {
	$$('a.makeRequest').addEvent('click', function() {
		var selectedFile = 'archives/'+this.name+'.html';
		
		//We can use one Request object many times.
		var req = new Request.HTML({url:selectedFile, 
			onSuccess: function(html) {
				//Clear the text currently inside the results div.
				$('result').set('text', '');
				//Inject the new DOM elements into the results div.
				$('result').adopt(html);
			},
			//Our request will most likely succeed, but just in case, we'll add an
			//onFailure method which will let the user know what happened.
			onFailure: function() {
				$('result').set('text', 'The request failed.');
			}
		});
		req.send();
	});

});


