<!DOCTYPE html>
<html lang="ca">
<head>
	<meta charset="utf-8">
	<title>{% block title %}{% endblock %} | ShareNews</title>
	{% load staticfiles %}
	<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" src="{% static "js/basic.js" %}"></script>
	<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDPLE8a03174d0bv23JzaA2u7aka_lHV38&language=ca&region=ES"></script>
	<script type="text/javascript" src="{% static "js/map.js" %}"></script>
	<script type="text/javascript" src="{% static "js/daynightoverlay.min.js" %}"></script>
	<script type="text/javascript" src="https://apis.google.com/js/platform.js">{lang: 'ca'}</script>
	<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
	<link rel="stylesheet" type="text/css" href="{% static "css/main.css" %}"/>
	<link rel="shortcut icon" href="{% static "media/favicon.ico" %}"//>
</head>

{% if noticies %}
<script>
function newsToMap() {
	var markers = Array();
	{% for noticia in noticies %}{% if noticia.geolatitud != 0 %}
	var loca = new google.maps.LatLng({{ noticia.geolatitud|safe }}, {{ noticia.geolongitud|safe }});
	var i = markers.length;
	markers[i] = new google.maps.Marker({ position: loca, map: map, icon: marcadorIcon });
	markers[i].infoWindow = new google.maps.InfoWindow({ content: '<b><a href="/read/{{ noticia.id }}">{{ noticia.titol }}</a></b><br><i class="fa fa-calendar" title="Data"></i> {{ noticia.data|date:"j F Y" }} {{ noticia.data|date:"H:i O" }}<br><a href="/profile/{{ noticia.autor }}"><i class="fa fa-user" title="Autor"></i> {{ noticia.autor }}</a><br><a href="/news/{{ noticia.categoria }}"><i class="fa fa-quote-left" title="Categoria"></i> {{ noticia.categoria }}</a><br><a href="/read/{{ noticia.id }}/#comments"><i class="fa fa-comments" title="Comentaris"></i> {{ noticia.comentari_set.count }} comentaris</a><br><i class="fa fa-map-marker" title="Localització"></i> {{ noticia.localitzacio }}' });
	google.maps.event.addListener(markers[i], 'click', function() {
		if(infowindowOpen) infowindowOpen.close();
		infowindowOpen = this.infoWindow;
		map.panTo(loca);
		map.setZoom(10);
		map.setCenter(loca);
		infowindowOpen.open(map,this);
	});
	{% endif %}{% endfor %}
}
</script>
{% endif %}

<body onload="initialize()">
	<div id="userbar">
		{% if user.is_authenticated %}
		<div class="content">
			<a href="/" class="home"><i class="fa fa-home"></i> Inici</a>
			<a href="/compose"><i class="fa fa-pencil"></i> Redactar</a>
			<a href="/profile"><i class="fa fa-user"></i> Perfil</a>
			<a href="/logout" class="right">Desconnecta't <i class="fa fa-sign-out"></i></a>
		</div>
		{% else %}
		<div class="content">
			<a href="/register">Registra't</a>
			<a href="/#login">Connecta't</a>
		</div>
		{% endif %}
	</div>
	<div id="header">
		<div class="content">
			<div class="time">
				<span id="clock"><b style="visibility:hidden">00:00</b></span>
				<span id="date"><b style="visibility:hidden">Today</b></span>
			</div>
			<a class="logo" href="/"></a>
		</div>
	</div>
	<div id="catbar">
		<div class="content">
			<a href="/news/economia" class="economia"><span>Economia</span> <div></div></a>
			<a href="/news/esports" class="esports"><span>Esports</span> <div></div></a>
			<a href="/news/societat" class="societat"><span>Societat</span> <div></div></a>
			<a href="/news/cultura" class="cultura"><span>Cultura</span> <div></div></a>
			<a href="/news/politica" class="politica"><span>Política</span> <div></div></a>
			<a href="/news/tecnologia" class="tecnologia"><span>Tecnologia</span> <div></div></a>
		    <div class="searchicon"><i class="fa fa-search"></i></div>
		    <form name="search" method="get" action="/search/">
			    <input id="search" type="text" value="" name="t" placeholder="Buscar per tags">
		    </form>
			<a href="/map" class="mapmenu" style="float:right" href="#"><span><i class="fa fa-globe"></i> Mapa</span></a>
		</div>
	</div>
	{% block content %}{% endblock %}
	{% block footer %}
	<div id="footer">
		<div class="content">
			<div class="logos">
				<a href="/"><img src="{% static "media/logob.png" %}"></a>
			</div>
			<div class="copyright">
				<b>ShareNews © 2014</b><br>
			</div>
		</div>
	</div>
	{% endblock %}
</body>

</html>