var Stories = {
	_h5:	null,
	_img:	null,
	_div:	null,
	_cache:	null,
	
	_toggle: function (index) {
		if (!this._h5 || (arguments.length==0))
			return;
		var closed = (this._img[index].readAttribute('alt')=='Expand');
		this._img[index].writeAttribute('alt',(closed?'Close':'Expand'));
		this._img[index].writeAttribute('title',(closed?'Close':'Expand'));
		this._img[index].writeAttribute('src','/images/buttons/'+(closed?'retract':'more')+'.gif');
		this._div[index].setStyle({'display':(closed?'block':'none')});
	},
	
	deinitialize: function () {
		if (!this._h5)
			return;
		for (var iStories = 0; iStories < this._h5.length; ++iStories)
			Event.stopObserving(this._h5[iStories], 'click', this._cache[iStories]);
		delete this._h5;
		delete this._img;
		delete this._div;
		delete this._cache;
	},
	
	initialize: function () {
		this._h5 = $$('h5.morestories');
		this._img = $$('img.morestories');
		this._div = $$('div.morestories');
		this._cache = [];
		
		for (var iStories = 0; iStories < this._h5.length; ++iStories) {
			this._cache[iStories] = this._toggle.bind(this, iStories);
			Event.observe(this._h5[iStories], 'click', this._cache[iStories]);
		}
		
		Event.observe(window, 'unload', Stories.deinitialize.bind(Stories));
	}
};	
Event.observe(window, 'load', Stories.initialize.bind(Stories));