{include file="$gentemplates/$header_tpl"}
	<div style="overflow:hidden;">
	<div style="width:100%;">
		<dl style="padding-left:15px;">
        	<dt style="width:50%" align="{$default_left}">
				<h2>{$lang.games.header}</h2>
        	</dt>
        	<dt style="width:50%" align="{$default_right}">
        		<div id="info" style="text-align: 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="text-align:{$default_right}" id="period"></div>
	        		{/if}
	        	{/if}
	        	</div>
        	</dt>
        </dl>
    </div>
    </div>
	<div class="content content_adult_2" style="margin: 0px; padding: 15px;">
		<div style="margin: 0px; padding: 0px;">
		<h3 class="p-b5">{$category_sel}</h3>
		
		{if $links_top}
		<div style="display:table;width:100%;">
			<div style="float:right;padding: 15px 0;">
				<div class="b-page-n">
					{foreach item=item from=$links_top name=links}			
						{if $smarty.foreach.links.first}
							{$lang.general.showing}&nbsp;{$current_page}&nbsp;{$lang.general.of}&nbsp;{$num_page}&nbsp;
						{/if}
						{if $item.previous_page eq 1}
							<a href="{$item.link}" class="back-page-act" id="back-page-act_top" alt="{$lang.general.back}" title="{$lang.general.back}">&nbsp;</a>
						{elseif $item.previous_page eq 2}
							<a href="javascript: void(0);" class="back">&nbsp;</a>
						{/if}
						{if $item.next_page eq 1}
							<a href="{$item.link}" class="next-page-act" id="next-page-act_top" alt="{$lang.general.next}" title="{$lang.general.next}">&nbsp;</a>
						{elseif $item.next_page eq 2}
							<a href="javascript: void(0);" class="next">&nbsp;</a>
						{/if}
					{/foreach}
				</div>
			</div>
		</div>
		{/if}
		
		<div style="width:100%;display:table;">
		<dl>
			<dd valign="top">
			<div style="width:100%;" align="left">
				{section name=c loop=$games_list}
				{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 $games_list[c].name}
						<div>
							<dl>
								<dd valign="top" align="center">
									<div style="cursor:pointer;" onclick="Play({$games_list[c].id_category},{$games_list[c].id},{$games_list[c].paid});"><img src="{$games_list[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 $games_list[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"><a href="games.php?sel=play&amp;id_category={$games_list[c].id_category}&amp;id_game={$games_list[c].id}">{$games_list[c].name}</a></font></div>
								</dd>
							</dl>
						</div>
					</dt>
					{/if}
				{if $smarty.section.c.index_next is div by 6 || $smarty.section.c.last}</dl>{/if}
				{/section}
			</div>
			</dd>
		</dl>
		</div>
		</div>
		
		<div class="search_link">
			<div class="sorting-long">
			<div class="b-page-n">	
				{foreach item=item from=$links_bottom}
					{if $item.first_page eq 1}
						<a href="{$item.link}" class="first-page-act">&nbsp;</a>
					{elseif $item.first_page eq 2}
						<a href="javascript: void(0);" class="first-page">&nbsp;</a>
					{/if}
					
					{if $item.previous_page eq 1}
						<a href="{$item.link}" class="back-page-act" id="back-page-act_bottom" alt="{$lang.default_select.back}" title="{$lang.default_select.back}">&nbsp;</a>
					{elseif $item.previous_page eq 2}
						<a href="javascript: void(0);" class="back">&nbsp;</a>
					{/if}
					
					{if $item.selected}
						<a href="javascript: void(0);" class="act-page">{$item.name}</a>
					{else}
						<a href="{$item.link}">{$item.name}</a>
					{/if}
					
					{if $item.delimiter}
						{$item.delimiter}
					{/if}
					
					{if $item.next_page eq 1}
						<a href="{$item.link}" class="next-page-act" id="next-page-act_bottom" alt="{$lang.default_select.next}" title="{$lang.default_select.next}">&nbsp;</a>
					{elseif $item.next_page eq 2}
						<a href="javascript: void(0);" class="next">&nbsp;</a>
					{/if}
						
					{if $item.last_page eq 1}
						<a href="{$item.link}" class="last-page-act">&nbsp;</a>
					{elseif $item.last_page eq 2}
						<a href="javascript: void(0);" class="last-page">&nbsp;</a>
					{/if}	
				{/foreach}
			</div>
		</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="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"}