{strip}
{if $ajax eq 0}
{include file="$admingentemplates/admin_top.tpl"}
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.cards.admin.name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.admin_help.cards_categories_list}
    </div>
</div>

<link href="{$site_root}{$template_root}/css/alert.css" rel="stylesheet" type="text/css">
<div id="boxes">
    <div id="close" class="close" onclick="Close()"></div>
	<div id="dialog" class="window">
	</div>
</div>
<div id="mask"></div>

<ul class="tabs">
    <li>
        <a {if $info.active == "catalog"} class="current" {else} href="admin_cards.php"  {/if}>{$lang.admin_menu.ecards_catalog} </a>
    </li>
    <li>
        <a {if $info.active == "orders"} class="current" {else} href="admin_cards.php?sel=orders" {/if}>{$lang.admin_menu.ecards_orders}</a>
    </li>
    <li>
        <a {if $info.active == "song"} class="current" {else} href="admin_cards.php?sel=settings_songs" {/if}>{$lang.admin_menu.ecards_songs}</a>
    </li>        
</ul>
<div class="user_operation_line">
            <div class="uol_item" >
				<div class="uol_in_item" onclick="javascript: window.location.href='{$form.add_link}'">{$lang.cards.admin.add_category}</div>
            </div>
            <div class="uol_item" onclick="javascript: window.location.href='admin_cards.php?sel=settings_import'">
                <div class="uol_in_item">{$lang.cards.admin.ecards_import}</div>
            </div>
            <div class="uol_item" onclick="WindowShow('get_dialog_free');">
                <div class="uol_in_item">{$lang.cards.admin.ecards_free}</div>
            </div> 
            <div class="uol_item" onclick="WindowShow('get_dialog_paid');">
                <div class="uol_in_item">{$lang.cards.admin.ecards_paid}</div>
              </div>             
              <div class="uol_item">
                    <div class="uol_in_item2" style="position:relative;width: 100%">
                        <div class="select_box_option" style="text-align: center; border: 0;width:100%; position: relative;margin-left: -15px;">
                            {$lang.cards.admin.jump_to_category}
                            <div class="option_box" id="active_themes" >
        	                    {foreach from=$categories item=item}
        	                        <div class='option_box_item' style="width:100%;">
        	                            <div class='option_box_item_box' id='{$item.id}' onclick="document.location.href='admin_cards.php?sel=subcategories&id_category='+{$item.id}">
        	                                <div style='width:82%;float:left;'>{$item.name}</div>	                               
        	                                <div class="cr"></div>
        	                            </div>
        	                        </div>
        	                    {/foreach}
        	                    <!--div id='bottom_corner' style="height: 5px;">&nbsp;</div-->
        	                </div>
                        </div>

                    </div>
                </div>                           
</div>
<div class="cr"></div>
<div>	

{/if}
	<div id="ecards" style="padding-top: 10px;">
<div id="tooltip" onclick="hideToolTip()" style="text-align:center; background-color: #FFFFFF; border: 1px dotted; text-align: {$default_left}; position:absolute; display:none; padding:5px;"></div>
{literal}
<script type="text/javascript">
$(function() {
$('#tool_tip_4 *').tooltip();
});
</script>
{/literal}
	<table border=0 cellspacing=0 cellpadding=0 width="100%">
	{if $categories}		
		<tr class="table_header">
			<td width="150">{$lang.cards.admin.categories}</td>
			<td >{$lang.admin_menu.ref_description}</td>
			<td width="120" align="left">{$lang.ecards.picture}</td>
			<td width="230" align="right">{$lang.users.actions}</td>
		</tr>
		{foreach name=t item=item from=$categories}
		<tr {if $smarty.foreach.t.iteration mod 2 eq 0}class="even"{else}class="odd"{/if}>
			<td class="main_content_text"  valign="top"><a href="admin_cards.php?sel=subcategories&id_category={$item.id}">{$item.name}</a></td>
			<td class="main_content_text"  valign="top">{$item.descr}</td>
			<td class="main_content_text" style="padding-top:5px;padding-bottom:5px;" valign="top">
				<a href="admin_cards.php?sel=subcategories&id_category={$item.id}">
				<img src="{$item.image}" height="100" width="100" style="border: 1px solid #cccccc;">
				</a>
			</td>
			<td class="main_content_text"  valign="top">
{*				<a href="admin_cards.php?sel=subcategories&id_category={$item.id}">{$lang.cards.admin.subcategories}</a>
				&nbsp;&nbsp;|&nbsp;&nbsp;
				<a href="{$item.editlink}">{$lang.button.edit}</a>
				&nbsp;&nbsp;|&nbsp;&nbsp;
				<a href="#" onclick="if(confirm('{$lang.cards.admin.confirm|escape:javascript}')){literal}{{/literal}document.location.href='{$item.deletelink}'{literal}}{/literal} else return false;">{$lang.button.delete}</a>*}
					<div class="block_action fr" style="display: none;">
						<div class="action_del" style="display: block;cursor:pointer;">
							<img width="16" alt="" src="{$site_root}{$template_root}/images/photo_delete.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.delete}');return false" onclick="javascript: if(confirm('{$lang.cards.admin.confirm|escape:javascript}')){literal}{{/literal}document.location.href='{$item.deletelink}'{literal}}{/literal} else return false;">
						</div>
					</div>			
					<div style="width:10px;float:right;" class="fl">&nbsp;</div>
					<div class="block_action fr" style="display: none;">
						<div class="action_edit" style="display: block;cursor:pointer;">
							<img width="16" alt="" src="{$site_root}{$template_root}/images/edit.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.button.edit}');return false" onclick="document.location.href='{$item.editlink}'">
						</div>
					</div>			
					<div style="width:10px;float:right;" class="fl">&nbsp;</div>
					<div class="block_action fr" style="display: none;">
						<div class="action_del" style="display: block;cursor:pointer;">
							<img width="16" alt="" src="{$site_root}{$template_root}/images/icn_view.png" onmouseout="javascript:hideToolTip();" onmouseover="javascript: showToolTip(event,'{$lang.cards.admin.subcategories}');return false" onclick="document.location.href='admin_cards.php?sel=subcategories&id_category={$item.id}'">
						</div>
					</div>			
			</td>
		</tr>
		{foreachelse}
			<tr height="40">
				<td class="main_error_text" align="left" colspan="11">{$lang.interests_spr.empty}</td>
			</tr>
		{/foreach}
		<tr class="table_header">
                                <td colspan="11">
                                    &nbsp;&nbsp;
                                    {if $links}
                                    {foreach item=item from=$links.pages}
                                        &nbsp;<a onclick="PageList('bad_words', '{$item.link}');" class="page_link" {if $item.selected} style=" font-weight: bold; text-decoration: none;" {/if}>{$item.name}</a>&nbsp;
                                    {/foreach}
                                    {/if}
                                    <div class="page_navigation">
                                    {if $links.previous}
                                        <a onclick="PageList('bad_words', '{$links.previous}');">< {$lang.content.previous} {$per_page}</a>
                                    {/if}
                                    {if $links.next}
                                        <a onclick="PageList('bad_words', '{$links.next}');">{$lang.content.next} {$per_page} ></a>
                                    {/if}
                                    </div>
                                </td>
                            </tr>
	{else}
		<tr height="40">
			<td class="main_error_text" align="left" colspan="4" bgcolor="#FFFFFF">{$lang.cards.admin.empty_categories}</td>
		</tr>
	{/if}
	</table>
<script type="text/javascript">
{literal}
		function showToolTip(e,text){
			if(document.all)e = event;
			var obj = document.getElementById('tooltip');
			obj.innerHTML = text;
			obj.style.display = 'block';
			var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
			if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0;
			var leftPos = e.clientX - $('#tooltip').width()-10;
			if(leftPos<0)leftPos = 0;
			obj.style.left = leftPos + 'px';
			obj.style.top = e.clientY - obj.offsetHeight -10 + st + 'px';
		}
		function hideToolTip(){
			document.getElementById('tooltip').style.display = 'none';
		}
{/literal}		
</script>
	</div><div class="cr">&nbsp;</div>
</div>
{/strip}

<script language="JavaScript" type="text/javascript">
{literal}
function WindowShow(par) {
	//var id = '#dialog';
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(500);	
		$('#mask').fadeTo("fast",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		//Set the popup window to center
		$('#dialog').css('top',  winH/2-$('#dialog').height()/2);
		$('#dialog').css('left', winW/2-$('#dialog').width()/2);
        $('#close').css('top',  winH/2-$('#dialog').height()/2+9);
		$('#close').css('left', winW/2+$('#dialog').width()/2-25); 
	
	$.ajax({
  		type: "POST",
  		url: "admin_cards.php",
		data: ({sel : par}),
		success: function(data){
			$('#dialog').html(data);
            $('#dialog').fadeIn(500); 
            $('#close').fadeIn(500); 
		}
	});
	//transition effect
}
function Close(){
    $('#mask').fadeOut(500);
    $('#close').fadeOut(500)
    $('#dialog').fadeOut(500)	
}

$(document).ready(function() {
	//if close button is clicked
	$('.window .close').live('click', function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#mask, .window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window, #close').hide();
	});
    
    
     $('#bottom_corner').corner("bottom 3px");
            $('.select_box_option').live('click',function(){
                $("#active_themes").toggle();
            });
            $(".option_box_item_box").hover(
                function(){
                    $(this).addClass('option_box_item_box_hover');
                },
                function(){
                    $(this).removeClass('option_box_item_box_hover');
                }
            ); 			
	
    
    
});

function FreeCard() {
	var price = 0;
	if ($('#price').val() != undefined) 
		price = $('#price').val();
	$('#answ').html('<div align="center" style="padding-top:60px;"><img border="0" src="{/literal}{$site_root}{$template_root}{literal}/images/ajax-loader.gif"></div>');
	
	$.ajax({
  		type: "POST",
  		url: "admin_cards.php",
		data: ({ajax : 1, sel : 'free_card', price : price}),
		success: function(data){
			$('#answ').html(data);
		}
	});
}

function PageList(id_div, par) {
        //ajaxLoadingImage(1, 'pays');
        $.post("admin_cards.php", par, function(data){
            //ajaxLoadingImage(0, 'pays');
            $('#ecards').html(data);
        });
    }
{/literal}
</script>
{if $ajax eq 0}
{include file="$admingentemplates/admin_bottom.tpl"}
{/if}