jQuery.fn.extend({
	fcToggle: function() {
		cookie = jQuery.cookie('fcExpandedContents');
  		
		//jQuery.cookie('fcExpandedContents', '');
		if (cookie == null)
			cookie = '';
		
		function toggle(fc, preload) {
			fclink = jQuery(fc);
			fccontent = jQuery(fc).next();
			fcparent = jQuery(fc).parent();
			
			if (fclink.is(".expanded") || fcparent.is(".expanded")) {
				fccontent.hide((!preload?'slow':null));
				
				fclink.removeClass("expanded");
				fclink.addClass("colapsed");
			
			} else {
				fccontent.show((!preload?'fast':null));
				
				fclink.removeClass("colapsed");
				fclink.addClass("expanded");
			}
			
			fcparent.removeClass("expanded");
				
			if (!preload && fclink.attr('name')) {
				if (cookie.indexOf('|'+fclink.attr('name').replace(/^fc/, '')) == -1)
					cookie = cookie+'|'+fclink.attr('name').replace(/^fc/, '');
				else
					cookie = cookie.replace(new RegExp('\\|'+fclink.attr('name').replace(/^fc/, ''), 'g'), "");
				
				jQuery.cookie('fcExpandedContents', cookie, { expires: 10 });
			}
		}
		
		return this.each(function() {
			jtag = jQuery(this);
			
			if (jtag.attr('name') && cookie.indexOf('|'+jtag.attr('name').replace(/^fc/, '')) != -1)
				toggle(this, true);
			
			jtag.click(function(){
				toggle(this);
			});
		});
	}
});