function init_advice(cat) {

	$('btn_advice_cat1').addEvent('click', function() { switchCategory(1, 80); });
	$('btn_advice_cat2').addEvent('click', function() { switchCategory(2, 220); });
	$('btn_advice_cat3').addEvent('click', function() { switchCategory(3, 340); });
	
	$('btn_advice_cat' + cat).fireEvent('click');
}

function switchCategory(cat, pos) {	
	var request = new Request({url: "scripts/advice_helper.php", method: 'get'})
	
	request.onSuccess = function(txt, xml) {
		$('accordion_advice').set('html', txt);
		
		reloadAccordion('accordion_advice', false, true, -1);
	}
	
	var lang = readCookie("diadermine_language");
	
	if (lang == null) lang = "NL";
	
	request.send('catID='+cat+"&"+"lang="+lang);
	
	//set the bullet
	setTimeout("switchBullet(" +pos+ ")",0);
	
	//show intro text
	var intro_div = $('advice_intro');
	intro_div.setStyle("display", "none");
	
	if(cat == 3){
		intro_div.setStyle("display", "block");
	}
}

function switchBullet(pos){
	var bullet_div = $("bullet_advice_sections");
	bullet_div.setStyle("margin-left", pos + "px");
}
