$(function() {
	$('#selectbox').selectbox({debug: true});
	$('a[rel*=popup_link]').click(function(e){
		window.open($(this).attr('href'), 'popWin', 'width=800,height=600,resizable=1,scrollbars=1,location=1,menubar=1');
        return false;
	});
})

function swapImage(id, img)
{
	document.getElementById(id).src = '/images/navigation/' + img + '.gif';
}
function recalculateShoppingCart()
{
	document.getElementById('shopping_cart_page_function').value = 'update';
	document.getElementById('shopping_cart_form').submit();
}

/*
 * Switch tabs on product detail page switches the detail header description.
 */
function changeBlock(display)
{
	var tab, section;
	for (i=1; i<=4; i++) {
		tab = document.getElementById('tab' + i);
		if (!tab) {
			continue;	
		}
		section = document.getElementById('section' + i);
		if (!section) {
			continue;	
		}
		if (i == display) {
			section.className = 'show';
			tab.className     = 'tab_up';
		} else {
			section.className = 'hide';
			tab.className     = 'tab_down';
		}
	}
	
	description = $('#header_description');
	if (description) {
		if (display == 4) {
			html = $('#tab4').attr('title');
		} else {
			html = $('#tab1').attr('title');
		}
	}
	description.empty();
	description.append(html);
}

function printerWindow(url)
{
	var newWin = window.open(url, 'newWin', 'width=650,height=500,scrollbars=1,resizable=1,menubar=1');
	newWin.focus();
}