<?php 

if (@$_COOKIE['agree']) return;

global $Lang;

?>
<div id="cookie_advertisement">
<div>
<?php echo $Lang['cookie_agreement_1']; ?>
<p>
<?php echo $Lang['cookie_agreement_2']; ?>
<p>
<?php echo $Lang['cookie_agreement_3']; ?>
</div>

<script>

function cookieAgreement()
{
	var expiration = new Date();
	expiration.setFullYear(expiration.getFullYear() + 1);
	var cookie_string = '';
	// Build the set-cookie string:
	cookie_string = "agree=true; path=/; expires=" + expiration.toGMTString();
	// Create/update the cookie:
	document.cookie = cookie_string;
	console.log("User agreed to cookie policy");
	document.getElementById("cookie_advertisement").style.display = 'none';
}

</script>

<div class="command">
	<a href="#"><button id="cookie_agree_button" onClick="cookieAgreement()"><?php echo $Lang['cookie_agree']; ?></button></a>
	<a href="http://en.wikipedia.org/wiki/HTTP_cookie"><button id="cookie_more_button"><?php echo $Lang['cookie_more']; ?></button></a>
</div>

</div>
