{include file="$gentemplates/$header_tpl"}
	<div style="width:100%;overflow:hidden;">
		<dl style="padding-left:15px;">
        	<dt style="width:50%;" class="float_left" align="{$default_left}">
				<h2>{$lang.games.header}</h2>
        	</dt>
        	<dt style="width:50%" class="float_right" align="{$default_right}">
        	<div id="info" style="text-align: {$default_right};">
        	{if $games_settings.use_paid eq '1'}
        		{if $order eq '1'}
	        		<div class="tool_tip" id="tool_tip"><label title="{$games_settings.price} {$cur} / {$games_settings.period} {$lang.games.period_day} {$lang.games.tool_tip}"><input type="button" onclick="javascript: document.location.href='games.php?sel=order'" value="{$lang.games.button_play_paid}" class="big_button"></label></div>
	        	{else}
	        		<div class="iyf_head" style="margin-top:15px; text-align:{$default_right}" id="period"></div>
	        	{/if}
	        {/if}
	        </div>
        	</dt>
        </dl>
    </div>
	<div class="content content_adult_2" style="margin: 0px; padding: 15px;">
		<div style="margin: 0px; padding: 0px;">
		<h3 class="p-b5">{$lang.games.most_active_players}</h3>
		<div>
		<dl style="padding-top: 25px; overflow: hidden;" valign="top">			
			{foreach item=item from=$active_players}
			<dt style="width:20%;" align="center" valign="top" class="text">
				<div>
					<a class="imgcanvas_container" href="viewprofile.php?id={$item.id}&amp;sel=4" target="_blank"><img class="imgcanvas" src="{$item.icon}" border="0" class="icon" alt=""></a>
				</div>
				<div style="padding-top: 3px;"><a href="viewprofile.php?id={$item.id}&amp;sel=4" target="_blank">{$item.name}</a></div>
			</dt>
			{/foreach}				
		</dl>
		<dl>
			<dd style="width:100%; padding: 15px 0 0 0;" align="{$default_right}">
				<a href="quick_search.php?sel=active_players">{$lang.games.view_more}</a>
			</dd>
		</dl>
		</div>
		</div>
	</div>
	<div class="content content_adult_2" style="margin-top: 0px; padding:0px 15px;">
		<div style="margin: 0px; ">
		<h3 class="p-b5">{$lang.games.latest_games}</h3>
		<div style="width:100%;overflow:hidden;">
		<dl>
			<dd valign="top">
			<div style="width:100%;">
				{section name=c loop=$new_games}
				{if $smarty.section.c.index is div by 6}<dl>{/if}
					<dt style="width:16%" valign="top" align="center" class="text" style="padding-top: 25px;">
					{if $new_games[c].name}
						<div>
							<dl>
								<dd valign="top" align="center">
									<div style="cursor:pointer;" onclick="Play({$new_games[c].id_category},{$new_games[c].id},{$new_games[c].paid});"><img src="{$new_games[c].icon}" height="100" width="100" style="border: 1px solid #cccccc;" class="icon" alt=""></div>
								</dd>
							</dl>
							<dl>
								<dd valign="top" align="center" style="padding-top: 5px;">
									{if $games_settings.use_paid eq '1'}
										<div align="center"><font class="text_hidden">{if $new_games[c].paid eq '1'}{$lang.games.price_paid}{else}{$lang.games.price_free}{/if}</font></div>
									{/if}
									<div style="width:103px;height:35px;overflow:hidden;"><font class="text">{$new_games[c].name}</font></div>
								</dd>
							</dl>
						</div>
					{/if}
					</dt>
				{if $smarty.section.c.index_next is div by 6 || $smarty.section.c.last}</dl>{/if}
				{/section}
			</div>
			</dd>
		</dl>
		</div>
		</div>
	</div>
	<div class="content content_adult_2" style="margin-top: 0px; padding:0px 15px;">
		<div style="margin: 0px; ">
		<h3 class="p-b5">{$lang.games.most_played_games}</h3>
		<div style="width:100%;">
		<dl>
			<dd valign="top">
			<div style="width:100%;">
				{section name=c loop=$popular_games}
				{if $smarty.section.c.index is div by 6}<dl>{/if}
					<dt style="width:16%" valign="top" align="center" class="text" style="padding-top: 25px;">
					{if $popular_games[c].name}
						<div>
							<dl>
								<dd valign="top" align="center">
									<div style="cursor:pointer;" onclick="Play({$popular_games[c].id_category},{$popular_games[c].id},{$popular_games[c].paid});"><img src="{$popular_games[c].icon}" height="100" width="100" style="border: 1px solid #cccccc;" class="icon" alt=""></div>
								</dd>
							</dl>
							<dl>
								<dd valign="top" align="center" style="padding-top:5px;">
									{if $games_settings.use_paid eq '1'}
									<div align="center"><font class="text_hidden">{if $popular_games[c].paid eq '1'}{$lang.games.price_paid}{else}{$lang.games.price_free}{/if}</font></div>
									{/if}
									<div style="width:103px;height:35px;overflow:hidden;"><font>{$popular_games[c].name}</font></div>
								</dd>
							</dl>
						</div>
					{/if}
					</dt>
				{if $smarty.section.c.index_next is div by 6 || $smarty.section.c.last}</dl>{/if}
				{/section}
			</div>
			</dd>
		</dl>
		</div>
		</div>
	</div>
<script type="text/javascript">
var order = {$order};
var use_paid = {$games_settings.use_paid};
var button = '<div class="tool_tip" id="tool_tip"><label title="{$games_settings.price} {$cur} / {$games_settings.period} {$lang.games.period_day} {$lang.games.tool_tip}"><input type="button" onclick="javascript: document.location.href=\'games.php?sel=order\'" value="{$lang.games.button_play_paid}" class="big_button"><\/label><\/div>';
var period = '<div class="iyf_head" style="margin-top:17px; text-align:{$default_right}" id="period"><\/div>';
{literal}
function Play(id_category,id,paid) {
	if (order==1 && paid==1) {
		launchWindow('games.php','sel=get_popup&id_category='+id_category+'&id_game='+id+'',470,240);
	} else {
		document.location.href='games.php?sel=play&id_category='+id_category+'&id_game='+id;	
	}
}
$(document).ready(function(){
	$('#tool_tip *').tooltip();
});
{/literal}
{if $games_settings.use_paid eq '1'}
{literal}
var flag = 1;
if (use_paid == 1 && order == 0) $('#info').html(period);
if (use_paid == 1 && order == 1) $('#info').html(button);
setInterval (function(){GetTime();}, 60000);
$(window).load(function () {
	GetTime();
});
function GetTime() {
	if (flag == 0) return;
	$.post("games.php",{sel:"get_time"},
		function(data){
			if (data != '0') {
				$("#period").html(data);
			} else {
				$('#info').html(button);
				flag = 0;
			}
		}
	);
}
{/literal}
{/if}
{literal}
{/literal}
</script>
{include file="$gentemplates/$footer_tpl"}