// Create images rollovers
$(document).ready(function() {
  $(".rollover").bind("mouseover", function() {
		var pid = "rollover_"+Math.round(Math.random()*10000);
//alert(pid);
		$(".blastmaster").remove();
  	$("body").append('<div class="blastmaster" id="'+pid+'" style="display:none; position:absolute; background: #eee; padding: 10px; z-index: 10"></div>');
		$("#"+pid).html('<img src="" style="border:1px solid #000" />');
		$("#"+pid+" img").attr("src", $(this).attr("src"));
		$("#"+pid).show();
		var start_width = $(this).width() * 1.1;
		var start_height = $(this).height() * 1.1;
		var end_width = $("#"+pid+" img").width();
		var end_height = $("#"+pid+" img").height();
		var offst = $(this).offset();

		$("#"+pid).css({"left" : offst.left, "top" : offst.top});
		$("#"+pid+" img").css({ width: start_width+'px', height: start_height+'px' });

		$("#"+pid)
			.stop()
			.animate({ left: offst.left-(end_width-start_width)/2, top: offst.top-(end_height-start_height)/2 }, 800);
		$("#"+pid+" img")
			.stop()
			.animate({ width: end_width+'px', height: end_height+'px' }, 800);

		$("#"+pid).unbind("mouseout");

		$("#"+pid).bind("mouseout", function() {

			$("#"+pid)
				.stop()
				.animate({"left" : offst.left, "top" : offst.top}, 0);
			$("#"+pid+" img")
				.stop()
				.animate({ width: start_width+'px', height: start_height+'px' }, 0);

			setTimeout(function(){
				$("#"+pid).hide();
			}, 0);

		});

	});

});
