(function($) {

	$.randombg = {
		defaults: {
			directory: "imagens/backgrounds/",
			howmany: 6

		}
	}
    $.fn.extend({
        randombg:function(config) {
            var config = $.extend({}, $.randombg.defaults, config);
			return this.each(function() {
		
				var directory = config.directory, howmany = config.howmany;

				var which = Math.floor(Math.random()*howmany)+1;
				$(this).css({"background-image" : "url(" +directory + which + ".gif)"});
			  
            })
        }
    })
})(jQuery);
