/**
 * jQuery random background changer
 * @name Random Background Changer
 * @author Charles Harvey - http://www.charles-harvey.co.uk
 * @version 0.1
 * @date September 4 2009
 * @category jQuery plugin
 * @copyright (c) 2009 Charles Harvey
 */

var directorio;
(function($) {
		  
 if(screen.width <=  1024){
	   directorio :"fotos/fondos/";
	   }
	 else{
	   directorio :"fotos/fondosG/"
	   }
	$.randombg = {
		
		
		defaults: {
			directory:"fotos/fondosG/",
			howmany: 5

		}
	}
    $.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" : "url(" +directory + which + ".jpg) no-repeat fixed center #883257"});
			  
            })
        }
    })
})(jQuery);
