var fimDir = xmlstring;
var fimName = "fim";
var casinoSwf = "http://cache.download.pchprizes.co.uk/casinoclient.html";
var casinoMode = null;
var casinoMiniMode = null;
 
function fimReady() 
{
	getFim(fimName).initClient("casino", casinoSwf,"fimFrame");	
	getFim(fimName).initUser("","");
	getFim(fimName).setCallout("casino", "calloutPlayforreal");
	getFim(fimName).setCallout("cashier", "calloutCashier");
	getFim(fimName).setCallout("exit", "calloutExit");
	getFim(fimName).setCallout("funtoreal", "calloutFuntoreal");
	showCasinoGame();
}
 
function getFim(swfId)
{
	if (window[swfId]) 
	{
		return window[swfId];
	}
	return document[swfId];
}
 
function calloutCashier()
{
	$('#cashier', window.parent.document).click();
}
 
function calloutFuntoreal(module) 
{
	document.location = document.URL.replace("free","cash");
}
 
function calloutPlayforreal(module) 
{
	getFim(fimName).launchClient("casino", module, null);
}

function calloutExit()
{
	document.location = "http://www.pchprizes.co.uk/games/";
}
 
function launchCasino(module) 
{
	getFim(fimName).launchClient("casino", module, null);
}
 
function launchCasinoOffline(module) 
{
	getFim(fimName).launchClient("casino", module, "offline");
}
 
function closeCasino()
{getFim(fimName).close("casino");}

function showCasinoGame()
{	
	
	if(ptMode=="cash")
	{launchCasino(ptCode);}
	else if(ptMode="free")
	{launchCasinoOffline(ptCode);}
}
