// 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 collapsed = new Object();
$cwjQuery(function() {
	if(data) collapsed = $cwjQuery.evalJSON(data);
	$cwjQuery(".widget").each( function(i) {
		var widget = $cwjQuery(this);
		var title = $cwjQuery(".widgettitle",widget);
		var content = widget.children(":last-child");
		var id = widget.attr("id");
		if(collapsed[id]) content.hide();
		title.css("cursor", "pointer");
		title.click( function() {
			content.slideToggle("fast");
			if(collapsed[id]) delete collapsed[id]; else collapsed[id] = true;
			$cwjQuery.cookie('collapsible_widgets_cookie', $cwjQuery.toJSON( collapsed ), cookieParams);
		});
	});
});