$j = jQuery.noConflict();
$j(document).ready(function() {
	$j.ajaxSetup({
		beforeSend: function()
		{
		},
		complete: function(xhr, r) {
			if (xhr.status == 401)
			{
				document.location = '/auth/login/req';
			}
		},
		error: function(r, status, error) {
			$j.jGrowl("Error loading " + this.url + " (" + status + "): " + error);
		}
	});

	window.onresize = function(event) {
		wnd_resize();
	}
	
	wnd_resize();
	
	//cssdropdown.startchrome("chromemenu");
    // Feltoltesek kezelese
});

	
function wnd_resize()
{
	//Ablak meretek lekerdezese
	var w_width     = $j(window).width();
	var w_height    = $j(window).height();
	var menu_width  = $j('#flags').width();
	var menu_left	= 0;
	var menu_top	= 0;
	

	//menu_top;
	menu_left = parseInt( w_width - menu_width - 180) ;
	menu_top  = parseInt( (w_height - 678)  / 2 ) + 80 ;
	if (menu_top < 1) menu_top = 1;
	
	$j('#flags').css( { 'position' : 'absolute', 'left' : menu_left + 'px', 'top' : menu_top + 'px' } );
}

function al_ui_messaging_get_message(that)
{
	var msg = that.msg;
	if (typeof(that.icon) != 'undefined')
	{
		var tpl	 = '<table border="0" cellpadding="0" cellspacing="0"><tr>';
		tpl		+= '<td><img align="middle" border="0" src="' + that.icon + '"/></td>';
		tpl		+= '<td>' + msg + '</td>';
		tpl 	+= '</tr></table>';
		msg = tpl;
	}
	return msg;
}

function al_ui_msg(text, icon)
{
	if (typeof(icon) != "undefined")
	{
		icon = '/img/icons/' + icon + '.png'; 
	}
	
	$j.jGrowl(
			al_ui_messaging_get_message({
				msg: text,
				icon: icon  
			})
	);
}
