{include file="$gentemplates/$header_tpl"}
		<div style="display:table; width:100%">
			<h2>{$club.club_name}{if $data.agree_form eq 1}{$data.name}{/if}
				<ins onclick="javascript:location.href='{$site_root}/{$seo.club}?sel=create';" class="add-icon sub_icon" title="{$header_s.club_menu_3}">&nbsp;</ins>
			</h2>
        </div> 
		
		{if $links_top}
		<div style="display:table;width:100%;padding: 15px 0;">
			{include file="$gentemplates/pagination_top.tpl"}
		</div>
		{/if}		
        
        {if $data.agree_form eq 1}
			<p>
				<textarea rows="3" cols="90" readonly>{$data.agreement_text}</textarea>
			</p>
			<p>
				<input type="checkbox" value="1" id="agree" onclick="JoinBtnFunc()">
				{$lang.club.i_agree_text}		
			</p>
			<p><input type="button" value="{$lang.club.join_club}" id="btn_join" disabled onclick="document.location.href='{$data.agree_link}'" /></p>
        {else}
			<div style="overflow: hidden;">
				<div class="float_left" style="width: {if $club.user_is_leader eq 0}600px{else}100%{/if};">
					<div style="overflow:hidden;">
						<div class="float_left imgcanvas_container" style="margin-{$default_right}:10px;">
							<img src="{$club.icon_path}" class="imgcanvas" style="margin-{$default_right}:10px" alt=""/><br/>
						</div>
						<div class="float_left" style="width:{if $club.user_is_leader eq 0}440px;{else}600px;{/if}">
							<p>
								<font class="float_left">{$lang.club.club_category}:&nbsp;</font><font class="float_left">{$club.category}</font><br>
								<font class="float_left">{$lang.club.club_type}:&nbsp;</font><font class="float_left">{if $club.is_open eq 1}{$lang.club.public}{else}{$lang.club.private}{/if}</font><br>
								<font class="float_left">{$lang.club.founded}:&nbsp;</font><font class="float_left">{$club.creation_date}</font><br>
								<font class="float_left">{$lang.club.location}:&nbsp;</font><font class="float_left">{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="float_left">{$lang.club.members}:&nbsp;</font><font class="float_left">{$club.members_count}</font><br>
							</p>
							<div class="left wysiwyg_content">{$club.description}</div>
						</div>
					</div>
					<div style="padding-top:5px;">
						{if $club.user_in_club eq 0}
							<input type="button" value="{$lang.club.join_club}" onclick="document.location.href='{$club.join_link}';">
						{else}
							{if $club.user_is_leader eq 0}<a href="{$club.leave_link}">{$lang.club.leave_club}{/if}</a>
						{/if}					
						{if $club.user_is_leader eq 1}
							<a title="{$lang.button.edit}" href="{$site_root}/{$seo.club}?sel=edit_club&id_club={$club.id}">{$lang.button.edit}</a><br/>
							<a title="{$lang.button.delete}" href="{$site_root}/{$seo.club}?sel=delete_club&id_club={$club.id}">{$lang.button.delete}</a>
						{/if}
					</div>
				</div>
            {if $club.user_is_leader eq 0}
				<div class="float_right" style="width:135px;">
					{$lang.club.club_leader}:<br />
					<a class="imgcanvas_container" href="{$club.leader_profile_link}" target="_blank">
						<img src="{$club.leader_icon}" class="imgcanvas" alt="">
					</a><br />
					<a href="{$club.leader_profile_link}" target="_blank">{$club.club_leader}</a><br />
					{$club.club_leader_age} {$lang.club.ans}<br />
					<div style="text-align:{$default_left};">{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]}</div>
				</div>
			{/if}
			{if $club.user_is_leader eq 1}
				<div class="float_right" style="width:205px;">
					<div style="display:none" id="club_icon_div">
						<form action="{$site_root}/{$seo.club}" method="POST" enctype="multipart/form-data">
							<input type="hidden" name="sel" value="save_icon">
							<input type="hidden" name="id_club" value="{$club.id}">
							<p><input type="file" name="club_icon"></p>
							<p><input type="submit" value="{$lang.button.upload}"></p>
						</form>
					</div>
				</div>
			{/if}
			</div>
			
            
			{if $data.user_tags && $use_tags}
			<!--begin tags list -->
				<h3 class="p-b5">{$lang.club.user_tags}</h3>
				{section name=s loop=$data.user_tags}
					<a href="{$data.user_tags[s].searchlink}" title="{$data.user_tags[s].count}">{$data.user_tags[s].tag}</a>
					&nbsp;
					{if $club.user_is_leader eq 1}
					<a href="{$data.user_tags[s].dellink}" class="small-del-icon" title="{$lang.button.delete}">&nbsp;</a>
					{/if}
					&nbsp;&nbsp;
				{/section}
				<!--	end tags list-->    
			{/if}
			
			{if $use_tags}
			<h3 class="p-b5">{$lang.subsection.i_tag_myprofile}</h3> 
			{if $data.my_tags}
				<!--begin my tags list--> 				
				{section name=s loop=$data.my_tags}
					<a href="{$data.my_tags[s].searchlink}" title="{$data.my_tags[s].count}">{$data.my_tags[s].tag}</a>&nbsp;<a href="{$data.my_tags[s].dellink}" title="{$lang.button.delete}" class="small-del-icon">&nbsp;</a>&nbsp;
				{/section}
				<!-- end my tags list--> 
			{/if}
            <form action="{$site_root}/{$seo.club}" name="tag" method="POST">
				<input type="hidden" name="sel" value="addtag"/>
				<input type="hidden" name="id_club" value="{$club.id}"/>
				<p>
					{$lang.club.add_tag}:<br />
					<input type="text" onkeyup="BadWords('tag');" name="tag" id="tag"/>
			        <div id="bad_div_tag" class="bad_div_left"></div>
				</p>
				<p>
                    <input type="submit" value="{$lang.tag}">
				</p>
            </form>
			{/if}
			
		<div style="display:table;width:100%;">	
            <h3 class="p-b5 link_more_news">{$lang.club.club_members}&nbsp;({$club.members_count})
				{if $club.user_is_leader eq 1 || ($club.user_in_club eq 1 && $club.can_invite eq 1)}
					<ins onclick="document.location.href='{$club.invite_link}'" class="add-icon sub_icon" title="{$lang.club.invite_to_club}">&nbsp;</ins>
					{if $club.link_more_users}<ins onclick="javascript:location.href='{$club.link_more_users}'" title="{$lang.club.all_users}" class="view-icon sub_icon">&nbsp;</ins>{/if}
				{/if}
			</h3>									
			{if $club_users_num>0}
				{foreach item=item from=$club_users}							     
					<div class="float_left" style="width: 120px; position:relative;">
						<div>
						<a class="float_left imgcanvas_container" href="{$item.profile_link}" target="_blank">
							<img src="{$item.icon}" class="imgcanvas" alt="">
						</a>
						</div>
						{if $club.user_is_leader eq 1}
						<div><a class="delete_icon_grey" href="{$item.profile_delete_link}" style="top:82px; {$default_left}:5px; position:absolute;" title="{$lang.button.delete}">&nbsp;</a>				
						</div>{/if}
						<div>
							<a href="{$item.profile_link}" target="_blank">{$item.login|truncate:18:"...":true}</a>
						</div>
						<div>
							{$item.age} {$lang.club.ans}
						</div>	
							<div style="text-align:{$default_left};">{if $item.location}{$item.location|truncate:18:"...":true}{/if}</div>
						</p>	
					</div>
				{/foreach}				
			{/if}
		</div>
			<div style="clear:both"></div>
		
		<div style="display:table;width:100%;">	
			<h3 class="p-b5 link_more_news">{$lang.club.club_photos}&nbsp;({$club.photos_count})						
				{if $club.user_is_leader eq 1 || ($club.user_in_club eq 1 && $club.can_post_images eq 1)}
					<ins class="photo-icon sub_icon" onclick="launchWindow('{$add_link}','id_club={$club.id}',650,510); return false;" title="{$lang.club.upload_photo}">&nbsp;</ins>
					{if $club.link_more_photos}<ins onclick="document.location.href='{$club.link_more_photos}'" title="{$lang.club.all_photos}" class="view-icon sub_icon">&nbsp;</ins>{/if}
				{/if}
			</h3>
			{if $club.user_is_leader eq 1 || ($club.user_in_club eq 1 && $club.can_post_images eq 1)}				
				<div id="upload_form_div" {if $show_upload_form ne 1} style="display:none;" {/if}>
					<form action="{$club.upload_link}" enctype="multipart/form-data" method="post">
						<p>
							{$lang.club.photo_path}:<br />
							<input type="file" name="upload">
						</p>
						<p>
							{$lang.club.comment_to_photo}:<br />
							<textarea name="comment_to_upload" id="comment_to_upload" style="width: 200px;" rows="5">{$data.comment_to_upload}</textarea>
						</p>
						<p>
							<input type="submit" value="{$lang.button.upload}">
						</p>
					</form>
				</div>
				<p>&nbsp;</p>
			{/if}
				{if $club_photos_num>0}
				{section name=u loop=$club_photos}
					<div style="width: {$form.icon_max_width+40}px;position:relative;" class="float_left" >
						{if $club_photos[u].view_link}
							<a class="imgcanvas_container" href="#" onclick="launchWindow('{$club_photos[u].view_link}','',800,550); return false;">
								<img src="{$club_photos[u].upload_thumb_path}" class="imgcanvas" alt="" />
							</a>
						{else}
							<a class="imgcanvas_container"><img src="{$club_photos[u].upload_thumb_path}" class="imgcanvas" alt="" /></a>
						{/if}
						{if $club.user_is_leader eq 1}
							<a class="delete_icon_grey" style="top:82px; {$default_left}:5px; position:absolute;" href="{$club_photos[u].del_link}" title="{$lang.button.delete}">&nbsp;</a>		
						{/if}
					</div>
				{/section}
			{/if}
			
		</div>
		<div style="clear:both">&nbsp;</div>
		
		<div style="display:table;width:100%;">		
			<h3 class="p-b5 link_more_news">{$lang.club.club_news}&nbsp;({$club.news_count})
			{if $club.user_is_leader eq 1}
				<ins onclick="launchWindow('{$add_news_link}','id_club={$club.id}',650,510); return false;" class="add-icon sub_icon" title="{$lang.club.add_news}">&nbsp;</ins>
				{if $club.link_more_news}
					<ins onclick="javascript:location.href='{$club.link_more_news}';" class="view-icon sub_icon" title="{$lang.club.all_news}">&nbsp;</ins>
				{/if}
			{/if}
			</h3>
			{if $club_news_num>0}
				{if $club.user_is_leader eq 1}
					<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">
							<p>
								{$lang.club.news_name}:<br />
								<input type="text" value="{$data.news_name}" name="news_name" id="news_name" maxlength="500">
							</p>
							<p>
								{$lang.club.news_text}:<br />
								<textarea name="news_text" id="news_text" style="width: 200px;" rows="5">{$data.news_text}</textarea>
							</p>
							<p>
								<input type="submit" value="{$lang.button.add}">
							</p>
						</form>
						<p>&nbsp;</p>
					</div>
					
				{/if}
				{section name=n loop=$club_news}					
					<div style="width:100%;display:table;">
					<div class="float_left">
						<p class="text_head">{$club_news[n].news_name}</p>						
						<p class="text_hidden">{$club_news[n].creation_date}</p>
						<p>{$club_news[n].news_text}</p>
					</div>
					{if $club.user_is_leader eq 1}
						<div class="float_right">
							<p><a style="cursor:pointer;" title="{$lang.button.edit}" onclick="launchWindow('{$club_news[n].edit_news_link}','',650,510); return false;">{$lang.button.edit}</a></p>
							<p><a style="cursor:pointer;" title="{$lang.button.delete}" href="{$site_root}/{$seo.club}?sel=delete_new&id={$club_news[n].id}">{$lang.button.delete}</a></p>
						</div>
					{/if}
					<div style="display:none;" id="news_edit_div_{$club_news[n].id}">
						<form action="{$site_root}/{$seo.club}" method="POST" style="padding-top:10px; padding-{$default_right}:0px; padding-bottom:10px; padding-{$default_left}:0px; margin: 0px;">
							<input type="hidden" name="sel" value="save_edited_news">
							<input type="hidden" name="id_new" value="{$club_news[n].id}">
							<p>
								{$lang.club.news_name}:<br />
								<input type="text" value="{$club_news[n].news_name}" name="news_name" id="news_name" maxlength="500">
							</p>
							<p>
								{$lang.club.news_text}:<br />
								<textarea name="news_text" id="news_text" style="width: 300px;" rows="7">{$club_news[n].news_text}</textarea>
							</p>
							<p>
								<input type="submit" value="{$lang.button.save}">
							</p>
						</form>
					</div>
					
					</div>
					<p>&nbsp;</p>
				{/section}
			{/if}
		</div>
		<div style="clear:both"></div>
		
		{if $use_pilot_module_forum}				
			<h3 class="p-b5 link_more_news">{$lang.club.club_forum}
			{if $club.user_is_leader eq 1}
				<ins onclick="launchWindow('{$add_disc_link}','id_club={$club.id}',650,510); return false;" title="{$lang.club.add_cat_link}" class="add-icon sub_icon">&nbsp;</ins>
				<div style="">
					<div id="add_cat_form" {if !$show_cat_form} style="display:none;"{/if}></div>
				</div>
			{/if}
			</h3>
			{if $forum}
				<div class="contant">
				<dl style="overflow:hidden;">
					<dt class="float_left" style="width:235px;">{$lang.forum.categories}&nbsp;</dt>
					<dt class="float_left" style="width:335px;" >&nbsp;</dt>
					<dt class="float_left" style="width:77px;" >{$lang.forum.topics}&nbsp;</dt>
					<dt class="float_left" style="width:76px;" >{$lang.forum.posts}&nbsp;</dt>
				</dl>
				<input type="hidden" id="open_cat_id" value="">
				{section name=i loop=$forum}
				<dl style="overflow:hidden;padding:10px 0;">
					<dd id="view_name{$forum[i].id}" style="text-align:{$default_left}; width:444px;" class="float_left">
						<div onclick="{if $forum_sub[i]}ShowCat({$forum[i].id});{else}location.href='{$forum[i].view_link}';{/if}">
							<font style="cursor:pointer;"><a>{$forum[i].category}</a></font>
						</div>
					</dd>
					{if $club.user_is_leader eq 1}
						<dd id="edit_name{$forum[i].id}" class="float_left" style="display:none; text-align:{$default_left}; width:444px;">
							<input style="margin-top:-5px;" id="name_{$forum[i].id}" type="text" name="name" value="{$forum[i].category}">
							<select id="sorter_{$forum[i].id}" name="sorter" style="margin-top:-4px;">
								{foreach item=sort_opt from=$sorter_edit}
								<option value="{$sort_opt.value}" {if $sort_opt.value == $forum[i].sorter}selected="selected"{/if}>{$sort_opt.value}</option>
								{/foreach}
							</select>
						</dd>
						<dd style="width:165px; padding-top: 7px; padding-bottom: 4px;" class="float_left" >
							<a class="edit-icon" id="butt_edit{$forum[i].id}" title="{$lang.button.edit}" onclick="editCat({$forum[i].id});">
								&nbsp;
							</a>
							<input style="margin-top:-8px;display:none;" id="butt_save{$forum[i].id}" type="button" value="{$lang.button.save}" class="float_left left_button" onclick="saveCat({$forum[i].id});" />&nbsp;
							<a class="delete-icon" onclick="location.href='{$forum[i].delete_link}';" title="{$lang.button.delete}">
								&nbsp;
							</a>
						</dd>
					{else}	
						<dd class="float_left" style="width:150px;">
						</dd>
					{/if}
					<dd class="float_left" style="width:74px;">{$forum[i].total_subcategories}</dd>
					<dd class="float_left" style="width:55px;">{$forum[i].total_posts}</dd>
				</dl>
				{if $forum_sub[i]}
				<dl style="overflow:hidden;">
					<dd class="float_left" style="width:50px;"></dd>
					<dd class="float_left" style="width:250px;">
						<div id="sub_{$forum[i].id}" style="display:none">
						<div>
						{section name=j loop=$forum_sub[i]}
							<dl class="float_left">
								<dd style="width:100px;text-align:{$default_left}; padding-{$default_left}:25px;" class="float_left">
									<a href="{$forum_sub[i][j].view_link}">{$forum_sub[i][j].subcategory}</a>
								</dd>
							</dl>
						{/section}
							<dl class="float_left">
								<dd style="width:100px;text-align:{$default_right}; padding-{$default_right}:20px;" class="float_left">
									<a href="{$forum[i].view_link}">{$lang.club.all_category}</a>
								</dd>
							</dl>
						</div>
						</div>
					</dd>
					<dd colspan="3" class="float_left">&nbsp;</dd>
				</dl>
				{/if}
				{/section}
			</div>
			{include file="$gentemplates/pagination_bottom.tpl"}
			{/if}
		{/if}
        {/if}
{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 (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;
}

function editCat(id_cat){
	$("#edit_name"+id_cat).show();
	$("#view_name"+id_cat).hide();
	$("#butt_save"+id_cat).show();	
	$("#butt_edit"+id_cat).hide();	
}

function ShowCat(id_cat) {
	if ($("#open_cat_id").val() != "")
	{
		var id = $("#open_cat_id").val();
		$("#sub_"+id).hide();
	}
	$("#sub_"+id_cat).show();
	$("#open_cat_id").val(id_cat);
}

{/literal}{if $club.id}var id_club={$club.id};{/if}{literal}
function saveCat(id_cat){
	var name=$("#name_"+id_cat).val();
	var sorter=$("#sorter_"+id_cat).val();
	str = 'sel=save_cat&id_club='+id_club+'&id_cat='+id_cat+'&name='+name+'&sorter='+sorter;
	location.href='{/literal}{$site_root}/{$seo.club}{literal}?'+str;
}

</script>
{/literal}
{include file="$gentemplates/$footer_tpl"}