{if $ajax eq 0}	
{include file="$gentemplates/$header_tpl"}
<h2>{$event.event_name}</h2>
	<div style="margin: 0px; height: 25px;float:right;padding-top:10px;padding-bottom:5px;">
	</div>
		{literal}
		<script type="text/javascript">
		$(function() {
		$('#tool_tip_4 *').tooltip();
		});
		</script>
		{/literal}
		
	<div style="width:100%;display:table;">

    {*if $form.err}
	<p class="error_msg">*&nbsp;{$form.err}</p>
	{/if*}
	<div class="content content_adult_2" style=" margin: 0px;width:100%;display:table;">
		<div class="event_header" style="width:100%; overflow: hidden;">
                    <div {if $event.user_is_creator eq 0}class="float_left"{/if}>
                        <div style="width:100%; overflow: hidden;">
			<!-- info -->
			{if $event.main_photo}
				<div class="imgcanvas_container float_left">
					<img src="{$event.main_photo}" class="imgcanvas" />
				</div>
			{/if}
			<div class="float_left" style="width:{if $event.user_is_creator eq 0}490{else}620{/if}px;">
				<div style="width:100px;" class="float_left">{$lang.events.type}:</div> 
				<div style="" class="float_left">{$event.type}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.event_date_begin}:</div> 
				<div style="" class="float_left">{$event.date_begin}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.event_date_end}:</div> 
				<div style="" class="float_left">{$event.date_end}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.event_periodicity}:</div> 
				<div style="" class="float_left">{$event.periodicity} {if $event.date_die}{$lang.events.until} {$event.date_die}{/if}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.location}:</div> 
				<div style="" class="float_left">{if $event.location eq ""} ... {else} {$event.location}; {/if}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.event_place}:</div> 
				<div style="" class="float_left">{$event.place}</div><br>
				<div style="width:100px;" class="float_left">{$lang.events.event_descr}:</div> 
				<div style="" class="float_left">{if $event.description eq ""} ... {else}<div class="wysiwyg_content">{$event.description}</div>{/if}</div><br>			
			</div></div>
			<div style="padding-top:5px;">
				{if $event.user_join_event eq 0}
					<p><input type="submit" onclick="document.location.href='{$event.join_link}';" value="{$header.join_event}" title="{$header.join_event}"></p>
					<br>
				{else}
					{if $event.user_is_creator eq 0}<p><a href="{$event.leave_link}">{$header.leave_event}</a></p>
					<br>{/if}
				{/if}
				{if $event.flyer}<a href="{$event.flyer}">{$header.flyer_print}</a>
					<br>{/if}
				{if $event.user_is_creator eq 1}
					<a href="{$event.edit_link}">{$header.edit}</a><br/>
					<a href="{$event.delete_link}">{$header.delete_event}</a>
				{/if}
                        </div>
                    </div>
			{if $event.user_is_creator eq 0}
				<div class="float_left" style="width:130px;">
					<a class="imgcanvas_container" href="{$event.creator_profile_link}" target="_blank" style="position:relative;">
						<img src="{$event.creator_icon}" class="icon imgcanvas" alt="">
					</a>
					<p style="overflow:hidden;">
						<a href="{$event.creator_profile_link}" target="_blank" class="float_left">{$event.event_creator}</a>
						<font class="float_left">{if $default_left ne 'left'}&nbsp;{/if},{if $default_left eq 'left'}&nbsp;{/if}</font>				
						<font class="float_left">{$event.event_creator_age} {$lang.events.ans}</font>
					</p>
					<div style="padding-bottom:7px;">{$lang.events.event_creator}</div>
				</div>
			{/if}
			<!-- members -->
			<div style="display:table;width:100%;">
				<h3 class="p-b5">{$lang.events.event_members}&nbsp;({$event.members_count})
					{if $event.can_invite eq 1 || $event.user_is_creator eq 1}
						<ins onclick="javascript:location.href='{$event.invite_link}';" class="add-icon sub_icon" title="{$lang.events.invite_to_event}">&nbsp;</ins>
					{/if}
					{if $event.link_more_users}
						<ins onclick="javascript:location.href='{$event.link_more_users}';" class="view-icon sub_icon" style="{$default_right}: 35px;" title="{$lang.events.all_users}">&nbsp;</ins>
					{/if}
				</h3>
							
				{if $event_users_num>0}
				<div>
					<dl>
						{foreach item=item from=$event_users}
						<dt valign="top" style="width:120px">
						<div style="width:100%;">
							<div class="imgcanvas_container" style="position:relative;"><a href="{$item.profile_link}" target="_blank"><img src="{$item.icon}" class="imgcanvas" alt=""></a></div>
							<div><a href="{$item.profile_link}" target="_blank" class="text-overflow ib-100">{$item.login}</a></div>
							<div>{$item.age} {$lang.events.ans}</div>
						</div>
						</dt>
						{/foreach}
					</dl>
				</div>
				{/if}
			</div>
			
			<!-- photo -->
			<div style="display:table;width:100%;">
				<h3 class="p-b5">{$lang.events.event_photos}&nbsp;({$event.photos_count})
					{if $event.can_post_images eq 1 || $event.user_is_creator eq 1}
						<ins onclick="launchWindow('{$event.add_link}','id_event={$event.id}',650,510); return false;" class="photo-icon sub_icon" title="{$lang.events.upload_photo}">&nbsp;</ins>
					{/if}
					{if $event.link_more_photos}
						<ins onclick="javascript:location.href='{$event.link_more_photos}';" class="view-icon sub_icon" style="{$default_right}: 35px;" title="{$lang.events.all_photo}">&nbsp;</ins>
					{/if}
				</h3>
				{if $event_photos_num>0}
					<div style="overflow:hidden;">
					{section name=u loop=$event_photos}
						<dt style="width:{$form.icon_max_width+40}px;">
						<div {if !$event_photos[u].view_link}class="imgcanvas_container"{/if}>
							{if $event_photos[u].view_link}										
								<a href="#" class="imgcanvas_container" onclick="launchWindow('{$event_photos[u].view_link}','',650,510); return false;">															
							{/if}
								<img src="{$event_photos[u].upload_thumb_path}" class="icon imgcanvas" alt="">
							{if $event_photos[u].view_link}
								</a>										
							{/if}										
						</div>
						{if ($event.user_is_creator eq 1) || ($event_photos[u].user_upload eq 1)}
							<div style="position:relative;">
								<a title="{$lang.button.delete}" onclick="document.location.href='{$event_photos[u].del_link}';" class="delete_icon_grey" style="top:-28px; {$default_left}:5px; position:absolute;">&nbsp;</a>
							</div>							
						{/if}
						</dt>
					{/section}
					</div>
				{/if}
			</div>
{/if}		
			<!-- comment -->
			<div id="comments" style="display:table;width:100%;">
				<h3 class="p-b5">{$lang.events.event_comments}
					<ins class="view_all sub_icon" style="right: 35px;" title="{$lang.events.all_users}">&nbsp;</ins>
				</h3>				
				{section name=n loop=$event_comments}
					<dl valign="middle" style="">									
						<dt style="width:120px;position:relative;" {if $event_comments[n].profile_link}class="text"{else}class="text imgcanvas_container"{/if} align="center" valign="top">{if $event_comments[n].profile_link}<a class="imgcanvas_container" href="{$event_comments[n].profile_link}">{/if}<img src="{$event_comments[n].icon_path}" class="icon imgcanvas" alt="" onmouseover="javascript: CreateBigImage(this, event, {if $default_left eq 'left'}false{else}true{/if}, false);">{if $event_comments[n].profile_link}</a>{/if}</dt>
						<dd style="height:120px;" class="text" valign="top">
							<div style="overflow:hidden; margin-top: 0px">
								{if $event_comments[n].profile_link}<a class="float_left" href="{$event_comments[n].profile_link}">{/if}
								<span class="float_left">{$event_comments[n].name}&nbsp;</span>
								{if $event_comments[n].profile_link}</a>{/if}
								<span class="float_left">({$event_comments[n].date})&nbsp;&nbsp;</span>
								{if $event_comments[n].delete_link}
									&nbsp;<a class="float_left" onclick="Delete_Comment('{$event_comments[n].delete_link}');" href="#" title="{$lang.button.delete}">{$lang.button.delete}</a>
								{/if}
							</div>
							<div style="margin-top: 15px">
								<font class="text">{$event_comments[n].comment}</font>&nbsp;
							</div>
							<div style="margin-top: 15px">
								<font class="text_hidden"><b>{$event_comments[n].type}</b></font>
							</div>
							<div style="padding-top: 10px;padding-bottom:4px;">								
								&nbsp;
							</div>
						</dd>
					</dl>
				{/section}
                {if $event.user_join_event}
				<div class="content_alloc classfields">
					<div>
					<form action="{$event.add_comment_link}" method="post" name="comment_form">
						<select id="comment_type" name="comment_type" style="margin-bottom:20px;margin-top:5px;">
							<option value="comment">{$lang.events.comment}</option>
							<option value="feedback">{$lang.events.feedback}</option>
						</select>
						<textarea style="resize: none;" name="comment_to_event" id="comment_to_event" cols=90 rows=4 onkeyup="BadWords('comment_to_event'); textchange2()" ></textarea>							
						<div id="bad_div_comment_to_event" class="bad_div"></div>
                        <div class="comments" style="margin: 10px 2px; text-align: {$default-right}; display: table; width: 100%;">
							<div class="float_right" style="margin-top:9px;margin-{$default-right}:7px;" id="count_sym2">256</div>
							<script>{literal}
								function textchange2() {
									var count = 256;
									$('#count_sym2').text(count);
									a = $('#comment_to_event').val().length;
									if (a > count) {
										$('#comment_to_event').val($('#comment_to_event').val().substring(0, count));
									}
									a = $('#comment_to_event').val().length;
									$('#count_sym2').text(count - a);
									if (a > count){
										$('#comment_to_event').css("disabled", "disabled");
									}
								}
							{/literal}</script>
							<div style="height: 16px; width: 10px;" class="icon_smail_for_comment float_left" onclick="return displaySmileLayer();"></div>
							<div id=smiles class="smiles" style="display:none; {$default_left}: 264px; width: 255px;">                                   
								<ul>
								{section name=sm loop=$smiles}
								{if $use_default_smiles eq '1'}
								<li><a style="cursor:pointer;" onclick="document.getElementById('comment_to_event').value=document.getElementById('comment_to_event').value+'{$smiles[sm].value}'; document.getElementById('smiles').style.display = 'none';document.getElementById('comment').style.marginTop  = '10px';"><img src="{$site_root}{$template_root}/emoticons/{$smiles[sm].file}" class="smile_icon" alt=""></a></li>
								{else}
        						<li><a style="cursor:pointer;" onclick="document.getElementById('comment_to_event').value=document.getElementById('comment_to_event').value+'{$smiles[sm].value}'; document.getElementById('smiles').style.display = 'none';document.getElementById('comment').style.marginTop  = '10px';"><img src="{$site_root}/uploades/smiles/{$smiles[sm].file}" class="smile_icon" alt=""></a></li>
								{/if}
								{/section}
								</ul>
							</div>
						</div>
					</div>
				</div>
				<div id="comment"><p><input type="button" onclick="Add_Comment();" value="{$lang.button.add}"></p></div>
				</form>
                {else}
                    {$join_event}
                {/if}
			</div>
{if $ajax eq 0}		
	</div>
{/if}
{literal}
<script type="text/javascript">
function Add_Comment(){
    if($('#comment_to_event').val() == '' || $('#comment_to_event').val() == undefined){
		return;
	}
    	$.ajax({
		type: 'POST',
		url: {/literal}'{$event.add_comment_link}'{literal},
		data: {'comment_type': $("#comment_type").val(), 'comment_to_event': $('#comment_to_event').val()},
		success: function(msg){
			$("#comments").html(msg);
            /*if(msg != "error"){
				$('#submit_comment').html(submit_html);
				$('#message').val('');
				$('#comments_area').prepend(msg);
			}
			else{
				$('#submit_comment').html(submit_html);
				var error_message = '{/literal}{$lang.err.info_finding_1|replace:"'":"\\'"}{literal}';
				alert(error_message);
			}*/
		}
	});
}

function Delete_Comment(url){
    $.ajax({
		type: 'POST',
		url: url,
		data: {},
		success: function(msg){
			$("#comments").html(msg);
            /*if(msg != "error"){
				$('#submit_comment').html(submit_html);
				$('#message').val('');
				$('#comments_area').prepend(msg);
			}
			else{
				$('#submit_comment').html(submit_html);
				var error_message = '{/literal}{$lang.err.info_finding_1|replace:"'":"\\'"}{literal}';
				alert(error_message);
			}*/
		}
	});
}

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;
}
function ShowCommentForm() {
	if (document.getElementById('comment_form_div').style.display == 'none'){
		document.getElementById('comment_form_div').style.display = 'inline';
	} else {
		document.getElementById('comment_form_div').style.display = 'none';
	}
	return;
}

function displaySmileLayer()
{
	if (document.getElementById('smiles').style.display == 'none') {
		document.getElementById('smiles').style.display = 'inline-block';
		$('#comment').css("margin-top", $('#smiles').height() - 66);
	} else {
		document.getElementById('smiles').style.display = 'none';
		$('#comment').css("margin-top", "10px");
	}
	return false;
}
</script>
{/literal}
{if $ajax eq 0}	
{include file="$gentemplates/$footer_tpl"}
{/if}