function _alert(msg)
{
	$alert = $.alertWindow();	
	$alert.alert(msg);
}
	
(function($) {
	//If the UI scope is not availalable, add it
	$.ui = $.ui || {};
	
	
	
$.alertWindow = function(options) {
		var defaults = {
						zindex:9999,
						timeout:8000,
						speed: 'slow'
				};

		options = $.extend({},defaults, options);		
		if($('#alertwindow').length == 0 )
		{
			$('body').append('<div id="alertwindow" name="alertwindow"></div>');
		}		
		return $.extend($.alertWindow.control,new $.ui.alertWindow($('#alertwindow'),options));

	}

$.alertWindow.control = {
		show : function(){
			this.slidein();
		},
		hide : function(){
				this.slideout(this.element.id,this.options.elHeight);
		},
		alert: function(message){
				$(this.element).html(message);
				this.show();
		}
}

$.ui.alertWindow = function(el,objOptions){
				if(!objOptions) var objOptions = {};
				this.element = el[0];				
				this.options = {};
				$.extend(this.options, objOptions);
				this.init();
}

$.extend($.ui.alertWindow.prototype, {
	init: function(){
		this.options.elHeight = $(this.element).outerHeight()*-1;
		var elWidth = ($(window).width() /2) - ($(this.element).outerWidth() /2);
		$(this.element).css('left',elWidth);
		$(this.element).css('top',this.options.elHeight);
		$(this.element).css('z-index',this.options.zindex);
	},
	slidein: function(){
		var timeout = this.options.timeout;
		var el = this.element;
		var height = this.options.elHeight;
		

		$(this.element).animate({"top": -2},this.options.speed, function(){
																		 
											
					 if(timeout > 0)
					 {	
					 						 
					 	setTimeout('$.ui.alertWindow.prototype.slideout("#'+el.id+'",'+height+')',timeout);
					 }
				 });
	},
	slideout:function(el,height){
		$(el).animate({"top": height},"slow");
	}
});
})(jQuery);