{% autoescape off %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
	<head>
		<link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" />
		<title>ITS</title>
		<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
		<script src="{{ STATIC_URL }}scripts/jquery.contextMenu.js"></script>
		<script src="{{ STATIC_URL }}itsapp/scripts/left_side_panel.js"></script>
		<script src="{{ STATIC_URL }}itsapp/scripts/scripts.js"></script>

		<!-- Auto complete stuf-->
		<script type='text/javascript' src="{{ STATIC_URL }}autocomplete/thickbox-compressed.js"></script>
		<script type='text/javascript' src="{{ STATIC_URL }}autocomplete/jquery.autocomplete.js"></script>
		<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}autocomplete/jquery.autocomplete.css" />
		<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}autocomplete/thickbox.css" />

		{% if user.is_authenticated %}
			<script>
			//Po nacteni cele strany 
			$(document).ready(function(data) {
				//se nacte avatar
				var oImg=document.getElementById("avatar");
				oImg.setAttribute('src', '{% url get_avatar_data "user" user.id%}');
				oImg.setAttribute('height', '20px');
				oImg.setAttribute('width', '20px');

				loadAllTagsAsArray(function(tag_names){
					$("#base-search-box").autocomplete(tag_names);
				});

				$('.searchbox-button').click(function(){
					var search_box=document.getElementById('base-search-box');

					window.location="/search/"+search_box.value;
				});

			});
			</script>
		{% endif %}
		{% block header %}{% endblock %}
	</head>
	<body>

		<div id="wrap">
			<div id="top">
				<div id="logo" class="fl">
					<!--<a href=
					{% if user.is_authenticated %}
						"{% url user_page user.id %}"
					{% else %}
						"/"
					{% endif %}
					-->
					<a href="/"

					>ITS</a>
				
				</div>
				<div id="searchbox" class="fl"  method="GET">
					<form action="#">
						<input type="text" accept=""  class="searchbox-input fl ac_input" id="base-search-box"/>
						<button class="searchbox-button fl"></button>
						<div class="cb"></div>
					</form>
				</div>
				<div id="loginbox" class="fr">
					{% if user.is_authenticated %}
						<div id="menu-auth" class="fr">
							<ul class="submenu">
								<li class="settings"><a href="{% url settings_user %}">settings</a></li>
								<li class="logout"><a href="{% url logout_user %}">logout</a></li>
							</ul>
						</div>
						<div id="menu-username" class="fr">
							<a class="link" href="{% url user_page user.id %}">{{ user.username }}</a>
						</div>
						<div id="menu-avatar" class="fr">
							<a class="avatar" href="{% url user_page user.id %}"><img id="avatar" /></a>
						</div>
					{% else %}
						<div id="menu-auth" class="fr">
							<ul class="submenu">
								<li class="login"><a class="button" href="{% url login_user %}">login</a></li>
							</ul>
						</div>
					{% endif %}
				</div>
				<div class="cb"></div>
			</div>

			<div id="main">
				<div id="left" class="fl">

				</div>

				<div id="content" class="fr">
					{% block content %}{% endblock %}
				</div>

				<div class="cb"></div>
			</div>

			<div id="footer">
				<div class="inner">
					<p>Image Tag Suggestion</p>
					<p>&copy; 2011 FIT BUT</p>
				</div>
			</div>

			<div id="toolbox" style="background: #faa;">
				DEVEL PANEL:
				<a href="/">Home</a> |
				<a href="{% url galleries %}">My Galleries</a> |
				{% if user.is_authenticated %}
					<a href="{% url group %}">Groups</a> |
					<a href="{% url settings_user %}">Settings</a> |
					{% ifequal user.username "admin" %}
						<a href="{% url admin_page %}">Tools</a> |
					{% endifequal %}
					<img id="avatar"/>
					<a href="{% url logout_user %}">Logout [{{ user.username }}]</a>
				{% else %}
					<a href="{% url registrate_user %}">Registration</a> |
						<a href="{% url login_user %}">Login</a>
				{% endif %}
			</div>
		</div>
	</body>
</html>
{% endautoescape %}
