var cllps = [];		//collapsables
var dc = [];		//drop content
var datec =[];		//clickable dates [to drop content also]
function rr_init()
{
	dc = $$(".rr_dropContent")
	dc.each(function(e){e.style.display="none"})
	cllps = $$(".rrTitle")
	datec = $$(".rrDate")
	for(var b=0;b<cllps.length;b++)
	{
		var c = cllps[b];
		c.open = false;
		c.uid = c.id;
		c.dropContent = dc[b];
		dc[b].owner = c;
		c.protect=false;
		c.observe("click",moduleClicked);
	}
	for(b=0;b<cllps.length;b++)
	{
		var c = datec[b];
		//c.style.cursor="pointer"
		c.open = false;
		c.uid = c.id;
		c.dropContent = dc[b];
		dc[b].owner = c;
		c.protect=true;
		c.observe("click",moduleClicked);
	}
}

function moduleClicked(e)
{
	
	var tg = Event.element(e)

	doTheToggle(tg)
}

function doTheToggle(tg)
{
	
	var ef = new Effect.toggle(tg.dropContent, "blind", {
		//make sure the slide is really done before changing the button
		afterUpdate: function(){
			check(tg.dropContent)
		},
		afterFinish: function(){
			check(tg.dropContent)
		}
	})
}

function check(dc)
{
	if(dc.style.display != "none")
	{
		if(dc.owner.protect == false)dc.owner.className = "rr_top rrTitle_open"
	}else
	{
		if(dc.owner.protect == false)dc.owner.className = "rr_top rrTitle"		
	}
}

womAdd('rr_init()');



