(function($){
	function _debug(msg){
		if(window.console) {
			console.debug(msg);
		} else {
			alert(msg);
		}
	}
	
	bbAdBar = function(options) {		
		var defaults = {
			color: "blue",
			fontColor: "#FFFFFF",
			img: "none",
			txt: "none",
			position: "top",
			destination: "none"
		}
	
		// Over ride the defaults
		var o = jQuery.extend(defaults, options);
		
		// make the bar
		var e = $("<div id='BlackBeltBanner'></div>"); // build the bar
		
		// add the bar to the body
		if(o.position == "top"){
			$('body').prepend(e); // put it into the DOM
		} else if (o.position == "bottom"){
			$('body').append(e); // put it into the DOM
		}
		
		// set the color for the bar
		if(o.color == "blue"){
			$('div#BlackBeltBanner').addClass('blue').css('color',o.fontColor);  // set the class to blue
		} else if(o.color == "red"){
			$('div#BlackBeltBanner').addClass('red').css('color',o.fontColor);  // set the class to red
		} else {
			$('div#BlackBeltBanner').css('background-color',o.color).css('color',o.fontColor);  // set the attribute to the color entered
		}
	
		// set the text/image for the bar
		if(o.img == "none"){
			if(o.txt == "none"){
				$('div#BlackBeltBanner').append("YOU HAVENT SELECTED ANY PERSONALIZED OPTIONS"); // drop text in banner
			} else {
				if(o.destination == "none"){
					var text = o.txt; // create the text
				} else {
					var text = $("<a href='"+o.destination+"' target='_self'>"+o.txt+"</a>"); // create the text
				}
				$('div#BlackBeltBanner').append(text); // drop text in banner
			}
		} else {
			if(o.destination == "none"){
				var image = $("<img src='"+o.img+"' alt='' height='37' />"); // build the image container
			} else {
				var image = $("<a href='"+o.destination+"' target='_self'><img src='"+o.img+"' alt='' height='37' /></a>"); // build the image container
			}
			$('div#BlackBeltBanner').append(image); // drop image in banner
		}
	}
})(jQuery);
