/*
*   STATUS BAR on map
*/

var Status = {
		newMessages : 0,
		message : '',
		showStatusMessage : '', // message to go back to
		sizeSet : false,		//Status box size set?
	
		/*
		*	Set floating status message
		*/
		setStatus : function(message, showspinner){

			//alert($('statusspinner'));

			if (!Status.sizeSet) Status.setSize();

			if ($('statusspinner'))
				if (showspinner){
					$('statusspinner').style.display = '';
				} else {
					$('statusspinner').style.display = 'none';
				}
			
			if ($('status')){
				$('status').innerHTML = message;	
			}
			
			Status.message=message;
			
			Status.checkDisplay();
		},
		
		setSize : function(){
			var width = 460;
			var height = 22;
			var padding = 10;
			var y = UIConfig.map.getPosition().y+70;
			
			if (MS.MS_MODE == MS_MIDI) y = 70;
			
			var mapwidth = UIConfig.map.offsetWidth;
			
			var x = Math.round((mapwidth/2)-(width/2));
			
			var outer = $$('div.alertouter')[0];
			outer.style.left = (x-padding)+'px';
			outer.style.top = (y-padding)+'px';
			outer.style.width = (width+2*padding)+'px';
			outer.style.height = (height+2*padding)+'px';
			
			var inner = $$('div.alertinner')[0];
			inner.style.left = x+'px';
			inner.style.top =  y+'px';
			inner.style.width = width+'px';
			inner.style.height = height+'px';
		
			Status.sizeSet = true;
		},
		
		/*
		*	Add new message notification
		*/
		setNumNewMessages : function(number){
			if (!$('messNotify')) return;
			
			Status.newMessages = number;
			
			if (number > 0) {
				var s= '';
				
				if (number > 1) s='s';
				
				$('messNotify').innerHTML = '('+number+')';
			} 
			
			Status.checkDisplay();
		}, 
		
		/*
		*	Is nothing to display, hide the status box on map
		*/
		checkDisplay : function(){
			
			if (Status.message == ''){
				$('alerts').style.display = 'none';	
			} else {
				$('alerts').style.display = 'block';
			}
		}
};

