{include file="$admingentemplates/admin_top.tpl"}
<div class="back">
    <a href="{$site_url}{$site_root}/admin/admin_club.php?sel=categories">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$club.club_name}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<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 width="100%" border="0" cellpadding="0" cellspacing="1">
	{if $data.agree_form eq 1}
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
			<tr>
				<td valign="top" style="padding: 15px;">
					<table width="100%" border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td>
							<textarea style="width: 450px;" rows="5" readonly>{$data.agreement_text}</textarea>
						</td>
					</tr>
					</table>
					<table border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td><input type="checkbox" value="1" id="agree" onclick="JoinBtnFunc()"></td>
						<td>{$lang.club.i_agree_text}</td>
					</tr>
					<tr>
						<td colspan="2">
							<a class="admin_button_major" id="btn_join" onclick="document.location.href='{$data.agree_link}'">{$lang.club.join_club}<span>&nbsp;</span></a>
{*							<input type="button" value="{$lang.club.join_club}" id="btn_join" disabled onclick="document.location.href='{$data.agree_link}'">*}
						</td>
					</tr>
					</table>
				</td>
			</tr>
			</table>
			</div>
		</td>
	</tr>
	{else}
	<tr>
		<td valign="top" class="text">
			<table cellpadding="0" cellspacing="0" border="0" width="100%">
			<tr>
				<td valign="top" style="padding-left: 15px; padding-top: 15px;">
					<table width="100%" border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td valign="top" width="{$form.icon_max_width+10}" align="center"><img src="{$club.icon_path}" class="icon" alt=""></td>
						<td valign="top">
							<div>
								<font class="text_head">{$lang.club.club_category}:</font> <font class="text">{$club.category}</font><br><br>
								<font class="text_head">{$lang.club.club_type}:</font> <font class="text">{if $club.is_open eq 1}{$lang.club.public}{else}{$lang.club.private}{/if}</font><br>
								<font class="text_head">{$lang.club.founded}:</font> <font class="text">{$club.creation_date}</font><br>
								<font class="text_head">{$lang.club.location}:</font> <font class="text">{if $club.city}{$club.city},{/if} {if $club.region}{$club.region}, {/if}{if $club.country}{$club.country}{else}{$lang.club.undefined}{/if}</font><br>
								<font class="text_head">{$lang.club.members}:</font> <font class="text">{$club.members_count}</font><br>
							</div>
						</td>
						<td valign="top">
							<div>
						{*if $club.user_in_club eq 0}
							<a class="admin_button_major" onclick="document.location.href='{$club.join_link}'">{$lang.club.join_club}<span>&nbsp;</span></a><br>
							<input type="button" value="{$lang.club.join_club}" onclick="document.location.href='{$club.join_link}';">
						{else}
							<font class="text_head">{$lang.club.joined}</font>{if $club.user_is_leader eq 0}<br><br><a href="{$club.leave_link}">{$lang.club.leave_club}{/if}</a><br><br>
						{/if*}
							
														
						{if $club.user_is_leader eq 1 || ($club.user_in_club eq 1 && $club.can_invite eq 1)}
								<font class="text_head">{$lang.club.u_are_leader}</font><br><br>
								<!--a class="admin_button_major" onclick="document.location.href='{$club.invite_link}'">{$lang.club.invite_to_club}<span>&nbsp;</span></a>
								<input type="button" value="{$lang.club.invite_to_club}" onclick="document.location.href='{$club.invite_link}'"-->
						{/if}
							</div>
						</td>
						<td valign="top" width="30%">
							<div>
						{if $club.user_is_leader eq 0}
                        		<table cellpadding="3" cellspacing="0" border="0">
								<tr><td class="text_head">{$lang.club.club_leader}:</td></tr>
								<tr><td><a href="{$club.leader_profile_link}" target="_blank"><img src="{$club.leader_icon}" class="icon" alt=""></a></td></tr>
								<tr><td class="text_head"><a href="{$club.leader_profile_link}" target="_blank">{$club.club_leader}</a></td></tr>
								<tr><td style="padding-top: 3px;"><font class="text_head">{$club.club_leader_age} {$lang.homepage.ans}</font></td></tr>
								<tr><td style="padding-top: 3px;"><font class="text">{if $base_lang.city[$club.club_leader_id_city]}{$base_lang.city[$club.club_leader_id_city]}, {/if}{if $base_lang.region[$club.club_leader_id_region]}{$base_lang.region[$club.club_leader_id_region]}, {/if}{$base_lang.country[$club.club_leader_id_country]}</font></td></tr>
							</table>
                        {else}
{*							<div></div>*}
							<div style="padding-top: 3px;">
								{*<input type="button" value="{$lang.club.edit_club}" onclick="document.location.href='{$club.edit_link}'">*}
								<a class="admin_button_major" onclick="document.location.href='{$club.edit_link}'">{$lang.club.edit_club}<span>&nbsp;</span></a>
							</div>
							<div style="padding-top: 3px;">
{*								<input type="button" value="{$lang.club.delete_club}" onclick="document.location.href='{$club.delete_link}'"><br><br>*}
								<a class="admin_button_major" onclick="ShowClubIconDiv();">{$lang.club.change_club_icon}<span>&nbsp;</span></a>			
							</div>
							<div style="padding-top: 3px;">
								<a class="admin_button_major" onclick="document.location.href='{$club.delete_link}'">{$lang.club.delete_club}<span>&nbsp;</span></a>
{*								<input type="button" value="{$lang.club.change_club_icon}" onclick="ShowClubIconDiv();">*}
							</div>
								<div style="display: none;" id="club_icon_div">
									<div>
									<form action="{$file_name}" method="POST" style="padding: 0px; margin: 0px;" enctype="multipart/form-data" name="form_upl">
									<div style="padding-top: 10px;">
										<input type="hidden" name="sel" value="save_icon">
										<input type="hidden" name="id_club" value="{$club.id}">
										<input type="file" name="club_icon">
									</div>
									<div>
										<a class="admin_button_major" onclick="document.form_upl.submit();">{$lang.button.upload}<span>&nbsp;</span></a>
										{*<input type="submit" value="{$lang.button.upload}">*}
									</div>
									</form>
									</div>
								</div>
							</div>
						{/if}
							</div>
						</td>
					</tr>
					</table>
					<table width="100%" border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td valign="top"><div class="wysiwyg_content">{$club.description}</div></td>
					</tr>
					{if $club.user_is_leader eq 1 || ($club.user_in_club eq 1 && $club.can_post_images eq 1)}
					<tr>
						<td valign="top">
							<div style="height: 1px; margin-top: 5px; margin-right: 12px;" class="delimiter"></div>
							<div style="overflow:hidden;">
								<span class="fl section_header newletter_form" style="font-size:16px;width:auto;">{$lang.club.club_photos}</span>
{*								<input type="button" value="{$lang.club.upload_photo}" onclick="ShowUploadForm();">*}
								<a style="float:right;" class="admin_button_major" onclick="ShowUploadForm();">{$lang.club.upload_photo}<span>&nbsp;</span></a>
							</div>
							<div id="upload_form_div" {if $show_upload_form ne 1} style="display: inline;" {/if}>
							<form action="{$club.upload_photo_link}" enctype="multipart/form-data" method="post" name="form_upl_ph">
							<table cellpadding="0" cellspacing="0">
								<tr>
									<td height="30" width="160" class="text_head">{$lang.club.photo_path}:</td>
									<td height="30"><input type="file" name="upload"></td>
								</tr>
								<tr>
									<td class="text_head" valign="top">{$lang.club.comment_to_photo}:</td>
									<td>
										{$redactor_comment_to_upload}
										<textarea name="comment_to_upload" id="comment_to_upload" class="redactor_normal">{*$data.comment_to_upload*}</textarea>
									</td>
								</tr>
								<tr>
									<td colspan="2">
										{*<input type="submit" value="{$lang.button.upload}">*}
										<a class="admin_button" onclick="document.form_upl_ph.submit();">{$lang.button.upload}<span>&nbsp;</span></a>
									</td>
								</tr>
							</table>
							</form>
							</div>
							{if $club_photos_num>0}
							<div>
								<table cellpadding="5" cellspacing="0" border="0">
									<tr>
										{section name=u loop=$club_photos}
										<td width="{$form.icon_max_width+45}">
										<div>{if $club_photos[u].view_link}<a href="#" onclick="javascript: window.open('{$club_photos[u].view_link}','photo_view','menubar=0, resizable=1, scrollbars=0,status=0,toolbar=0, width=800,height=600');return false;">{/if}<img src="{$club_photos[u].upload_thumb_path}" class="icon" alt="">{if $club_photos[u].view_link}</a>{/if}
										{if $club.user_is_leader eq 1}
											{*<input type="button" value="{$lang.button.delete}" onclick="document.location.href='{$club_photos[u].del_link}';">*}
											<a style="float:right;" class="admin_button" onclick="document.location.href='{$club_photos[u].del_link}';">X<span>&nbsp;</span></a>
										</div>{/if}
										</td>
										{/section}
									</tr>
								</table>
							</div>
							{/if}
						</td>
					</tr>
					{/if}
					{if $club.user_is_leader eq 1}
					<tr>
						<td valign="top">
							<div style="height: 1px; margin-top: 5px; margin-right: 12px;" class="delimiter"></div>
							<div style="overflow:hidden;">
								<span class="fl section_header newletter_form" style="font-size:16px;width:auto;">{$lang.club.add_news}</span>
								{*<input type="button" value="{$lang.club.add_news}" onclick="ShowNewsForm();">*}
								<a class="admin_button_major" style="float:right;" onclick="ShowNewsForm();">{$lang.club.add_news}<span>&nbsp;</span></a>
							</div>
							<div id="news_form_div" {if $show_news_form ne 1} style="display: none;" {/if}>
							<form action="{$club.upload_news_link}" enctype="multipart/form-data" method="post" name="form_news">
							<table cellpadding="0" cellspacing="0">
								<tr>
									<td height="30" width="160" class="text_head">{$lang.club.news_name}:</td>
									<td height="30"><input type="text" value="{$data.news_name}" name="news_name" id="news_name" maxlength="500" style="width: 510px;"></td>
								</tr>
								<tr>
									<td class="text_head" valign="top">{$lang.club.news_text}:</td>
									{$redactor_news_text}
									<td><textarea name="news_text" id="news_text" class="redactor_normal">{*$data.news_text*}</textarea></td>
								</tr>
								<tr>
									<td colspan="2">
										{*<input type="submit" value="{$lang.button.add}">*}
										<a class="admin_button" onclick="document.form_news.submit();">{$lang.button.add}<span>&nbsp;</span></a>
									</td>
								</tr>
							</table>
							</form>
							</div>
							<div>
								{if $club_news_num>0}
								<table width="100%" border="0" cellpadding="3" cellspacing="0">
								<tr>
									<td valign="top" width="100%">
										<div><font class="text_head">{$lang.club.club_news}:</font></div>
										<div>
											<table cellpadding="0" cellspacing="0" border="0" width="100%">
												{section name=n loop=$club_news}
												<tr>
													<td style="padding-top: 5px;">
														<span class="text_head">{$club_news[n].news_name}</span>
														{if $club.user_is_leader eq 1}
														<span style="padding-left: 20px;"><a href="#" onclick="ShowNewsEditDiv({$club_news[n].id});">{$lang.button.edit}</a>&nbsp;|&nbsp;
														<a href="{$club_news[n].del_link}">{$lang.button.delete}</a></span>
														{/if}
													</td>
												</tr>
												<tr>
													<td><font class="text_hidden">{$club_news[n].creation_date}</font></td>
												</tr>
												<tr>
													<td><font class="text">{$club_news[n].news_text}</font></td>
												</tr>
												<tr>
													<td>
														<div style="display: none;" id="news_edit_div_{$club_news[n].id}">
															<form action="{$file_name}" method="POST" style="padding: 10px 0px 10px 0px; margin: 0px;" name="form_news_edit{$club_news[n].id}">
															<input type="hidden" name="sel" value="save_edited_news">
															<input type="hidden" name="id_new" value="{$club_news[n].id}">
															<table cellpadding="0" cellspacing="0">
																<tr>
																	<td height="30" class="text_head">{$lang.club.news_name}:&nbsp;</td>
																	<td height="30"><input type="text" value="{$club_news[n].news_name}" name="news_name" id="news_name" maxlength="500"></td>
																</tr>
																<tr>
																	<td class="text_head">{$lang.club.news_text}:&nbsp;</td>
																	<td><textarea name="news_text" id="news_text{$club_news[n].id}" class="redactor_normal">{$club_news[n].news_text}</textarea></td>
																</tr>
																<tr>
																	<td></td>
																	<td style="padding-top: 5px;">
																		{*<input type="submit" value="{$lang.button.save}">*}
																		<a class="admin_button" onclick="document.form_news_edit{$club_news[n].id}.submit();">{$lang.button.save}<span>&nbsp;</span></a>
																	</td>
																</tr>
															</table>
															</form>
														</div>
													</td>
												</tr>
												{/section}
											</table>
										</div>
									</td>
								</tr>
								{if $club.link_more_news}
								<tr>
									<td style="padding-left: 10px; padding-bottom: 10px;"><a href="{$club.link_more_news}">{$lang.club.all_news}</a></td>
								</tr>
								{/if}
								</table>
								{/if}
							</div>
						</td>
					</tr>
					{/if}
					</table>
					<table width="100%" border="0" cellpadding="3" cellspacing="0">
					<tr>
						<td valign="top">
							<div style="height: 1px; margin-top: 5px; margin-right: 12px;" class="delimiter"></div>
							<div style="overflow:hidden;">
								<span class="fl section_header newletter_form" style="font-size:16px;width:auto;">{$lang.club.club_members}</span>
							</div>
							<div style="height: 10px; margin: 0px">&nbsp;</div>
							{if $club_users_num>0}
							<div style="margin-top: 5px;">
								<table cellpadding="5" cellspacing="0" border="0">
									<tr>
										{foreach item=item from=$club_users}
										<td valign="top" width="150px">
										<table cellpadding="0" cellspacing="0" width="100%" border="0">
											<tr>
												<td width="10%">
													<a href="{$item.profile_link}" target="_blank"><img src="{$item.icon}" class="icon" alt=""></a>
												</td>
												<td valign="top" align="left" style="padding-left: 5px;">
													{*<input type="button" class="button" name="ok" value="X" onclick="document.location.href='admin_club.php?sel=remove_user&id_club={$club_id}&id_user={$item.id_user}'">*}
													<a class="admin_button" name="ok" onclick="document.location.href='admin_club.php?sel=remove_user&id_club={$club_id}&id_user={$item.id_user}'">X<span>&nbsp;</span></a>
												</td>
											</tr>
											<tr><td colspan="2" style="padding-top: 3px;" class="text_head"><a href="{$item.profile_link}" target="_blank">{$item.login}</a></td></tr>
											<tr><td colspan="2" style="padding-top: 3px;"><font class="text_head">{$item.age} {$lang.homepage.ans}</font></td></tr>
											<tr><td colspan="2" style="padding-top: 3px;"><font class="text">{if $base_lang.city[$item.id_city]}{$base_lang.city[$item.id_city]}, {/if}{if $base_lang.region[$item.id_region]}{$base_lang.region[$item.id_region]}, {/if}{$base_lang.country[$item.id_country]}</font></td></tr>
										</table>
										</td>
										{/foreach}
									</tr>
								</table>
							</div>
							{/if}
						</td>
					</tr>
					{if $club.link_more_users}
					<tr>
						<td style="padding-left: 10px; padding-bottom: 10px;"><a href="{$club.link_more_users}">{$lang.club.all_users}</a></td>
					</tr>
					{/if}
					</table>
				{if $forum || $club.user_is_leader eq 1}
					<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td>
							<div style="height: 1px; margin-top: 5px; margin-right: 12px;" class="delimiter"></div>
							<div style="overflow:hidden;">
							<span class="fl section_header newletter_form" style="font-size:16px;width:auto;">{$lang.club.club_forum}:</span>
							{if $club.user_is_leader eq 1}
							<a class="admin_button_major" style="float:right;" href="#" onclick="$('#add_cat_form').toggle(); return false;">{$lang.club.add_cat_link}<span>&nbsp;</span></a>
							{/if}
							</div>
							{if $club.user_is_leader eq 1}
{*							<div align="right" style="float:right"><a href="#" onclick="$('#add_cat_form').toggle(); return false;">{$lang.club.add_cat_link}</a>*}
								<div id="add_cat_form" style="{if !$show_cat_form}display:none;{/if}">
									<form action="admin_forum.php?sel=save_new_cat_of_club" method="post" name="form_cat">
									<input type="hidden" name="cat_type" value="club" />
									<input type="hidden" name="id_club" value="{$club.id}" />
									<table cellpadding="5" cellspacing="0">
									<tr>
										<td class="main_header_text">{$lang.forum.category_name}:&nbsp;</td>
										<td class="main_content_text"><input type="text" name="category_name" value="{$req.name}"></td>
									</tr>
									{*<tr>
										<td class="main_header_text">{$lang.forum.category_description}:&nbsp;</td>
										<td class="main_content_text"><textarea name="category_description" style="width: 250px; height: 60px;">{$req.descr}</textarea></td>
									</tr>*}
									<tr>
										<td class="main_header_text">{$lang.forum.category_sorter}:&nbsp;</td>
										<td class="main_content_text">
										<select name="category_sorter">
											{foreach item=item from=$sorter}
											<option value="{$item.value}" {if $item.sel eq 1}selected{/if}>{$item.value}</option>
											{/foreach}
										</select>
										</td>	
									</tr>
									<tr>
										<td colspan="2">
											{*<input type="submit" value="{$lang.button.add}" />*}
											<a class="admin_button" onclick="document.form_cat.submit();">{$lang.button.add}<span>&nbsp;</span></a>
										</td>
									</tr>
									</table>
									</form>
								</div>
							</div>
							{/if}
						</td>
					</tr>
					</table>
				{/if}
				{if $forum}
					<table cellpadding="0" cellspacing="2" width="100%" border="0" class="simple_centered_table">
					<tr>
						<th width="70" style="text-align:left;">{$lang.forum.categories}</th>
						{if $club.user_is_leader eq 1}
						<th width="1%">{$lang.button.action}
						</th>
						{/if}
						<th width="12%">{$lang.forum.topics}</th>
						<th width="12%">{$lang.forum.posts}</th>
					</tr>
					{foreach name=f from=$forum item=item}
					<tr>
						<td id="view_name{$item.id}" style="text-align:left"><a href="{$item.view_link}">
						{if !($item.new_posts eq 0  || $guest eq 1)}<b>{/if}
						{$item.category}
						{if !($item.new_posts eq 0  || $guest eq 1)}</b>{/if}
						</a></td>
						{if $club.user_is_leader eq 1}
						<td id="edit_name{$item.id}" style="display:none; text-align:left">
							<input id="name_{$item.id}" type="text" name="name" value="{$item.category}">
							<select id="sorter_{$item.id}" name="sorter">
								{foreach item=sort_opt from=$sorter_edit}
								<option value="{$sort_opt.value}" {if $sort_opt.value == $item.sorter}selected{/if}>{$sort_opt.value}</option>
								{/foreach}
							</select>
						</td>
						<td style="white-space:nowrap;">
{*							<div class="block_action fr" style="display: block;cursor:pointer;">
								<div class="action_del" style="display: block;">
									<img width="16" alt="" src="{$site_root}{$template_root}/images/edit.png">
								</div>
							</div>			
							<div class="block_action fr" style="display: none;cursor:pointer;">
								<div class="action_del" style="display: block;">
									<img width="16" alt="" src="{$site_root}{$template_root}/images/success.png">
								</div>
							</div>			*}
							<div style="width:10px;float:right;" class="fl">&nbsp;</div>
							<div class="block_action fr" style="display: block;cursor:pointer;">
								<div class="action_del" style="display: block;">
									<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="location.href='{$item.delete_link}';">
								</div>
							</div>			
							<div style="width:10px;float:right;" class="fl">&nbsp;</div>
{*							<a class="admin_button_major" id="butt_edit{$item.id}" onclick="editCat({$item.id});">{$lang.button.edit}<span>&nbsp;</span></a>
							<a class="admin_button_major" id="butt_save{$item.id}" style="display:none;" onclick="saveCat({$item.id});">{$lang.button.save}<span>&nbsp;</span></a>
							<a class="admin_button_major" onclick="location.href='{$item.delete_link}';">{$lang.button.delete}<span>&nbsp;</span></a>*}
{*							<input id="butt_edit{$item.id}" type="button" value="{$lang.button.edit}" class="left_button" onclick="editCat({$item.id});" />
							<input id="butt_save{$item.id}" type="button" value="{$lang.button.save}" class="left_button" style="display:none;" onclick="saveCat({$item.id});" />
							<input type="button" value="{$lang.button.delete}" onclick="location.href='{$item.delete_link}';	" />*}
						</td>
						{/if}
						<td>{$item.total_subcategories}</td>
						<td>{$item.total_posts}</td>
					</tr>
					{/foreach}
					</table>
				{/if}
					
					
					
				</td>
			</tr>
			</table>
		</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>
{literal}
<script type="text/javascript">
function ShowUploadForm() {
	if (document.getElementById('upload_form_div').style.display == 'none'){
		document.getElementById('upload_form_div').style.display = 'inline';
	} else {
		document.getElementById('upload_form_div').style.display = 'none';
	}
	return false;
}
function ShowNewsForm() {
		if (document.getElementById('news_form_div').style.display == 'none'){
		document.getElementById('news_form_div').style.display = 'inline';
	} else {
		document.getElementById('news_form_div').style.display = 'none';
	}
	return false;
}

function JoinBtnFunc() {
	if (document.getElementById('agree').checked) {
		document.getElementById('btn_join').disabled = false;
	} else {
		document.getElementById('btn_join').disabled = true;
	}
	return false;
}
function ShowNewsEditDiv(id_new) {
	if(typeof $news_text != 'object'){
		$news_text = {};
	}
	if(typeof $news_text[id_new] != 'object'){
		$news_text[id_new] = $('#news_text' + id_new).redactor({
			checkBadWords: false,
			lang: redactor_lang
		});
		/*$news_text[id_new].setHtml();*/
	}
	
	if (document.getElementById('news_edit_div_'+id_new).style.display == 'none') {
		document.getElementById('news_edit_div_'+id_new).style.display = 'inline';
	} else {
		document.getElementById('news_edit_div_'+id_new).style.display = 'none';
	}
	return false;
}
function ShowClubIconDiv() {
	if (document.getElementById('club_icon_div').style.display == 'none') {
		document.getElementById('club_icon_div').style.display = 'inline';
	} else {
		document.getElementById('club_icon_div').style.display = 'none';
	}
	return false;
}
$(document).ready(function() {
    $("table .simple_centered_table .action_edit").click(
        function(){
            var ref_id = $("tr .select_tr").find('input[type="hidden"]').val();
            REF_OLD = $('#ref_'+ref_id).text();
            str = '<input type="text" name="ref_new" id="ref_new_'+ref_id+'" value="'+REF_OLD+'" size="20">';
            $('#ref_'+ref_id).html(str);
            $('tr .select_tr').find('div .action_edit, .action_del').css('display', 'none');
            $('tr .select_tr').find('div .action_save').css('display', 'block');
        }
    );
    $("table .simple_centered_table .action_save").click(
        function(){
            var ref_id = $("tr .select_tr").find('input[type="hidden"]').val();
            var ref_new = $('#ref_new_'+ref_id).val();
            if (ref_new == '') return;
            ajaxIndicator(1, 'ref_'+ref_id);
            $.post('admin_reference.php', {sel:'change',ref:ref, id:ref_id,name:ref_new},
                function(data){
                    ajaxIndicator(0, 'ref_'+ref_id);
                    if (data=="")
                        $('#ref_'+ref_id).html(REF_OLD);
                    else 
                        $('#ref_'+ref_id).html(data);
                    REF_OLD = "";
                }
            );
            $('tr .select_tr').find('div .action_edit, .action_del').css('display', 'block');
            $('tr .select_tr').find('div .action_save').css('display', 'none');
        }
    );
});
</script>
{/literal}
{include file="$admingentemplates/admin_bottom.tpl"}