<div class="buttons">

	<a href="/admin/create/coach" class="addbutton add-big">Új edző hozzáadása</a>

</div>

<div class="list">
	{foreach $user_array as $user}
	<div class="list_item clickable" id="coach_{$user->get_ua_id()}" onclick="open_coach_menu({$user->get_ua_id()})">
		<img src="/_image/coach.png">
			{$user->get_ua_name()}
	</div>
	<div class="coach_menu" id="coach_menu_{$user->get_ua_id()}">
		<div class="coach_submenu" onclick="open_datasheet('{$user->get_ua_id()}')">
	  		<span>Adatok szerkesztése</span>
	  		<img src="/_image/contact.png">
  		</div>
  		<div class="coach_submenu" onclick="open_preview('{$user->get_ua_id()}')">
	  		<span>Edzői előnézet</span>
	  		<img src="/_image/contact.png">
  		</div>
	</div>
	{/foreach}

</div>

<script type="text/javascript">

function open_datasheet(user_id) {
	location.href = "/admin/coaches/"+user_id;
}

function open_coach_menu(uk_id) {
	$("#coach_menu_"+uk_id).slideToggle();
	if (!$("#coach_"+uk_id).hasClass('active_coach')) {
		$("#coach_"+uk_id).addClass('active_coach');
		$("#coach_"+uk_id).removeClass('list_item');
	}
	else {
		$("#coach_"+uk_id).removeClass('active_coach');
		$("#coach_"+uk_id).addClass('list_item');
	}

}

function open_preview(user_id) {
	window.open("/coach_preview/diary/"+user_id, '_blank');
}
</script>