$(document).ready(function(){



$(".roll").hover(
	function() {
		$(this).not(".rollhi").attr("src", $(this).attr("src").split('-off.').join('-on.'));
	}, 
	function(){
		$(this).not(".rollhi").attr("src", $(this).attr("src").split('-on.').join('-off.'))
	}
);


$.preloadImages = function() {
var a = (typeof arguments[0] == 'object')? arguments[0] : arguments;
	for(var i = a.length -1; i > 0; i--) {
			$("<img>").attr("src", a[i]);
	}
}

var images = [];
$('.roll').each(function(){
    images.push($(this).html());
});

$.preloadImages(images);


});

jQuery.fn.idle = function(time) {
      var o = $(this);
      o.queue(function()
      {
         setTimeout(function()
         {
            o.dequeue();
         }, time);
      });
      return this;   
}

function rollhi(hi) {
	var on = $('.' + hi);
	$(on).attr("src", $(on).attr("src").split('-off.').join('-on.'));
	$(on).addClass("rollhi");
}

