function buttonToggle(initShown){
	this.buttonArray = new Array();
	this.init(initShown);
}

buttonToggle.prototype = {
	init: function(initShown){
		this.showInitialSection(initShown);
		
		var buttonsLength = this.buttonArray.length;
		var instance = this;
		
		for (var i=0; i<buttonsLength; i++){
			var elementClassName = this.buttonArray[i].className;
			if (this.hasClassName(elementClassName, 'button') == true){
				this.buttonArray[i].addEventListener('click', function(){
					instance.clickButtons(this);
					return false;
				}, false);
				
			}
		}
	},
	
	clickButtons: function(el){
		var contentBlock = document.getElementById(el.id + 'Content');
					
		if (this.hasClassName(el.className, 'shown') == false){
			this.showSection(el.id);
			this.hideOtherSections(el.id);
		}
		else{
			this.hideSection(el.id);
		}				
	},
	
	showSection: function(section){
		document.getElementById(section + 'Content').style.display = 'block';
		document.getElementById(section).className += ' shown';
	},
	
	hideSection: function(section){
		document.getElementById(section + 'Content').style.display = 'none';
		var className = document.getElementById(section).className;
		document.getElementById(section).className = className.replace('shown', '');
	},
	
	showInitialSection: function(section){
		var buttons = document.getElementsByTagName('a');
		var buttonsLength = buttons.length;
		
		for (var i=0; i<buttonsLength; i++){
			var elementClassName = buttons[i].className;
			
			if (this.hasClassName(elementClassName, 'button') == true){
				this.buttonArray.push(buttons[i]);
				if (buttons[i].id == section){
					this.showSection(buttons[i].id);
				}
				else{
					this.hideSection(buttons[i].id);
				}
			}
		}
	},
	
	hideOtherSections: function(sectionShown){
		var buttonsLength = this.buttonArray.length;
		for (var i=0; i<buttonsLength; i++){
			if (this.buttonArray[i].id != sectionShown){
				this.hideSection(this.buttonArray[i].id);
			}
		}
	},
	
	hasClassName: function(elClassName, classNameToMatch){
		if (elClassName.indexOf(classNameToMatch) > -1){
			return true;
		}
		else{
			return false;
		}
	}
}
