

/* --- Global configuration -------------------------------------------- */

// --- Staff popup size ---
var popup_width_inf   = 400;
var popup_height_inf  = 440;
// ---

// --- Spreads popup size ---
var popup_width_spr   = 520;
var popup_height_spr  = 625;
// ---

// --- Vertical popup size ---
var popup_width_ver   = 460;
var popup_height_ver  = 600;
// ---

// --- Horitzontal popup size ---
var popup_width_hor   = 960;
var popup_height_hor  = 430;
// ---


// --- Popup position ---
var popup_left  = 150;
var popup_top   = 150;
// ---
/* --------------------------------------------------------------------- */

/* --- Global temp variables ------------------------------------------- */
var menuEffects  = new Array();
var num_menus    = 0;
/* --------------------------------------------------------------------- */

/* --- Startup function ------------------------------------------------ */
window.addEvent('domready', function()
{
	// Add a new onclick event to open a popup to the popup class
	$$('.popup.info').addEvent('click', function(event)
	{
		// Stop the original event
		event.preventDefault();

		// Configure the popup
		href     = event.target.get('href');
		options  = 'toolbar=no, location=no, status=no, menubar=no, '
		         + 'scrollbars=yes, resizable=no, directories=no, '
		         + 'width='+popup_width_inf+', height='+popup_height_inf+', '
		         + 'left='+popup_left+', top='+popup_top;

		// Open the popup
		window.open(href, '', options);
	});
	
	// Add a new onclick event to open a popup to the popup class
	$$('.popup.spreads').addEvent('click', function(event)
	{
		// Stop the original event
		event.preventDefault();

		// Configure the popup
		href     = event.target.get('href');
		options  = 'toolbar=no, location=no, status=no, menubar=no, '
		         + 'scrollbars=yes, resizable=no, directories=no, '
		         + 'width='+popup_width_spr+', height='+popup_height_spr+', '
		         + 'left='+popup_left+', top='+popup_top;

		// Open the popup
		window.open(href, '', options);
	});
	
	// Add a new onclick event to open a popup to the popup class
	$$('.popup.vertical').addEvent('click', function(event)
	{
		// Stop the original event
		event.preventDefault();

		// Configure the popup
		href     = event.target.get('href');
		options  = 'toolbar=no, location=no, status=no, menubar=no, '
		         + 'scrollbars=yes, resizable=no, directories=no, '
		         + 'width='+popup_width_ver+', height='+popup_height_ver+', '
		         + 'left='+popup_left+', top='+popup_top;

		// Open the popup
		window.open(href, '', options);
	});


	// Add a new onclick event to open a popup to the popup class
	$$('.popup.horitzontal').addEvent('click', function(event)
	{
		// Stop the original event
		event.preventDefault();

		// Configure the popup
		href     = event.target.get('href');
		options  = 'toolbar=no, location=no, status=no, menubar=no, '
		         + 'scrollbars=yes, resizable=no, directories=no, '
		         + 'width='+popup_width_hor+', height='+popup_height_hor+', '
		         + 'left='+popup_left+', top='+popup_top;

		// Open the popup
		window.open(href, '', options);
	});
	

	$each($$('.menu li a'), function(entry)
	{
		var menus  = entry.getParent('li').getChildren('ul.menu');

		$each(menus, function(menu)
		{
			id = 'menu'+num_menus;
			menuEffects[id] = new Fx.Slide(menu, {duration:200});
			menu.set('id', id);

			num_menus++;
		});
	});
	 

	$$('.menu li a').addEvent('click', function(event)
	{
		if(event.target.get('href')=='#') {
			event.preventDefault();
		}

		var menu = event.target.getParent('li').getElement('ul.menu');
//		menuEffects[menu.get('id')].toggle();
		if(menu.getStyle('display')!='block') {
			menu.setStyle('display', 'block');
		}
		else {
			menu.setStyle('display', 'none');
		};
	});

	$each($$('.deletepost'), function(num)
	{
		num.addEvent('click', function(event)
		{
			event.preventDefault();

			del = confirm('Are you sure you want to delete THIS POST?');

			if(del) {
				window.location = event.target.get('href');
			}
		});
	});

	$each($$('.deletecomment'), function(num)
	{
		num.addEvent('click', function(event)
		{
			event.preventDefault();

			del = confirm('Are you sure you want to delete this comment?');

			if(del) {
				window.location = event.target.get('href');
			}
		});
	});

});
/* --------------------------------------------------------------------- */
