Event.observe(window, 'load', function() {
	var itemHandler = function(event) {
		if (this.hasClassName('g-current')) {
			return;
		}
		
		if (this.relativeContent === undefined) {
			this.relativeContent = this.up('.tab-box').down('.tab-content', this.previousSiblings('.tab-button').length);
		}
		
		this.addClassName('g-current');
		this.relativeContent.addClassName('g-current');
		(this.relativeContent.next('.g-current') || this.relativeContent.previous('.g-current')).removeClassName('g-current');
		(this.next('.g-current') || this.previous('.g-current')).removeClassName('g-current');
		Event.stop(event);
	};
	
	$$('.tab-box .tab-button').each(function(item) {
		Event.observe(item, 'click', itemHandler);
	});
});
