//The text for the "Show All Packages" link
var showAllText = '>> Click to Show All Package Details';
//The text for the "Hide All Packages" link
var hideAllText = '>> Click to Hide All Package Details';
//
//Do not change any thing below 
//

Window.onDomReady(setupAccordion);
var myFxa = Fx.Accordion.extend({
	showHideAll: function(display) {
		var objObjs = {};
		this.elements.each(function(el, i) {	
			if (display == 'show') {
				this.showThis(i);
			}
			else {
				this.hideThis(i);
			}
			objObjs[i] = Object.extend(this.h, Object.extend(this.o, this.w));			
		}, this);
		return this.custom(objObjs);
	}
});
var fxa;
function setupAccordion() {
	var specials = document.getElementsByClassName('specials');
	if (specials.length > 0) {
		var link = new Element('a').setProperty('href', '#').appendText(showAllText).injectBefore(specials[0]);
		link.onclick = showAll.bind(link);		
	}
	fxa = new myFxa(document.getElementsByClassName('specialTitle'), document.getElementsByClassName('specialsInfo'));
}
function showAll() {
	fxa.showHideAll('show');
	this.setHTML(hideAllText);
	this.onclick = hideAll.bind(this);
	return false;
}
function hideAll() {
	fxa.showHideAll('hide');
	this.setHTML(showAllText);
	this.onclick = showAll.bind(this);
	return false;
}
