{include file="$admingentemplates/admin_top.tpl"}
<script language="JavaScript" type="text/javascript" src="{$site_root}{$template_root}/js/location.js"></script>
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_users.php">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{if $form.par eq "edit"}{$lang.users.editform}{else}{$lang.users.add}{/if}</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>{if $form.par eq "edit"}{$lang.admin_help.users_edit}{else}{$lang.admin_help.users_add}{/if}
    </div>
</div>
<ul class="tabs">
    <li>
        <a {if $import} href="admin_users.php" {else} class="current" {/if}>{$lang.users.razdel_name}</a>
    </li>
    <li>
        <a href="admin_groups.php">{$lang.groups.razdel_name}</a>
    </li>
    <li>
        <a {if $import} class="current" {else} href="admin_users.php?sel=import" {/if}>{$lang.admin_user.import.sub_header}</a>
    </li>
</ul>
 <div class="user_operation_line">
        <div class="uol_item" onclick="javascript: location.href='{$add_link}'">
            <div class="uol_in_item">{$lang.users.add}</div>
        </div>
        <div class="uol_item" {literal}onclick="javascript: if (window.confirm('{/literal}{$lang.users.del_confirm|escape:javascript}{literal}'))  {document.location.href ='{/literal}{$form.action}?sel=del&id={$form.id}{literal}' } else return false;"{/literal}>
            <div class="uol_in_item">{$lang.users.delete}</div>
        </div>
        <div class="uol_item" onclick="ResendList();">
            <div class="uol_in_item">{$lang.users.resend}</div>
        </div>
</div>
<div class="cr" style="height: 20px;"></div>      
<div style="display:none; margin: 10px 0;" class="delete_status"></div>      
<div>
	{section name=i loop=$form.link}
		{assign var="num" value="1"}
		{assign var="page_num" value="`$smarty.section.i.index+$num`"}
		<div id="tab_all_users_{$smarty.section.i.index}" class="user_status_elem{if $form.num eq $page_num}_active {/if}" width="80px">
			{$form.link[i]}{$lang.users.page[$page_num]}</a>
		</div>
	{/section}
    {*<div id="tab_all_users" class="user_status_elem{if $form.num eq 1}_active {/if}" width="80px">
        {$form.link[0]}{$lang.users.page[1]}</a>
    </div>
	{if $form.link[1]}
    <div id="tab_all_users" class="user_status_elem{if $form.num eq 2}_active {/if}" width="80px">
        {$form.link[1]}{$lang.users.page[2]}</a>
    </div>
	{/if}
	{if $form.link[2]}
    <div id="tab_all_users" class="user_status_elem{if $form.num eq 3}_active {/if}" width="80px">
        {$form.link[2]}{$lang.users.page[3]}</a>
    </div>
	{/if}
	{if $form.link[3]}
    <div id="tab_inactive_users"  class="user_status_elem{if $form.num eq 4}_active {/if}" width="80px">
        {$form.link[3]}{$lang.users.page[4]}</a>
    </div>
	{/if}
	*}
    <div id="tab_top_users" class="user_status_elem{if $form.num eq $page_num+1}_active {/if}" width="80px">
        {if $form.par eq 'edit'}<a href="{$form.upload_link}"> {$lang.button.upload}</a>{else} {$lang.users.page[1]}{/if}
    </div>
</div>        
<!--!!!--> 
<div style="float: left; width: 100%;">
<form id="profile" method="post" action="{$form.action}"  enctype="multipart/form-data" name="profile">
	<table border=0 cellspacing=0 cellpadding=0 width="98%" class="panel_subtabs" style="padding: 0 15px;">                
                {$form.hiddens}
                <input type="hidden" id="pair" name="pair" value="{$pair}">				
                {if $form.par eq 'edit' && $form.num eq 1}
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="100%" style="padding-top: 10px;">
								<tr style="height: 35px;">
									<td width="50%" class="no_couple">
										<table>
											<tr>
												<td id="preview_1" class="name_for_lang"><nobr>
													{$lang.users.pass}:
												</nobr></td>
												<td align="left">
													<input type="password" name="pass2" value="{$data.pass}" size=30 {if $data.root eq 1}disabled{/if} style="width: 195">
													&nbsp;<input type="checkbox" name="refresh" value="1" {if $data.root eq 1}disabled{/if} {if $data.refresh}checked{/if}>&nbsp;{$lang.users.pass_refresh}
												</td>
											</tr>
										</table>
									</td>
									{if $pair}
										<td width="50%" class="for_couple">
											<table>
												<tr>
													<td id="preview_1" class="name_for_lang"><nobr>
														{$lang.users.pass}:
													</nobr></td>
													<td align="left">
														<input type="password" name="couple_pass2" value="{$data_2.pass}" size=30 {if $data.root eq 1}disabled{/if}  style="width: 195">
														&nbsp;<input type="checkbox" name="couple_refresh" value="1" {if $data.root eq 1}disabled{/if} {if $data.refresh}checked{/if}>&nbsp;{$lang.users.pass_refresh}
													</td>
												</tr>
											</table>
										</td>
									{/if}
								</tr>
							</table>
						</td>
					</tr>
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" width="100%" >
								<tr style="height: 35px;">
									<td width="50%" class="no_couple">
										<table>
											<tr>
												<td id="preview_1" class="name_for_lang"><nobr>
														{$lang.users.repass}:
												</nobr></td>
												<td align="left">
													<input type="password" name="repass2" value="{$data.repass}" size=30 {if $data.root eq 1}disabled{/if}  style="width: 195">
													&nbsp;<input type="checkbox" name="conf" value="1" {if $data.root eq 1}disabled{/if} {if $data.conf}checked{/if}>&nbsp;{$lang.users.pass_confirm}
												</td>
											</tr>
										</table>
									</td>
									{if $pair}
										<td width="50%" class="for_couple">
											<table>
												<tr>
													<td id="preview_1" class="name_for_lang"><nobr>
															{$lang.users.repass}:
													</nobr></td>
													<td align="left">
														<input type="password" name="couple_repass2" value="{$data_2.repass}" size=30 {if $data.root eq 1}disabled{/if}  style="width: 195">
														&nbsp;<input type="checkbox" name="couple_conf" value="1" {if $data.root eq 1}disabled{/if} {if $data.conf}checked{/if}>&nbsp;{$lang.users.pass_confirm}
													</td>
												</tr>
											</table>
										</td>
									{/if}
								</tr>

							</table>
							
						</td>
					</tr>
                {/if}
					<tr >
                        <td>
                            {*foreach item=item from=$elements name=elements}
                                {if $item.position_text == 'inline'}
									<div id="div_{$item.name_for_lang}" cat="{$item.category}" class="div_name_for_lang" name_for_lang="{$item.name_for_lang}" style="background:{if $smarty.foreach.elements.iteration is div by 2}#ffffff{else}#f9f9f9{/if};">
										<table cellpadding="10" cellspacing="0" width="60%">
											<tr>
												<td id="preview_1">
													{$item.elem_html}&nbsp;
													{if $lang.profile[$item.name_for_lang] ne ''}
														{$lang.profile[$item.name_for_lang]}
													{else}
														{$item.name_for_lang}
													{/if}
												</td>
											</tr>
										</table>
									</div>
                                {else}
                                    {if $item.couple}
                                    <table border=0 cellspacing=0 cellpadding="0" width="98%" style="margin-left:10px; background:{if $smarty.foreach.elements.iteration is div by 2}#ffffff{else}#f9f9f9{/if};">
                                        <tr><td width="60%">
                                    {/if}
                                    <div id="div_{$item.name_for_lang}" cat="{$item.category}" class="div_name_for_lang" name_for_lang="{$item.name_for_lang}" style="background:{if $smarty.foreach.elements.iteration is div by 2}#ffffff{else}#f9f9f9{/if};">
                                    <table cellpadding="10" cellspacing="0" width="60%">
                                        <tr>
                                            <td id="preview_1" style="vertical-align: top;" {if $item.position_text == 'top' || $item.position_text == 'left'}class="name_for_lang" width="160px" {if $item.mandatory == '1'}mandatory="1"{/if}{else}class="element"{/if}>
                                            {if $item.position_text == 'top' || $item.position_text == 'left'}
                                                {if $item.category eq 'custom'}
                                                    {if $lang.userspr[$item.name_for_lang] ne ''}
                                                        {$lang.userspr[$item.name_for_lang]}
                                                    {else}
                                                        {$item.name_for_lang}
                                                    {/if}
                                                {else}
                                                    {if $lang.profile[$item.name_for_lang] ne ''}
                                                        {$lang.profile[$item.name_for_lang]}
                                                    {else}
                                                        {$item.name_for_lang}
                                                    {/if}
                                                {/if}
                                            {else}
                                                {$item.elem_html}
                                            {/if}
                                            </td>
                                            <td id="preview_2" {if $item.position_text == 'left'}class="element"{elseif $item.position_text == 'right'}class="name_for_lang" {if $item.mandatory == '1'}mandatory="1"{/if}{/if}>
                                                {if $item.position_text == 'left'}
                                                    {$item.elem_html}
                                                {elseif $item.position_text == 'right'}
                                                    {if $item.category eq 'custom'}
                                                        {if $lang.userspr[$item.name_for_lang] ne ''}
                                                            {$lang.userspr[$item.name_for_lang]}
                                                        {else}
                                                            {$item.name_for_lang}
                                                        {/if}
                                                    {else}
                                                        {if $lang.profile[$item.name_for_lang] ne ''}
                                                            {$lang.profile[$item.name_for_lang]}
                                                        {else}
                                                            {$item.name_for_lang}
                                                        {/if}
                                                    {/if}
                                                {/if}
                                            </td>
                                        </tr>
                                        <tr>
                                            <td id="preview_3"{if $item.position_text == 'top'}class="element"{elseif $item.position_text == 'bottom'}class="name_for_lang" {if $item.mandatory == '1'}mandatory="1"{/if}{/if} style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
                                                {if $item.position_text == 'top'}
                                                    {$item.elem_html}
                                                {elseif $item.position_text == 'bottom'}
                                                    {if $item.category eq 'custom'}
                                                        {if $lang.userspr[$item.name_for_lang] ne ''}
                                                            {$lang.userspr[$item.name_for_lang]}
                                                        {else}
                                                            {$item.name_for_lang}
                                                        {/if}
                                                    {else}
                                                        {if $lang.profile[$item.name_for_lang] ne ''}
                                                            {$lang.profile[$item.name_for_lang]}
                                                        {else}
                                                            {$item.name_for_lang}
                                                        {/if}
                                                    {/if}
                                                {/if}
                                            </td>
                                            <td style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
                                            </td>
                                        </tr>
                                    </table>
                                    </div>
                                    {if $item.couple}
                                            </td>
                                            <td class="for_couple" style="{if !$pair}display:none;{/if}">
                                            <!------------------------->
												{if $edit}
													<div cat="{$item.category}" id="div_{$item.name_for_lang}" class="" name_for_lang="{$item.name_for_lang}" style="margin-left: -10px; width: 100%; background:{if $smarty.foreach.elements.iteration is div by 2}#ffffff{else}#f9f9f9{/if};">
														<table cellpadding="10" cellspacing="0" width="98%">
															<tr>
																<td id="preview_1" {if $item.position_text == 'top' || $item.position_text == 'left'}class="name_for_lang" width="160px" {if $item.mandatory == '1'}mandatory="1"{/if}{else}class="element"{/if}>
																	{if $item.position_text == 'top' || $item.position_text == 'left'}
																		{if $item.category eq 'custom'}
																			{if $lang.userspr[$item.name_for_lang] ne ''}
																				{$lang.userspr[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{else}
																			{if $lang.profile[$item.name_for_lang] ne ''}
																				{$lang.profile[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{/if}
																	{else}
																		{$item.couple_elem_html}
																	{/if}
																</td>
																<td id="preview_2" {if $item.position_text == 'left'}class="element"{elseif $item.position_text == 'right'}class="name_for_lang" {if $item.mandatory == '1'}mandatory="1"{/if}{/if}>
																	{if $item.position_text == 'left'}
																		{$item.couple_elem_html}
																	{elseif $item.position_text == 'right'}
																		{if $item.category eq 'custom'}
																			{if $lang.userspr[$item.name_for_lang] ne ''}
																				{$lang.userspr[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{else}
																			{if $lang.profile[$item.name_for_lang] ne ''}
																				{$lang.profile[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{/if}
																	{/if}
																</td>
															</tr>
															<tr>
																<td id="preview_3"{if $item.position_text == 'top'}class="element"{elseif $item.position_text == 'bottom'}class="name_for_lang" {if $item.mandatory == '1'}mandatory="1"{/if}{/if} style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
																	{if $item.position_text == 'top'}
																		{$item.couple_elem_html}
																	{elseif $item.position_text == 'bottom'}
																		{if $item.category eq 'custom'}
																			{if $lang.userspr[$item.name_for_lang] ne ''}
																				{$lang.userspr[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{else}
																			{if $lang.profile[$item.name_for_lang] ne ''}
																				{$lang.profile[$item.name_for_lang]}
																			{else}
																				{$item.name_for_lang}
																			{/if}
																		{/if}
																	{/if}
																</td>
																<td style="{if $item.position_text == 'top' || $item.position_text == 'bottom'}padding-top:10px; padding-bottom:10px;{else}padding-top:0px; padding-bottom:0px;{/if}">
																</td>
															</tr>
														</table>
													</div>
												{/if}
                                            <!------------------------->
                                            </td>
                                        </tr>
                                        </table>
                                        {if $edit eq 0}
                                            <script>
												var elem = "div_{$item.name_for_lang}";
												new_elem = $('#'+elem).clone();
												{literal}
												new_elem.find("input, select").each(function(){
													name = $(this).attr('name');
													$(this).attr('name','couple_'+name)
												});
												$('#'+elem).parent().parent().find('.for_couple').append(new_elem);
												{/literal}
                                            </script>
                                        {/if}
                                    {/if}
                                {/if}
                            {/foreach*}


							{foreach item=item from=$elements name=elements}
									{if $item.couple}
										<table width="100%" cellspacing="0" cellpadding="0"><tr><td width="50%" class="no_couple">
									{/if}
									{assign var="background" value="1"}
									{assign var=elem_html value=$item.elem_html}
									{include file="$site_path$index_theme_path/registration_edit_element.tpl"}
									{if $item.couple}
										{assign var=elem_html value=$item.couple_elem_html}
										{assign var=couple value=1}
											</td>
											<td width="50%" class="for_couple" style="{if !$pair}display:none;{/if}">
												<!------------------------->
												{include file="$site_path$index_theme_path/registration_edit_element.tpl"}
												<!------------------------->
											</td>
											{assign var=couple value=0}
										</tr>
										</table>
										{if $edit eq 0}

										{/if}
									{/if}
								{*/if*}
							{/foreach}
							
							<script>
								{if !$edit}
								{literal}
									$('.for_couple').find('input, select, textarea').each(function(){
										$(this).attr('name', 'couple_'+$(this).attr('name'));
									});
								{/literal}
								{/if}
							</script>
						</td>
                    </tr>
            </table>
             </form>
             
			<table><tr height="40">
			{if $form.par eq "edit"}
			{if $data.root  ne 1}<td>
                <!--<input type="button" value="{$lang.button.save}" class="button" onclick="javascript:document.profile.submit()">-->
                <a class="admin_button_major" onclick="send_req();" >{$lang.button.save}<span>&nbsp;</span></a>                
            </td>
			{/if}
			{else}
			<td>
                <!--<input type="button" value="{$lang.button.add}" class="button" onclick="javascript:document.profile.submit()">-->
                <a class="admin_button_major" onclick="send_req();" >{$lang.button.add}<span>&nbsp;</span></a>
            </td>
			{/if}
			<td>
                
            </td>
			</tr></table>
</div>
                        
<div id="divToUpdate"></div>
<div onclick="scrollmain();" id="divToScroll"></div>
<script language="JavaScript" type="text/javascript" src="{$site_root}{$index_theme_path}/js/jquery.form.js"></script>

{if $form.par eq "add" || $form.par eq "edit" }
<script language="JavaScript" type="text/javascript">
	{literal}
    $(document).ready(function(){

		$('#div_id_relationship').find('.all').click(function(){
			if($('#div_id_relationship').find('.all').is(':checked')){
				$('#div_id_relationship').find('input[type="checkbox"]').attr('checked', 'checked');
				$('#div_id_relationship').find('input[type="checkbox"][class!="all"]').attr('disabled','disabled');
			}else{
				$('#div_id_relationship').find('input[type="checkbox"]').removeAttr('checked');
				$('#div_id_relationship').find('input[type="checkbox"][class!="all"]').removeAttr('disabled');
			}
		});
		if($('#div_id_relationship').find('.all').is(':checked')){
			$('#div_id_relationship').find('input[type="checkbox"]').attr('checked', 'checked');
			$('#div_id_relationship').find('input[type="checkbox"][class!="all"]').attr('disabled','disabled');
		}

		$('#div_couple_id_relationship').find('.all').click(function(){
			if($('#div_couple_id_relationship').find('.all').is(':checked')){
				$('#div_couple_id_relationship').find('input[type="checkbox"]').attr('checked', 'checked');
				$('#div_couple_id_relationship').find('input[type="checkbox"][class!="all"]').attr('disabled','disabled');
			}else{
				$('#div_couple_id_relationship').find('input[type="checkbox"]').removeAttr('checked');
				$('#div_couple_id_relationship').find('input[type="checkbox"][class!="all"]').removeAttr('disabled');
			}
		});
		if($('#div_couple_id_relationship').find('.all').is(':checked')){
			$('#div_couple_id_relationship').find('input[type="checkbox"]').attr('checked', 'checked');
			$('#div_couple_id_relationship').find('input[type="checkbox"][class!="all"]').attr('disabled','disabled');
		}

        /*try{
            SelectUserTypes('rpt', '{/literal}{$no_pair}{literal}', document.getElementById('user_subtype_div'));
        }catch(e){};

        try{
            SelectUserTypes('rptc','{/literal}{$no_pair}{literal}', document.getElementById('looking_user_subtype_div'));
        }catch(e){};*/
        $('&nbsp;<br><input type="checkbox" id="conf" name="conf" value="1" checked>{/literal}{$lang.users.pass_confirm}{literal}</br>').insertAfter('#div_repass input[name=repass]');
        $('&nbsp;<br><input type="checkbox" id="couple_conf" name="couple_conf" value="1" checked>{/literal}{$lang.users.pass_confirm}{literal}</br>').insertAfter('#div_couple_repass input[name=couple_repass]');
    });
	{/literal}
</script>
{/if}

{literal}
<script language="JavaScript" type="text/javascript">
function Change(par) {
	if (par == 'N') {
		//$(".for_couple").fadeOut('slow');
                $(".for_couple").hide();
		document.getElementById('pair').value = '0';

	} else if (par == 'Y') {
		//$(".for_couple").fadeIn('slow');
                $(".for_couple").show();
		document.getElementById('pair').value = '1';
	} else {
		document.getElementById('pair').value = '0';
	}
}

function send_req(edit){
	var options = {
		target: "#divToUpdate",
		url: "admin_users.php?sel=saveuser",
        iframe: true,
		success: function(data) {
			if(data.substr(0,13) == 'ShowAjaxError'){
				eval(data);
			}
		}
	};
	$("#profile").ajaxSubmit(options);
}
function CheckValue(val){};
$('.name_for_lang').each(function(){
    if($(this).attr('mandatory') == 1){
        if($(this).find('.mandatory').html() == null){
            if($(this).find('p').html() != null)
                $(this).find('p:last').append(' <span class="mandatory"><font class="error_msg">*</font></span>');
            else
                $(this).append(' <span class="mandatory"><font class="error_msg">*</font></span>');
        }
    }
});
$('.for_couple').find('#region_div').attr('id','couple_region_div');
$('.for_couple').find('#city_div').attr('id','couple_city_div');

function SelectUserTypes (section, id_usertypes, destination) {
	str = "sec=" + section + "&sel=usertypes&id_usertypes="+id_usertypes;
	$.ajax({
		url: '../location.php',
		data: str,
		success: function (data, textStatus) {
			$(destination).html(data);
        }
	});
}
function Clear(){};

function SelectRegion(section, id_country, destination, destination2, postfix, prefix) {
	prefix = prefix || '';
    if (postfix == undefined) {
        postfix = '';
    }
  if (id_country != '') {
    InitXMLHttpRequest();
    // Load the result from the response page
    if (req) {
      req.onreadystatechange = function() {
        if (req.readyState == 4) {
          destination.innerHTML = req.responseText;
        } else {
          if (section == 'rp') {
            destination.innerHTML = "<select style=\"width:150px\"><option>Loading data...</option></select>";
          } else {
            destination.innerHTML = "<select style=\"width:150px\" class=\"index_select\"><option>Loading data...</option></select>";
          }
        }
      }
      req.open("GET", "../location.php?sec=" + section + "&sel=region&prefix="+prefix+"&postfix="+postfix+"&id_country=" + id_country, true);
      req.send(null);
    } else {
      destination.innerHTML = 'Browser unable to create XMLHttp Object';
    }
  } else {
    destination.innerHTML = "Country is not selected";
  }
  if (section == 'as') {
    destination2.innerHTML = "<select style=\"width:150px\" class=\"index_select\"><option>All</option></select>";
  } else {
    if (section == 'rp') {
      destination2.innerHTML = "<select style=\"width:150px\" name='"+prefix+"id_city'><option>Please select...</option></select>";
    } else {
      destination2.innerHTML = "<select style=\"width:150px\" class=\"index_select\"><option>Please select...</option></select>";
    }

  }
}
function SelectCity(section, id_region, destination, postfix, prefix) {
	prefix = prefix || '';
	if (postfix == undefined) {
		postfix = '';
	}
  if (id_region != '') {
    InitXMLHttpRequest();
    if (req) {
      req.onreadystatechange = function() {
        if (req.readyState == 4) {
          destination.innerHTML = req.responseText;
        } else {
          if (section == 'rp') {
            destination.innerHTML = "<select style=\"width:150px\"><option>Loading data...</option></select>";
          } else {
            destination.innerHTML = "<select style=\"width:150px\" class=\"index_select\"><option>Loading data...</option></select>";
          }
        }
      }
      req.open("GET", "../location.php?sec=" + section + "&sel=city&prefix="+prefix+"&postfix="+postfix+"&id_region=" + id_region, true);
      req.send(null);
    } else {
      destination.innerHTML = 'Browser unable to create XMLHttp Object';
    }
  } else {
    destination.innerHTML = "Region is not selected";
  }
}
function ChangeLocation(obj){
    if($(obj).parent().attr('id') == 'region_div'){
        if($('#city_div').attr('id') == 'city_div'){
            SelectCity('rp', $(obj).val(), document.getElementById('city_div'));
            return 1;
        }
    }
    if($(obj).parent().attr('id') == 'couple_region_div'){
        if($('#couple_city_div').attr('id') == 'couple_city_div'){
            SelectCity('rp', $(obj).val(), document.getElementById('couple_city_div'), '', 'couple_');
            return 1;
        }
    }
    if($(obj).attr('name') == 'id_country'){
        if($('#city_div').attr('id') == 'city_div' && $('#region_div').attr('id') == 'region_div'){
            SelectRegion('rp', $(obj).val(), document.getElementById('region_div'), document.getElementById('city_div'));
            return 1;
        }
    }
    if($(obj).attr('name') == 'couple_id_country'){
        if($('#couple_city_div').attr('id') == 'couple_city_div' && $('#couple_region_div').attr('id') == 'couple_region_div'){
            SelectRegion('rp', $(obj).val(), document.getElementById('couple_region_div'), document.getElementById('couple_city_div'), '', 'couple_');
            return 1;
        }
    }
    return 1;
}

function ResendList(){
        var str = "";
        $('input[resend=1]').removeAttr('resend');

        str += 'id[]='+{/literal}{$form.id}{literal}+'&';
        $('.delete_status').html('{/literal}{$lang.users.resending}{literal}');
		if(str != ""){
			$.ajax({
				type: 'POST',
				url: 'admin_users.php',
				data: 'sel=resend&' + str,
				success: function(msg){
					if(msg == "OK"){
						ShowAjaxError('{/literal}{$lang.users.resended}{literal}', '', 'success');
						$('.delete_status').html('{/literal}{$lang.users.resended}{literal}');
						$('input[resend=1]').attr('checked', false);
					} else {
						ShowAjaxError('{/literal}{$lang.users.resend_error}{literal}', '', 'error');
						$('.delete_status').html('{/literal}{$lang.users.resend_error}{literal}');
					}
				}
			});
		} else {
			ShowAjaxError('{/literal}{$lang.users.resend_pleaseselect}{literal}', '', 'warning');
			$('.delete_status').html('{/literal}{$lang.users.resend_pleaseselect}{literal}');
		}
		
		$('.delete_status').fadeIn(100);
		$('.delete_status').oneTime(5000, function() {
			$('.delete_status').fadeOut(500);
		});
    }
</script>
{/literal}
{include file="$site_path$index_theme_path/like.tpl"}
{include file="$admingentemplates/admin_bottom.tpl"}