(function($) {
    $.fn.wait = function(option, options) {
        milli = 1000; 
        if (option && (typeof option == 'function' || isNaN(option)) ) { 
            options = option;
        } else if (option) { 
            milli = option;
        }
        var defaults = {
            msec: milli,
            onEnd: options
        },
        settings = $.extend({},defaults, options);

        if(typeof settings.onEnd == 'function') {
            this.each(function() {
                setTimeout(settings.onEnd, settings.msec);
            });
            return this;
        } else {
            return this.queue('fx',
            function() {
                var self = this;
                setTimeout(function() { $.dequeue(self); },settings.msec);
            });
        }

    }
})(jQuery);


function changeCookie(status){
	$.cookies.set("featureView",status, {hoursToLive: 168});
}

function notify(message){
	if(!message){
		var message = "This event has been successfully posted to Facebook.";
	}
	$('.notify').html(message).fadeIn(500).wait(3000).fadeOut(1000);
}
$(document).ready(function(){
	$("#showHideFeature").css('display','block');
	$("#showHideFeature").toggle(
			function(){
				$(this).text("+ show feature");
				$(".feature").hide(500);
				changeCookie(0);},
			function(){
				$(".feature").show(500);
				$(this).text(" - hide feature");
				changeCookie(1);
				});
	if ($.cookies.get("featureView")==0){
		$(".feature").hide();
		$("#showHideFeature").click();
	} 
});