
document.observe("dom:loaded", function() {
	// Check if there are any filters to toogle.
	if($$("div.filter").length < 1)
		return;

	// Use cookie to descide the initial state
	if(readCookie("show_filters") == "false")
		hide_filters();	
	else
		show_filters();
});

function hide_filters() {

	// Hide all filters
	$$("div.filter").each(function(obj) {
		obj.hide();
	});
	
	$("show_hide").update("Visa Filter");
	$("show_hide").onclick = show_filters;
	createCookie("show_filters",false,1);
}

function show_filters() {
	
	// Show all filters
	$$("div.filter").each(function(obj) {
		// Never whow the 8th, 9th, and 10th filter, becouse they are offscreen
		if(obj.id == "filter_8" || obj.id == "filter_9" || obj.id == "filter_10")
			return;
		obj.show();
	});	

	$("show_hide").update("Dölj Filter");
	$("show_hide").onclick = hide_filters;
	createCookie("show_filters",true,1);
}
