// JavaScript Document

var currentId = 'gezondheid';
function swapImage(id)
{
	var btnImage = document.getElementById('btn_' + id);
	var currentState = getState(btnImage);
	
	if (currentId != id)
		btnImage.src = (currentState == 'down') ? "images/buttons/btn_" + id + "_up.jpg" : "images/buttons/btn_" + id + "_down.jpg";
}
function setPage(id)
{
	_gaq.push(['_trackEvent', 'buttonClick', id]);
	
	// set old button image back to up state
	var btnImage_old = document.getElementById('btn_' + currentId);
	btnImage_old.src = "images/buttons/btn_" + currentId + "_up.jpg";
	
	// set old div invisible
	var div_old = document.getElementById('div_' + currentId);
	div_old.style.display = 'none';
	
	// set currentId
	currentId = id;
	
	// set new button image to up state
	var btnImage_new = document.getElementById('btn_' + id);
	btnImage_new.src = "images/buttons/btn_" + id + "_down.jpg";
	
	// set new div visible
	var div_new = document.getElementById('div_' + id);
	div_new.style.display = 'block';
}
function getState(img)
{
	var splitSlash = img.src.split('/');
	var splitUnder = splitSlash[splitSlash.length-1].split('_');
	return splitUnder[splitUnder.length-1].substring(0, splitUnder[splitUnder.length-1].length - 4);
}
function showKorting()
{
	_gaq.push(['_trackEvent', 'buttonClick', 'open_kortingsbon']);
	
	var div = document.getElementById('kortingsbon');
	div.style.display = 'block';
}
function hideKorting()
{
	_gaq.push(['_trackEvent', 'buttonClick', 'sluit_kortingsbon']);
	
	var div = document.getElementById('kortingsbon');
	div.style.display = 'none';
}
function printBon()
{
	_gaq.push(['_trackEvent', 'buttonClick', 'print_kortingsbon']);
	
	var prtContent = document.getElementById('kortingsContent');
	var winPrint = window.open('', '', 'left=0,top=0,width=700,height=510,toolbar=0,scrollbars=0,status=0');
	winPrint.document.write(prtContent.innerHTML);
	winPrint.document.close();
	winPrint.focus();
	winPrint.print();
	winPrint.close();
}
