var obj = new Object(), id = '';

$("div.box-content-center.collapse").each(function() {
	if ($(this).parent().attr("id") != "block_")
	{
		id = $(this).attr("id");
		var disp_style = readCookie("box_" + id);
		if (0 == disp_style)
		{
			$(this).before('<div class="minmax" style="background-position: 0px 0px;"></div>');
			$(this).css("display", 'none');
			$(this).next().css("display", 'none');
		}
		else
		{
			$(this).before('<div class="minmax" style="background-position: 0px -21px;"></div>');
		}
	}
});

$("div.minmax").each(function() {
	$(this).click(function() {
		obj = $(this).next();
		id = obj.attr("id");
		if (obj.css("display") == "block")
		{
			$(this).css("backgroundPosition", "0px 0px");
			obj.slideUp("slow");
			obj.next().hide();
			createCookie("box_" + id, 0);
		}
		else
		{
			$(this).css("backgroundPosition", "0px -21px");
			obj.slideDown("slow");
			obj.next().show();
			eraseCookie("box_" + id);
		}
	});
});

