function setCurrentTab(new_tab) {
	$(current_tab).addClass('hide');
	$(current_tab + '_header').removeClass('on');
	current_tab = new_tab;
	$(current_tab).removeClass('hide');
	$(current_tab + '_header').addClass('on');
}

Element.implement({
	visible: function() { return this.style.display != 'none'; },
	toggle: function() { this[this.visible() ? 'hide' : 'show'](); return this; },
	hide: function() { this.style.display = 'none'; return this; },
	show: function() { this.style.display = ''; return this; }
});

// mootools < 1.2
Element.extend({
	visible: function() { return this.style.display != 'none'; },
	toggle: function() { this[this.visible() ? 'hide' : 'show'](); return this; },
	hide: function() { this.style.display = 'none'; return this; },
	show: function() { this.style.display = ''; return this; }
});

function swapLabel(label){
	$('int_label').title = $('int_label').innerHTML;
	$('int_label').innerHTML = label.title;
};
function revertLabel() { $('int_label').innerHTML = $('int_label').title; };

function toggleNav(element) {
	parentUL = $(element).getParent().getElement('ul');
	if (parentUL.visible()) {
		parentUL.hide();
		element.removeClass('open');
	} else {
		parentUL.show();
		element.addClass('open');
	}
}
function newDiv(id) { return (new Element('div')).setProperty('id', id); };

function swfElement(id) { 
	var movieId = id + '_swf';
	if (window.ie)
		return window[movieId];
	return document[movieId];
}

if (navigator.appVersion.indexOf("Mac") > -1) window.mac = true;

if (window.ie) {
	function purge(d) {
		$each(d.attributes, function(attribute) {
			name = attribute.name;
			if (typeof d[name] === 'function') {
				d[name] = null;
			}
		});
		$each(d.childNodes, function(attribute) { purge(attribute); });
	}
	
	window.addEvent('unload', function() { purge(document) } );
}