/* home page */

var selGameRequest = 0;
function selDiv(objid) {
	selGameRequest = setTimeout("selDivDelay('" + objid + "')",175);
}

function selDivDelay(objid) {
	if (objid != 'most-popular') {
		$('div_most-popular').hide();
		$('title_most-popular-on').hide();
		$('title_most-popular').show();
	}
	if (objid != 'table-games') {
		$('div_table-games').hide();
		$('title_table-games-on').hide();
		$('title_table-games').show();
	}
	if (objid != 'video-poker') {
		$('div_video-poker').hide();
		$('title_video-poker-on').hide();
		$('title_video-poker').show();
	}
	if (objid != 'video-slots') {
		$('div_video-slots').hide();
		$('title_video-slots-on').hide();
		$('title_video-slots').show();
	}
	if (objid != 'slots') {
		$('div_slots').hide();
		$('title_slots-on').hide();
		$('title_slots').show();
	}
	$('title_'+objid).hide();
	$('title_'+objid+'-on').show();
	$('div_'+objid).show();
	//Effect.BlindDown('div_'+objid, {duration: 0.5});
}

var act = 1;
var delay_turn = false;
//Flash bottom-right corner of the homepage
function launch_Game() {
	openWindowFull(best_games_url[act-1],"best_games");
}
//Flash top-right corner of the homepage
function launch_button(btn_number) {
	if (btn_number == 1) //normal download Button
		openWindowFull(button_flash_url[btn_number-1],"play_games");
	else if (btn_number == 2)
		document.location = button_flash_url[btn_number-1];
}

function turn_right() {
	if (!delay_turn) {
		delay_turn = true;
		$('id_flash').turnR();
		setTimeout("turn_right_delay()", 550);	
	}
}
function turn_left() {
	//clearTimeout(delay_turn);
	if (!delay_turn) {
		delay_turn = true;
		$('id_flash').turnL();
		setTimeout("turn_left_delay()", 550);	
	}
}
function turn_left_delay() {
	//$('id_flash').changeText('blala');
	//$('id_flash').turnL();
	$('game'+act).hide();
	if (act > 1) {
		act -= 1;
	} else {
		act = 3;
	}
	$('game'+act).show();

	if (act == 1) {
		$('bestgame_left').innerHTML = best_games[2];
		$('bestgame_right').innerHTML = best_games[1];
	} else if (act == 2) {
		$('bestgame_left').innerHTML = best_games[0];
		$('bestgame_right').innerHTML = best_games[2];
	} else if (act == 3) {
		$('bestgame_left').innerHTML = best_games[1];
		$('bestgame_right').innerHTML = best_games[0];
	}
	delay_turn = false;
}
function turn_right_delay() {
	//$('id_flash').turnR();
	$('game'+act).hide();
	if (act < 3) {
		act += 1;
	} else {
		act = 1;
	}
	$('game'+act).show();
	
	if (act == 1) {
		$('bestgame_left').innerHTML = best_games[2];
		$('bestgame_right').innerHTML = best_games[1];
	} else if (act == 2) {
		$('bestgame_left').innerHTML = best_games[0];
		$('bestgame_right').innerHTML = best_games[2];
	} else if (act == 3) {
		$('bestgame_left').innerHTML = best_games[1];
		$('bestgame_right').innerHTML = best_games[0];
	} 
	delay_turn = false;
}