<?php
	include "legende.php";

	if ($_GET["mega"] == true) {
		$poulpeSize = 240;
	}
	else if ($_GET["giga"] == true) {
		$poulpeSize = 350;
	}
	else if ($_GET["uber"] == true) {
		$poulpeSize = 500;
	}
	else {
		$poulpeSize = 160;
	}
	
	$legendId = rand(0, count($legends)-1);
	$legend = $legends[$legendId];
	$legend = str_replace("{name}", "MiniPoulpe", $legend);
	
	$easterEggs = array(
		"document.location=\"?mega=true\"",
		"document.location=\"?giga=true\"",
		"document.location=\"?uber=true\"",
		"document.location=\"?gopher=true\"",
	);
	
	$easterEggId = rand(0, count($easterEggs)-1);
	$easterEgg =  $easterEggs[$easterEggId];
	
	$poulpeCount = 60;
	$poulpeMaxSize = 30;
?>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<style type="text/css">
		body {
			background:			transparent url(sea.jpg) repeat 0px 0px;
			font-family:		sans-serif;
		}
		
		h1 {
			text-align:			center;
			font-size:			75px;
			color:				#000033;
			text-decoration:	blink;
			font-variant:   	small-caps;
			margin-top:			10px;
			margin-bottom:		30px;
			font-weight:		bolder;
		}
		
		#logo {
			padding-top:		50px;
			text-align:			center;
		}
		
		#legend, #legend a {
			color:			#003;
			margin-left:	auto;
			margin-right:	auto;
			text-align:		center;
			font-size:		20px;
			width:			80%;
		}
		
		#legend span {
			font-style:		italic;
			font-family:    cursive;
		}
		
		#count {
			text-align:     center;
			color:          #003;
			font-variant:   small-caps;
			font-size:      20px;
			font-family:    sans-serif;
			font-weight:    bold;
			margin-top:		20px;
		}
		
		.advert {
			margin-left:	auto;
			margin-right:	auto;
			text-align:		center;
			margin-top:		10px;
		}
		
		#terre {
			position:		absolute;
			bottom:			0px;
			margin-left:	auto;
			margin-right:	auto;
			text-align:		center;
			z-index:		1;
			left: 			50%;
			margin-left: 	-450px;


		}
		
		#terre img {
			margin-left:	auto;
			margin-right:	auto;
			text-align:		center;
		
		}
		
	</style>
	<script type="text/javascript" src="prototype.js"></script>
	<script type="text/javascript" src="script.js"></script>
	<script type="text/javascript">
		
		function displayCount() {
			$("countValue").innerHTML =delai(2008,6,6,6,6);
		
			setTimeout("displayCount()", 1000);
		}
		
		function loadPage() {
			displayCount();
			
			initPoulpes(<?php echo $poulpeCount; ?>, <?php echo $poulpeMaxSize; ?>);
			
		}
	</script>
	<link rel="shortcut icon" type="image/gif" href="poulpe.gif" />
	<title>MiniPoulpe attaque la Terre !</title>
</head>
<body onload="loadPage()">

<?php
	//Initialisation des MiniMiniPoulpes
	if ( rand(0, 20) == 5 ) {
		$i = 0;
		echo "<img src='poulpe-pink.gif' id='s$i' style='cursor:pointer;position:absolute;top:-$poulpeMaxSize' alt='MiniMiniPoulpe Rose' title='MiniMiniPoulpe Rose attaque !' onclick='$easterEgg' />";
		$i++;
	}
	else {
		$i = 0;
	}

	while ( $i <= $poulpeCount ) {
		echo "<img src='poulpe.gif' id='s$i' style='position:absolute;top:-$poulpeMaxSize' alt='Poulpe' />";
		++$i;
	}
?>

<div id="global">

	<?php
		if ($_GET["gopher"] == true) {
	?>
	<div id="logo">
		<object width="425" height="355"><param name="movie" value="https://www.youtube.com/v/8lXdyD2Yzls&hl=en"></param><param name="wmode" value="transparent"></param><embed src="https://www.youtube.com/v/8lXdyD2Yzls&hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>
	</div>
	<h1>Le Frère caché de MiniPoulpe !</h1>

	<?php
		}
		else {
	?>
	<div id="logo">
		<img src="poulpe.gif" id="poulpe" alt="Poulpe" style="width: <?php echo $poulpeSize; ?>px; height: <?php echo $poulpeSize * 1.5 ?>px;" />
	</div>
	<h1>Minipoulpe attaque la Terre !</h1>
	<?php
		}
	?>


<div id="legend">
	<a href="index.php" title="Un nouveau mythe s'il vous plaît Monsieur MiniPoulpe...">Le mythe du jour</a> :
	<span>« <?php echo $legend; ?> »</span>
</div>

<div id="count">
	Il ne reste plus que <span id="countValue"></span>...
</div>

<div class="advert">
<script type="text/javascript"><!--
google_ad_client = "pub-2486591868229652";
/* Pub Minipoulpe */
google_ad_slot = "9067051367";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>

</div>

<div align="center" id="terre">
	<img src="terre.gif" alt="Terre" />
</div>

</body>
</html>
