function printGame (divId, filePath, width, height) {
	var usage_width = 618;
	if (width != 0 && width < 618) {
		usage_width = width;
	}
	var usage_height = 449;
	if (height != 0 && height < 449) {
		usage_height = height;
	}
	$('#' +	divId).flash(
		{ src: filePath, width:	usage_width, height: usage_height, bgcolor: '#ffffff', quality: 'high', menu: false,	wmode: 'transparent', swliveconnect: 'true', allowScriptAccess:	'always', allowFullScreen: true	},
		{ version: '9.0.115' }
	);
}

// ##########################################################
// # Rollover manager                                       #
// # Thanks http://www.jqueryfordesigners.com/              #
// ##########################################################

function rollover(image) {

	// Crossfade the initial image out (and so the new one in)
	image.stop().animate({opacity: 0}, 150);

}

function rollout(image)	{

	// Crossfade the initial image back in (and so the new one out)
	image.stop().animate({opacity: 1}, 150);

}

function initRollovers() {

	// Add the rollover images everywhere .class is set
	$(".rollover").each(function () {

		// Constants
		var	ROLLOVER_SUFFIX	= "_over";

		// All images with class .rollover
		var image = $(this);

		// Details
		var	src = image.attr('src');
		var	imageExtension = src.substring(src.lastIndexOf("."), src.length);
		var	srcWithoutExtension	= src.substring(0, src.lastIndexOf("."));

		// Prepare the over	image src
		var	overImageSrc = srcWithoutExtension + ROLLOVER_SUFFIX + imageExtension;

		// Print the relative span
		image.wrap('<span style="position: relative;"></span>');

		// Print the over image into the span
		image.parent().prepend('<img src="' + overImageSrc + '" width="' + image.attr('width') + '" height="' + image.attr('height') + '" border="0" style="border: 0px solid black;" />');

		// Move	the initial image according to relative span (with hack because we like Chrome)
		if ($.browser.msie || $.browser.mozilla) {
			image.css({
				'position' : 'absolute', 
				'left' : 0, 
				'top' : this.offsetTop
			});
		} else {
			image.css({
				'position' : 'absolute', 
				'left' : 0
			});
		}

	});

	// Apply rollover functions everywhere .class is set
	$(".rollover").hover(function(){rollover($(this))}, function(){rollout($(this))});

}

// Launch
$(document).ready(function(){
	// Have to wait for images
	$(window).bind('load', function () {
		initRollovers();
	});
});

// ##########################################################
