// JavaScript Document
/**
Please set the cookieParams object to your site or the cookie won't work!
path - path to the current page cookie is attributed to
domain - domain of the site
expires - int of days, or date
*/
// START
var cookieParams = { path: '/', domain: window.location.host.toString(), expires: 7 };
$cwjQuery = jQuery.noConflict();
var data = $cwjQuery.cookie('collapsible_widgets_cookie');
var opened = new Object();
$cwjQuery(function() {
	if(data == null) opened[  $cwjQuery(".widget").parent().children(":first-child").attr('id') ] = true; else opened = $cwjQuery.evalJSON(data);
	$cwjQuery(".widget").each( function(i) {
		var widget = $cwjQuery(this);
		var title = widget.children(":first-child");
		var content = widget.children(":last-child");
		var id = widget.attr("id");
		if(!opened[id]) content.hide();
		title.css("cursor", "pointer");
		title.click( function() {
			content.slideToggle("fast");
			if(opened[id]) delete opened[id]; else opened[id] = true;
			$cwjQuery.cookie('collapsible_widgets_cookie', $cwjQuery.toJSON( opened ), cookieParams);
		});
	});
});