
self.calendarLayout = function(colormix) {
	var max_height = 0;
	var position =0;
	
	$$('#calendar .event', '#calendar .todayevent', '#calendar .today').each(function(object) {
		var content = new Element('div');
		if(object.hasClassName('today')) 
			content.addClassName('today_content');
		else 
			content.addClassName('tooltip_content');
		
		content.addClassName('window');
		if(colormix==true) 
			content.addClassName('blue');
		else
			content.addClassName('gray');
		content.setStyle({display:'none'});

		var text = object.firstChild.nodeValue
		object.firstChild.data = '';
		
		var controler = new Element('a');
		controler.addClassName('tooltip');
		Insertion.Top(controler, text);
		
		if(object.hasClassName('today')) {
			var today = new Element('div');
			today.appendChild(document.createTextNode('Today'));
			content.appendChild(today);
		} else {
			var childs = object.childElements();
			childs.each( function(child) {
				content.appendChild(child)
			});
		}
		object.appendChild(content); 
		object.insertBefore(controler, content);
	});
	
	$$('#calendar table.month').each(function(object) {
		max_height = Math.max(max_height, (object.offsetHeight+5));
	});

	$$('#calendar table.month').each(function(object) {
		var content = new Element('div');
		content.addClassName('window');
		
		if(colormix==true) 
			content.addClassName((position%2?'gray':'lightblue'));
		else
			content.addClassName('blue');
		content.setStyle({width: '228px', height: max_height+'px'});
		
		var parent = object.up('td');
		while (parent.firstChild) 
		{ 
			content.appendChild(parent.firstChild); 
		} 
		parent.appendChild(content); 
		position++;
	});
}

