/* * Affiliate Lounge / Casino Euro free games script. * Allows Casino Euro Free Games to be displayed and tracked * via the Affiliate Lounge tracking system * * dmaworsley 2009 */ /* * These REALLY can't be defined in a function - if they are the whole thing doesn't work - go figure. */ var script=document.getElementsByTagName('script'); var mS=script[ script.length - 1 ]; var querySring=mS.src.replace(/^[^\?]+\??/,''); /* * functions to get the params from the js query string */ function getParamArray() { var param = parseJSQuery(querySring); return param; } function parseJSQuery(query) { var parameters=new Object(); if (!query) return parameters; var pieces=query.split(/[;&]/); for (var i=0; i 1) { val = val + '=' + deeplink; } val=val.replace(/\+/g, ' '); parameters[key]=val; }; return parameters; } /* * To stop this being declared everywhere make it global */ var params = getParamArray(); function showGameForAffiliateLounge() { //get the params from the js query string supplied by AL var lg = params['lang'].toString(); var h = params['height'].toString(); var w = params['width'].toString(); var game = params['gameNAME'].toString(); var clickTag = params['clickTAG'].toString(); var divId = params['divID'].toString(); var timeout = params['timeout'].toString(); //divID and gameID and clickTag have to be set, the rest can be defaulted if((divId != null || divId != "") && (game != null || game != "") && (clickTag != null || clickTag != "")) { /* defaults */ if(lg == null){ lg ="en";} if(h == null){ h = 400;} if(w == null) { w = 500;} if(timeout == null || timeout == '') { timeout = 4.0;} if(timeout > 7.0) { timeout = 7.0;} getAffGameScript(game, lg, h, w, timeout, "false", clickTag, "ce-freeplay-site-prompt.swf"); } else { window.alert("Unable to load game. divId or gameId not set"); } } function getAffGameScript(gameName, lang, height, width, timeout, branded, url, replaceFlash) { var objectId = getUniqueName("game", gameName); var tableName = getUniqueName("table", gameName); var ruleServer = "http://casinoeuro.casinomodule.com"; var gameServer = "http://casinoeuro-proxy.casinomodule.com/"; //var gameServer = "http://casinoeuro-api.casinomodule.com/"; var unbrandedPath = branded == "false" ? "unbranded/" : ""; var gameURL = gameServer + "flash/" + unbrandedPath + gameName + "/" + lang + "/loader.swf"; var flashVars = ""; if(gameName == 'goldtimer') { flashVars = "helpURL=javascript%3Arules%28%27%2Fen%2Fgamerules.jsp%3Fgame%3Dgoldtimer_sw%26gameTitle%3Dgoldtimer%26countryCode%3D" + lang + "%27%29&historyURL=javascript%3Ahistory%28%27%2Fen%2Flast20.jsp%27%29&closeURL=javascript%3Awindow.close%28%29&lang=" + lang + "&gameId=goldtimer_sw¤cyChar=€&symbol1=€&symbol2=¢&gameurl=goldtimer.swf&server=http%3A%2F%2Fcasinoeuro.casinomodule.com%3A80%2F&fullscreen=false"; } else if(gameName == 'fruits') { flashVars = "helpURL=javascript%3Arules%28%27%2Fen%2Fgamerules.jsp%3Fgame%3Dfruits_sw%26gameTitle%3Dfruits%26countryCode%3Den%27%29&historyURL=javascript%3Ahistory%28%27%2Fen%2Flast20.jsp%27%29&closeURL=javascript%3Awindow.close%28%29&lang=en&gameId=fruits_sw&currencyChar=€&symbol1=€&symbol2=¢&gameurl=fruits.swf&server=http%3A%2F%2Fcasinoeuro.casinomodule.com%3A80%2F&fullscreen=false"; } else if(gameName == 'alienrobots') { flashVars = "helpURL=javascript%3Arules%28%27%2Fen%2Fgamerules.jsp%3Fgame%3Dalienrobots_sw%27%29&historyURL=javascript%3Ahistory%28%27%2Fen%2Flast20.jsp%27%29&closeURL=javascript%3Awindow.close%28%29&lang=en&gameId=alienrobots_sw¤cyChar=�&symbol1=�&symbol2=�&gameurl=alienrobots.swf&server=http%3A%2F%2Fcasinoeuro.casinomodule.com%3A80%2F&fullscreen=false"; } else { flashVars = "gameId=" + gameName + "_sw" + "&" + "lang=" + lang + "&" + "currencyChar=EUR&" + "symbol1=EUR&" + "symbol2=c&" + "gameurl=" + gameName + ".swf&" + "server=" + ruleServer + "&fullscreen=false&disableAudio=true"; } var strFlash = "" + "" + "" + "" + "" + "" + "" + "" + " " + ""; var div = params['divID'].toString(); var obj = document.getElementById(div); obj.innerHTML = strFlash; //replace game provided the timeout is not infinite if (parseFloat(timeout) != 0) { var newFlashId = getUniqueName ("flash", "CE"); var newFlashURL = "http://static1.casinoeuro.com/skins/casinoeuro/flash/freegame-prompt/button-register-free-prompt-black-" + lang + ".swf"; var clickTag = url; var newFlash = "" + "" + "" + "" + "" + "" + "" + " " + ""; //setTimeout("alert('"+newFlash+"')", parseFloat(timeout) * 60000); setTimeout("document.getElementById ('"+div+"').innerHTML = '"+newFlash+"';", parseFloat(timeout) * 60000); } } function getNewFlashLang(currentLang) { if (currentLang.toLowerCase() == "de" || currentLang.toLowerCase() == "en" || currentLang.toLowerCase() == "fi" || currentLang.toLowerCase() == "fr" || currentLang.toLowerCase() == "nl" || currentLang.toLowerCase() == "no" || currentLang.toLowerCase() == "sv") { return currentLang; } return "en"; } function getUniqueName(prefix, gameName) { var found = 1; var count = 0; while (true) { var x = document.getElementById(prefix + gameName + count); if (x == null) { return prefix + gameName + count; } count++; } } /* * Load the Game */ showGameForAffiliateLounge();