// escape: hotkey to close alert
registerKey(27, 'alertClose()');

// Open alert
//

var alert=function(s, headline)
{
	logi('<p><small class="help">'+getTimestamp()+'</small> robin.alert.js: <i>'+s+'</i></p>');
	if(!headline)
		var headline = 'Alert';

	// these are only for this function
	jQuery('#alertHeadline').html(headline);
	jQuery("#alertContent").html(s);
	jQuery('#alertscreen').draggable("enable");

	// always center of screen
	var win = jQuery('#alertscreen');
	win.vCenter();
	win.css('left', jQuery(window).width() / 2 - win.width() / 2 );
	//win.show();
	win.fadeIn(500);
}

// Close alert (with hotkey or such)
function alertClose()
{
	if(jQuery('#alertscreen').css('display') != 'none')
	{
		jQuery('#alertscreen').draggable("disable");
		//jQuery('#alertscreen').hide();
		jQuery('#alertscreen').fadeOut(500);
	}
}

// close
jQuery('#alertClose').bind
(
	'click',
	function() { alertClose(); }
);

jQuery('#alertscreen').draggable({ handle: 'td.alertTop' });
jQuery('#alertscreen').draggable("disable");
/*jQuery('#alertscreen').resizable
(
	{
		minWidth:	350,
		minHeight:	100,
		maxWidth:	2000,
		maxHeight:	2000*//*,
		handles:	{ se: '#alertContent' }*//*
	} 
);*/
