/*  
    http://www.dailycoding.com/ 
    Topbar message plugin
*/
function CloseTopBar() {
	//alert("close");
}
(function ($) {
	$.fn.showTopbarMessage = function (options) {

		var defaults = {
			background	: "#E41004",
			borderColor	: "#000",
			foreColor	: "#FFFFFF",
			width		: "960px",
			height		: "95px",
			fontSize	: "16px",
			close		: "click"
		};
		var options = $.extend(defaults, options);

		var barStyle = " width: " + options.width + "; position: fixed; height: " + options.height + "; top: 0px;left: 0px;right: 0px;margin: 0px;display: none; left: 50%; margin-left: -480px; z-index: 3200;";
		var overlayStyle = "height: " + options.height + "; background-color: " + options.background + ";border-bottom: solid 5px " + options.borderColor + ";";
		var messageStyle = " width: 100%;position: absolute;height: " + options.height + ";top: 0px;left: 0px;right: 0px;margin: 0px;color: " + options.foreColor + "; font-size: " + options.fontSize + "; text-align: center;padding: 10px 0px";

		return this.each(function () {
			obj = $(this);

			if ($(".topbarBox").length > 0) {
				// Hide already existing bars
				$(".topbarBox").hide()
				$(".topbarBox").slideUp(200, function () {
					$(".topbarBox").remove();
				});
			}


			var html = ""
                + "<div class='topbarBox' style='" + barStyle + "'>"
                + "  <div style='" + overlayStyle + "'>&nbsp;</div>"
                + "  <div style='" + messageStyle + "'>" + obj.html() + "</div>"
                + "</div>"

			if (options.close == "click") {
				$(html).click(function () {
					$(this).slideUp(200, function () {
						$(this).remove();
					});
				}).appendTo($('body')).slideDown(200);
			}
			else {
				$(html).appendTo($('body')).slideDown(200).delay(options.close).slideUp(200, function () {
					$(this).remove();
				});
			}

		});
	};
})(jQuery);
