<!-- **************************** DENNY VYPIS NAVSTEV GRAFY*****************************-->
		<div id="melodia_div">
		<?php
			$page_limit = 20;
			$query = "SELECT * FROM mobile_navstev_dnes ORDER BY ID DESC limit 0, $page_limit";
			$result = $dba->GetResult($query);
			$query2 = "SELECT * FROM mobile_dload_dnes ORDER BY ID DESC limit 0, $page_limit";
			$result2 = $dba->GetResult($query2);
			while ($row = mysql_fetch_array($result))
			{
				$row2 = mysql_fetch_array($result2);
				$qwe[$row['datum']]['navstev'] = $row['navstev'];
				$qwe[$row['datum']]['stranok'] = $row['stranok'];
				$qwe[$row['datum']]['online'] = $row['online'];
				$qwe[$row['datum']]['stiahnuti'] = $row2['navstev'];
				
				$asd['navstev'][$row['datum']] = $row['navstev'];
				$asd['stranok'][$row['datum']] = $row['stranok'];
				$asd['online'][$row['datum']] = $row['online'];
				$asd['stiahnuti'][$row['datum']] = $row2['navstev'];
			}
			foreach ($qwe as $den)
			{
				if(isset($qwe_total['navstev'])) $qwe_total['navstev'] += $den['navstev'];
				else $qwe_total['navstev'] = $den['navstev'];
				if(isset($qwe_total['stranok'])) $qwe_total['stranok'] += $den['stranok'];
				else $qwe_total['stranok'] = $den['stranok'];
				if(isset($qwe_total['online'])) $qwe_total['online'] += $den['online'];
				else $qwe_total['online'] = $den['online'];
				if(isset($qwe_total['stiahnuti'])) $qwe_total['stiahnuti'] += $den['stiahnuti'];
				else $qwe_total['stiahnuti'] = $den['stiahnuti'];
			}
		
		?>
		  <table width="100%" cellpadding="0" cellspacing="0">
		     <tr>
		     <?php
		     	$qwe = array_reverse($qwe);
		     	foreach ($qwe as $datum => $hodnoty)
		     	{
		     		echo "<td id=\"graph_02\" valign=\"bottom\">\n";
		     		$i = 0;
		     		echo "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"> \n <tr>";
		     		foreach($hodnoty as $nazov => $hodnota)
		     		{
		     			$perc = round($hodnota * 100 / $qwe_total[$nazov] * 4);
		     			if($perc==0) $perc = 1;
		     			$i++;
		     			echo "<td id=\"graph\" valign=\"bottom\">";
//		     			echo $hodnota;
		     			echo "<img src=\"images/graphs/$i.gif\" width=\"3\" height=\"$perc\">\n";
		     			echo "</td>";
		     		}
		     		echo "</tr>\n</table>";
		     		echo "</td>\n";
		     	}
		     
		     ?>
		     </tr>
		     <tr>
		     <?php
		     	
		     	foreach ($qwe as $datum => $hodnoty)
		     	{
		     		echo "<td id=\"graph_popis\" valign=\"top\" align=\"center\">\n";
		     		$datum = str_replace('.2005', '', $datum);
		     		$datum = str_replace('.2006', '', $datum);
		     		$datum = str_replace('.2007', '', $datum);
		     		$datum = str_replace('.2008', '', $datum);
		     		$datum = str_replace('.2009', '', $datum);
		     		if(strlen($datum)==4) $datum = str_pad($datum, 5, '0', 0);
		     		echo $datum;
		     		echo "</td>\n";
		     		
		     	}
		     
		     ?>
		     </tr>
		  </table><br /><br />
		  
		  
		  <table width="100%" cellpadding="0" cellspacing="0" style="font-size: 9px;">
		     <tr>
		       <?php
		     	$i = 0;
		     	foreach ($asd as $nazov => $hodnoty)
		     	{
		     		$i++;
		     		$width = round(100/sizeof($asd));
		     		echo "<td width=\"25%\" valign=\"bottom\" align=\"center\">";
		     		$hodnoty = array_reverse($hodnoty);
		     		foreach($hodnoty as $x)
		     		{
		     			$perc = round($x * 100 / $qwe_total[$nazov] * 4);
		     			if($perc==0) $perc = 1;
	     				echo "<img src=\"images/graphs/$i.gif\" width=\"3\" height=\"$perc\"> ";
		     		}
		     		echo "</td>\n";
		     	}
		       ?>
		     </tr>
		     <tr>
		       <?php
		       
		     	$i = 0;
		     	foreach ($asd as $nazov => $hodnoty)
		     	{
		     		$i++;
		     		echo "<td width=\"25%\" valign=\"top\" align=\"center\">";
		     		echo $nazov;
		     		echo "</td>\n";
		     	}
		     
		       ?>
		     </tr>
		  </table>
		</div>