﻿function SWFSelectGame(gameIndex) {
    window.location = "#top";
	// Selects the game from the dropdownlist
	// PLEASE NOTE: the gameIndex passed to the function is the <code>gameIndex</code> in the gamefeed.xml
	// PLEASE NOTE: the gameIndex matches the selectedIndex of the dropdownlist - so if there's a new game added to the flash, the dropdown needs to be updated accordingly
    //document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect").selectedIndex = gameIndex;
    var controlName;
    if (document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect");
    } else if (document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect");
    }
    controlName.selectedIndex = gameIndex;
    
	var gameArray = new Array();
	gameArray[0] = "3_card_poker.gif";
	gameArray[1] = "baccarat.gif";
	gameArray[2] = "blackjack.gif";
	gameArray[3] = "double_magic_slots.gif";
	gameArray[4] = "fruit_fiesta.gif";
	gameArray[5] = "jacks_or_better.gif";
	gameArray[6] = "keno.gif";
	gameArray[7] = "major_millions.gif";
	gameArray[8] = "pub_fruity.gif";
	gameArray[9] = "roulette.gif";
	gameArray[10] = "royal_derby.gif";
	gameArray[11] = "scratch_card.gif";
	gameArray[12] = "scratch_n_score.gif";
	gameArray[13] = "thunderstruck.gif";
	gameArray[14] = "tomb_raider.gif";
	gameArray[15] = "treasure_nile.gif";

	var game = document.getElementById("game");
	game.style.background = "url(images/demo-gamescreens/" + gameArray[gameIndex] + ")";

	DisplayGamePreview(this, gameIndex);
}

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet") == -1) {
		if (document.embeds && document.embeds[movieName])
			return document.embeds[movieName];
	}
	else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
	{
		return document.getElementById(movieName);
	}
}

function DisplayGamePreview(obj, gameIndex) {

    if (document.getElementById("gameview") != null) show("gameview");
    if (document.getElementById("gameviewContent") != null) show("gameviewContent");
    showGameViewModal('gamePreviewScreen');

    var gameArray = new Array();
    gameArray[0] = "3cardpoker.gif";
    gameArray[1] = "baccarat.gif";
    gameArray[2] = "blackjack.gif";
    gameArray[3] = "doublemagic.gif";
    gameArray[4] = "fruitfiesta.gif";
    gameArray[5] = "jacksorbetter.gif";
    gameArray[6] = "keno.gif";
    gameArray[7] = "majormillions.gif";
    gameArray[8] = "pubfruity.gif";
    gameArray[9] = "roulette.gif";
    gameArray[10] = "royalderby.gif";
    gameArray[11] = "scratchcard.gif";
    gameArray[12] = "scratchnscore.gif";
    gameArray[13] = "thunderstruck.gif";
    gameArray[14] = "tombraider.gif";
    gameArray[15] = "treasurenile.gif";

    var game = document.getElementById("gamesImageBox");
    game.style.background = "url(../images/game-preview/large/" + gameArray[gameIndex] + ") no-repeat top left";

    var gameTitleArray = new Array();
    gameTitleArray[0] = "3 Card Poker";
    gameTitleArray[1] = "Baccarat";
    gameTitleArray[2] = "Blackjack";
    gameTitleArray[3] = "Double Magic";
    gameTitleArray[4] = "Fruit Fiesta";
    gameTitleArray[5] = "Jacks or Better";
    gameTitleArray[6] = "Keno";
    gameTitleArray[7] = "Major Millions";
    gameTitleArray[8] = "Pub Fruity";
    gameTitleArray[9] = "Roulette";
    gameTitleArray[10] = "Royal Derby";
    gameTitleArray[11] = "Scratch Card";
    gameTitleArray[12] = "Scratch 'n Score";
    gameTitleArray[13] = "Thunderstruck";
    gameTitleArray[14] = "Tombraider";
    gameTitleArray[15] = "Treasure Nile";

    var gameTitle = document.getElementById("popUpGameTitle");
    gameTitle.innerHTML = gameTitleArray[gameIndex];    

    var gameTxtArray = new Array();
    gameTxtArray[0] = "Play your cards right and reap the rewards. 3 Card Poker brings you two games in one – the Pair Plus & Ante games. Play it individually or double your fun and play both at once!";
    gameTxtArray[1] = "The odds are high and the action endless. Try your hand at a game of Baccarat, bet whose hand will be closer to 9 – player, dealer or a tie – and watch the riches roll your way!";
    gameTxtArray[2] = "Think you’ve got what it takes to take on the dealer? Show your steel in a game of Classic Blackjack, played with one standard deck of 52 cards. Get a better hand without exceeding 21 or bust the dealer to cash in!";
    gameTxtArray[3] = "Spin & win – no trickery! Multiply your winnings on the 3 reel, 1 payline and 2 coin Double Magic slot machine!";
    gameTxtArray[4] = "Go nuts with a fruity feast and strike it lucky on this 3 reel, 3 payline and 3 coin slot machine. With multiple paylines, Fruit Fiesta gives its players more ways to win. Bet three coins and the progressive jackpot is triggered!";
    gameTxtArray[5] = "Take on the dealer for a game of Jacks or Better. When dealt 5 cards, choose which ones to hold and which to discard. Complete the game with the strongest hand and cash in!";
    gameTxtArray[6] = "Pick a number between 1 & 80, cross your fingers & wait – today could be your lucky day! If your lucky numbered ball is drawn, cash rewards are sure to follow!";
    gameTxtArray[7] = "You're in the money with Major Millions! This 3 reel, 3 payline and 3 coin slot machine’s multiple paylines increase your chances of winning – as do its wild multiplier symbol and progressive jackpot which is activated by a 3 coin bet.";
    gameTxtArray[8] = "Go fruity and cash in on this 3 reel, 1 payline slots game. Pub Fruity is filled with entertaining treats such as sound effects, 3D simulation & 2 bonus feature games!";
    gameTxtArray[9] = "Spin the wheel and leave it up to luck! Predict where the ball will land, get it right and you could pocket a whole heap of winnings.";
    gameTxtArray[10] = "Get ready for a day at the races with Royal Derby. From horse selection, placing a bet, race animation and result display this game will keep you on your toes. Trust your instinct, make your selection and victorious winnings could be yours!";
    gameTxtArray[11] = "Scratch and win – it doesn’t get any easier! Get the right combination and winnings up to 50 times your bet could be coming your way!";
    gameTxtArray[12] = "Big on sports & keen to win? Receive 3 matching football-themed symbols, worth various amounts and win up to 50 times your originally placed bet!";
    gameTxtArray[13] = "Join the bearded god of thunder, Thor on one of his wild adventures when you play the 5 reel, 9 payline and 45 coin Thunderstruck slot game. You could conquer great winnings with a scatter, wild, free spins and gamble feature!";
    gameTxtArray[14] = "Join Lara on one of her wild adventures in this 5 reel, 15 payline and 75 coin slot machine. Multiplying your chances of winning is a treasure chest of symbols including a scatter, wild, free spins and a bonus game.";
    gameTxtArray[15] = "Find your fortune with Treasure Nile! This 5 reel, 9 line and 9 coin progressive slot machine was the web’s first 9 line payout progressive jackpot slot. With its jackpot growing by the minute, a world of wealth awaits.";

    var gameTxt = document.getElementById("popUpGameText");
    gameTxt.innerHTML = gameTxtArray[gameIndex];

    var gameDropDown = document.getElementById("ctl00_Optional_GamesPreviewDownload1_ddlGameSelect");
    gameDropDown.selectedIndex = gameIndex;
}

function CloseGamePreview() {
    var gv = document.getElementById("gamePreviewScreen");
    gv.style.display = "none";
}

function HTMLSelectGame() {
    //var gameIndex = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect").selectedIndex;
    var controlName;
    if (document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect");
    } else if (document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect");
    }
    var gameIndex = controlName.selectedIndex
	
	var flashMovie = getFlashMovieObject("gameMenu");
	
	var gameArray = new Array();
	gameArray[0] = "3_card_poker.gif";
	gameArray[1] = "baccarat.gif";
	gameArray[2] = "blackjack.gif";
	gameArray[3] = "double_magic_slots.gif";
	gameArray[4] = "fruit_fiesta.gif";
	gameArray[5] = "jacks_or_better.gif";
	gameArray[6] = "keno.gif";
	gameArray[7] = "major_millions.gif";
	gameArray[8] = "pub_fruity.gif";
	gameArray[9] = "roulette.gif";
	gameArray[10] = "royal_derby.gif";
	gameArray[11] = "scratch_card.gif";
	gameArray[12] = "scratch_n_score.gif";
	gameArray[13] = "thunderstruck.gif";
	gameArray[14] = "tomb_raider.gif";
	gameArray[15] = "treasure_nile.gif";

	if (document.getElementById("game")) {
	    var game = document.getElementById("game");
	    game.style.background = "url(images/demo-gamescreens/" + gameArray[gameIndex] + ")";

	    flashMovie.SetVariable("/:getBlurb", gameIndex);
	}
}

function HTMLSelectGameHome() {
    //var gameIndex = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect").selectedIndex;
    var controlName;
    if (document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlGameSelect");
    } else if (document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect")) {
        controlName = document.getElementById("ctl00_ContentLeft_HomeDownload_ddlGameSelect");
    }
    var gameIndex = controlName.selectedIndex

	var flashMovie = getFlashMovieObject("gameMenu");

	var gameArray = new Array();
	gameArray[0] = "3_card_poker.gif";
	gameArray[1] = "baccarat.gif";
	gameArray[2] = "blackjack.gif";
	gameArray[3] = "double_magic_slots.gif";
	gameArray[4] = "fruit_fiesta.gif";
	gameArray[5] = "jacks_or_better.gif";
	gameArray[6] = "keno.gif";
	gameArray[7] = "major_millions.gif";
	gameArray[8] = "pub_fruity.gif";
	gameArray[9] = "roulette.gif";
	gameArray[10] = "royal_derby.gif";
	gameArray[11] = "scratch_card.gif";
	gameArray[12] = "scratch_n_score.gif";
	gameArray[13] = "thunderstruck.gif";
	gameArray[14] = "tomb_raider.gif";
	gameArray[15] = "treasure_nile.gif";

	var game = document.getElementById("game");
	game.style.background = "url(images/demo-gamescreens/" + gameArray[gameIndex] + ")";
}

function CountryCodeUpdater(CountryDDL, CountryCodeTXT) {
	var country = document.getElementById(CountryDDL);
	var countryCode = document.getElementById(CountryCodeTXT);

	countryCode.value = "+" + country.options[country.selectedIndex].value;
}

function CountryCodeSelect() {
	var country = document.getElementById("ctl00_ContentPlaceHolder1_HomeDownload_ddlCountry");
	country.selectedIndex = 129;
}

function DisplaySecDownload() {
	document.getElementById("secFreeDownload").style.display = "block";
}

function CloseSecDownload() {
	document.getElementById("secFreeDownload").style.display = "none";
}

function CloseThankYou() {
	document.getElementById("thankYou").style.display = "none";
}

function DisplayThankYou() {
	document.getElementById("thankYou").style.display = "block";
	//return false;
}