<?php 
include_once("config.php3");
include($ARCHIVES_DIR."nuage_var.inc");

//CONSTANTES
$MAX_AFFICHE = 25;
$NB_STYLES = 4;

?>

<style type="text/css">
<!--
#style-nuage
{	
	border: 0px solid #000000;
	height: 205px; 
	text-align: center; 
	font-family: tahoma; 
	line-height:23px;
	vertical-align: baseline;
	overflow: auto;
	overflow: hidden;
}


#style-nuage a.style-nuage-4 {  	
	font-size: 18px;
	color:#FB0000;
	font-weight:bold; 
	text-decoration:none; 
}
#style-nuage a.style-nuage-4:hover { 
	background-color:#FB0000; 
	color:#FFFFFF; 
}


#style-nuage a.style-nuage-3 {
	font-size: 16px;
	color:#78C004;
	font-weight:bold;
	text-decoration:none; 	

}
#style-nuage a.style-nuage-3:hover { 
	background-color:#78C004; 
	color:#FFFFFF; 
}


#style-nuage a.style-nuage-2 {
	font-size: 14px;
	color:#07761B;
	font-weight:bold;
	text-decoration:none; 
}
#style-nuage a.style-nuage-2:hover { 
	background-color:#07761B; 
	color:#FFFFFF; 
}


#style-nuage a.style-nuage-1{
	font-size: 12px;
	color:#0782BC;
	text-decoration:none; 
}

#style-nuage a.style-nuage-1:hover { 
	background-color:#0782BC; 
	color:#FFFFFF; 
}
-->
</style>


<?php

srand((float)microtime()*1000000);
shuffle($TABNUAGE);




$max_clic = 0;
$min_clic = 999999999999999999999;
for($i=0;$i <= $MAX_AFFICHE;$i++)
{
	if($min_clic > $TABNUAGE[$i][clic])
		$min_clic = $TABNUAGE[$i][clic];
	
	if($max_clic < $TABNUAGE[$i][clic])
		$max_clic = $TABNUAGE[$i][clic];		
}
//on calcule les ecarts en autant de d'interval que de style

$ecart_total = $max_clic - $min_clic;
$ecart = intval($ecart_total / ($NB_STYLES-1));


echo "<table cellpadding=0 cellspacing=0 >\n";
echo "<tr><td colspan=3 width=260 height=6><img src='".$IMAGES_DIR."table/nuage-haut.jpg'></td></tr>";
echo "<tr ><td bgcolor=#000000 width=1 ></td>";
echo "<td bgcolor=#EAEAEA width=258><div id='style-nuage'>";
for($i=0;$i <= $MAX_AFFICHE;$i++)
{
	
	
	
	if($TABNUAGE[$i][url])
	{
		/*
		if($i>0)
			echo "-&nbsp;";
			*/
		
		//on met le style adequate
		$styleId = intval($TABNUAGE[$i][clic] / $ecart)+1;
		if($styleId > $NB_STYLES)
			$styleId = $NB_STYLES;
		else if($styleId == 0)
			$styleId = 1;
			
		echo "&nbsp;";
		echo "<a class='style-nuage-".($styleId)."' href='".$SERVER_URL."trck_clck.php3?code=".$TABNUAGE[$i][code]."&url=".$TABNUAGE[$i][url]."' target='_blank'>".$TABNUAGE[$i][lib]."</a>\n";
		echo "&nbsp;";
	}
	else
	{
		break;
	}

}
echo "</div></td>";
echo "<td bgcolor=#000000 width=1></td></tr>";
echo "<tr><td colspan=3 width=260 height=6><img src='".$IMAGES_DIR."table/nuage-bas.jpg'></td></tr>";
echo "</table>";
?>