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; }
});

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];
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}


function updateQuantity() {
	quantity = readCookie('cart_quantity');
	if (quantity) {
	var $j = jQuery;
		$j('#cart_quantity').html(quantity);
		$j('#cart_total').html(readCookie('cart_total'));
    }
}

window.addEvent('load', updateQuantity);


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