var eventCalendar;
$(document).ready(function() {
	// Justify global menu
	justifyMenu();
	window.setTimeout(function(){
		sIFR.replace(rockwell, {
			selector:	'#right_global_menu .last',
			//tuneWidth: -12,
			//offsetLeft: 4,
			wmode:		'transparent',
			forceSingleLine: true,
			css: [
				'.sIFR-root { font-size: 12px; color: #6a7263; text-align: right; }',
				'a { color: #6a7263; text-decoration: none; }',
				'a:hover { color: #6a7263; text-decoration: none; }'
			]
		});

		sIFR.replace(rockwell, {
			selector:	'#global_menu .active, #right_global_menu .active',
			wmode:		'transparent', 
			tuneWidth: 1,
			forceSingleLine: true,
			css: [
				'.sIFR-root { font-size: 12px; color: #ffffff; text-align: center; }',
				'a { color: #ffffff; text-decoration: none; }',
				'a:hover { color: #ffffff; text-decoration: none; }'
			]
		});
		
		sIFR.replace(rockwell, {
			selector:	'#global_menu .item, #right_global_menu .item',
			wmode:		'transparent', 
			tuneWidth: 1,
			forceSingleLine: true,
			css: [
				'.sIFR-root { font-size: 12px; color: #6a7263; text-align: center; }',
				'a { color: #6a7263; text-decoration: none; }',
				'a:hover { color: #6a7263; text-decoration: none; }'
			]
		});
	}, 1);
	// Add tabarea on right site
	if ($elm('tabarea_mediaposts'))
	{
		tabarea.add($elm('tabarea_mediaposts'));
	}
	var markedDate = '';
	var parts = location.href.split('/');
	for (var n = 0, j = parts.length; n < j; n++)
	{
		if (/^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/i.test(parts[n]))
			markedDate = parts[n];
	}
	// Register calendar-view
	eventCalendar = new calendar();
	eventCalendar.Register('calendar_container', globalServer+'get.calendar.php', {
		fetchData: 'calendarEntries',
		markedDate: markedDate,
		onClick: 'calendarGoto'
	});
});

function calendarGoto(date)
{
	location.href=globalServer+'calendar/'+date;
}