
$j.notifyBar = function(settings) {(function($) {
	var bar = notifyBarNS = {};
	notifyBarNS.shown = false;

	if( !settings) {
		settings = {};
		}

	notifyBarNS.id = "jquery-notify-bar";


	notifyBarNS.html = settings.html || "";


	notifyBarNS.delay = settings.delay || 0;


	notifyBarNS.animationSpeed = settings.animationSpeed || 200;


	notifyBarNS.jqObject = settings.jqObject;


	notifyBarNS.cls = settings.cls || "";


	notifyBarNS.close = settings.close || false;

	if (notifyBarNS.jqObject) {
		bar = notifyBarNS.jqObject;
		notifyBarNS.html = bar.html();
		}
	else {
		bar = $j("<div></div>")
			.addClass("jquery-notify-bar")
			.addClass(notifyBarNS.cls)
			.attr("id", notifyBarNS.id);
		}

	bar.html(notifyBarNS.html).hide();

	var id = bar.attr("id");
	switch (notifyBarNS.animationSpeed) {
		case "slow":
		asTime = 600;
		break;
		case "normal":
		asTime = 400;
		break;
		case "fast":
		asTime = 200;
		break;
		default:
		asTime = notifyBarNS.animationSpeed;
		}
	if (bar != 'object'); {
		$j("body").prepend(bar);
		}


	if (notifyBarNS.close) {
		bar.append($j("<a href='#' class='notify-bar-close'>Close [X]</a>"));
		$j(".notify-bar-close").click(function() {
			if (bar.attr("id") == notifyBarNS.id) {
				$j("#" + id).slideUp(asTime, function() { $j("#" + id).remove() });
				} 
			else {
				$j("#" + id).slideUp(asTime);
				}
			return false;
			});
		}


	if($('.jquery-notify-bar:visible').length > 0) {
		$('.jquery-notify-bar:visible').stop().slideUp(asTime, function() {
			bar.stop().slideDown(asTime);
			});
		} 
	else {
		bar.slideDown(asTime);
		}


	bar.click(function() {
		$(this).slideUp(asTime);
		});
     

	if (bar.attr("id") == notifyBarNS.id) {
		if (notifyBarNS.delay > 0) {
			setTimeout("$j('#" + id + "').stop().slideUp(" + asTime +", function() {$j('#" + id + "').remove()});", notifyBarNS.delay + asTime);
			}
		}
	else {
		if (notifyBarNS.delay > 0) {
			setTimeout("$j('#" + id + "').stop().slideUp(" + asTime +", function() {$j('#" + id + "')});", notifyBarNS.delay + asTime);
			}
		}

	})(jQuery) };

