$(document).ready(function(){
	var title="";
	var images;
	var i = 0;
	$('.preview').hover(function(e) {
		images = $(this).children('img');
		title = $(this).parent('a').attr('title');
		$(this).parent('a').attr('title', "");
		if (images.length > 1) {
			if ($(images[1]).attr('src') == "") {
				var b = $(images[0]).attr('src');
				var basename = b.substring(0, b.lastIndexOf('.'))
				
				for(var i = 1; i < 6;i++) {
					$(images[i]).attr('src', basename + "-00" + i + ".jpg");
				}
			}
			i=0;
			$(this).everyTime("1s", function() {
				$(images[i]).css('visibility', 'hidden');
				i=i+1;
				if (i == images.length) {
					i=1;
				}
				$(images[i]).css('visibility', 'visible');
			});
		}


	}, function(e) {
		$(this).stopTime();
		$(this).children('img').css('visibility', 'hidden');
		$(this).children('img:first').css('visibility', 'visible');	
		$(this).parent('a').attr('title', title);
	});
});