(function($) {

	$.fbLikeBoxSlider = function(options) {

		var settings = {
			id : "nflcs_fb_like_box",

			fb : {
				width: "370",
				showFaces : "false",
				borderColor : " ",
				stream : "false",
				header : "false",
				appPath : ""
			},

			text : {
				title : "Like Us on Facebook",
				summary : "Get the Latest scoop!"
			}
		};


//	return this.each(function(){
			if(options) {
				$.extend(true, settings, options);
			}

			var markup = getCoreMarkup(settings);

			if(typeof(FB) == "undefined") {
				$.getScript("http://connect.facebook.net/en_US/all.js#xfbml=1", function(){
					$.FbAppsApi.init("");
					markup.append(createFBLikebox(settings));
					attachBehaviors(markup);
					$("body").append(markup);
				});
			}
			else {
				markup.append(createFBLikebox(settings));
				attachBehaviors(markup);
				$("body").append(markup);
			}
		return true;
	};


	function getCoreMarkup(settings) {
		return _markup = $("<div></div>").attr("id", settings.id)
			 .html("<div class=\"content\"><h1>" + settings.text.title + "</h1><p>" + settings.text.summary + "</p></div><div id=\"fb_like\"></div>");
	}

	function createFBLikebox(settings) {
	  var _fbLike = $("<fb:like-box></fb:like-box>");
		_fbLike.attr("width", settings.fb.width);
		_fbLike.attr("show_faces", settings.fb.showFaces);
		_fbLike.attr("border_color", settings.fb.borderColor);
		_fbLike.attr("stream", settings.fb.stream);
		_fbLike.attr("header", settings.fb.header);
		_fbLike.attr("href", settings.fb.appPath);

		return _fbLike;
	}

	function attachBehaviors(object) {
		if (!window.Touch) {
			object.mouseenter(function() {
				$nflcs(this).stop(true,true).animate({left: '-100'}, 200, function() {});
				$nflcs("#yt_movie").hide();
			}).mouseleave(function() {
				$nflcs(this).stop(true,true).animate({left: '-540'}, 200, function() {});
				$nflcs("#yt_movie").show();
			});
		}

		else {
			object.toggle(function() {
				$nflcs(this).stop(true,true).animate({left: '-100'}, 200, function() {});
				$nflcs("#yt_movie").hide();
			}, function() {
					$nflcs(this).stop(true,true).animate({left: '-540'}, 200, function() {});
					$nflcs("#yt_movie").show();
			});
		}
	}

})($nflcs);

$nflcs(document).ready(function() {
	$nflcs.fbLikeBoxSlider({
		fb : {
			appPath : "http://www.facebook.com/Raiders"
		},

		text : {
			title : "Raiders ON FACEBOOK",
			summary : "Exclusive Contests. Unique Content. Behind the Scenes Access."
		}

	});
});

