liwe.AJAX.url = "/ajax.pyhp";

var site = {};

site.init = function ()
{
	fumetti.init ();
	news.init ();
	site.resize ();
};

site._init_admin = function ()
{
	tags.admin.create_tags_menu ();
	user.admin.init ();
	news.admin.init ( 'block_main' );
	staticpage.admin.init ( 'block_main' );
};

site.logout = function ()
{
	user.events [ 'logout' ] = function(){ location.reload (); };
	user.logout();
};


site.resize = function ()
{
	return;
	var bottom = $ ( 'back_bottom_page' );
	var footer = $ ( 'footer' );

	var h;
	var ua = navigator.userAgent;
	if ( ua.indexOf ( "MSIE" ) >= 0 )
		h = document.documentElement.clientHeight;
	else
		h = window.innerHeight;

	var fh = footer.offsetTop + footer.clientHeight;
	console.debug ( footer.offsetTop + footer.clientHeight );

	console.debug ( bottom.offsetTop );

	if ( ( fh + 20 ) > bottom.offsetTop )
	{
		bottom.style.marginTop = '';
	}

	setTimeout ( function ()
	{
	}, 100 );
};

site.show_page = function ( page, static_page )
{
	site._cur_page = page;

	switch ( page )
	{
		case "show_news":
			$ ( 'static_page_cnt' ).style.display = 'none';
			$ ( 'list_box' ).style.display = 'none';
			$ ( 'contatti_sects' ).style.display = 'none';

			break;

		case "contatti":
			$ ( 'static_page_cnt' ).style.display = 'none';
			$ ( 'list_box' ).style.display = 'none';
			$ ( 'cnt_news_full' ).style.display = 'none';

			$ ( 'contatti_sects' ).style.display = 'block';

			fumetti.show_contatti ( "contatti" );
			break;

		case "static_html":
			$ ( 'list_box' ).style.display = 'none';
			$ ( 'cnt_news_full' ).style.display = 'none';
			$ ( 'contatti_sects' ).style.display = 'none';

			fumetti.show_page ( static_page, false );
			break;

		case "static":
			$ ( 'list_box' ).style.display = 'none';
			$ ( 'cnt_news_full' ).style.display = 'none';
			$ ( 'contatti_sects' ).style.display = 'none';

			fumetti.show_page ( static_page, true );
			break;


		case "home":
		default:
			$ ( 'static_page_cnt' ).style.display = 'none';
			$ ( 'contatti_sects' ).style.display = 'none';
			$ ( 'cnt_news_full' ).style.display = 'none';

			fumetti.create_home_page ();
			break;
	}
};

