<?php
require "cfg/cfg.php";
require "./common.php";

$id=$_GET['id'];
if ($id=="") {  die('ERROR 1004: non valid function call');}
apridb();
//registrazione visita
//stat_aggiorna($_GET['id'],date("Y"),date("m"),1,0,0); DA SISTEMARE!!!
//estrazione dati attività
$qry="select * from attivita WHERE visibile AND id='$id'";
$res=eseguiqry($qry);
$q=quanterighe($res);
$arr=leggiriga($res);
chiudidb();
if ($q<=0) {  die('ERROR 1005: non valid function call');}

$categoria="";
foreach ($arrCategorieAltreAttivita as $value) {
	if ($arr[$value]) $categoria.=ucfirst(show_categoria_altreattivita($value))." ";
}

$title=ucfirst($categoria)." ".ucfirst($arr['nome'])." (".ucfirst($arr['paese']).", ".ucfirst($arr['provincia'])." - ".$_SESSION['lGenerDescription4'].")";
$description=ucfirst($categoria)." ".ucfirst($arr['nome']).$_SESSION['lGenerDescription2'].ucfirst($arr['paese'])." (".ucfirst($arr['provincia']).", ".$_SESSION['lGenerDescription4'].")".$_SESSION['lGenerDescription3'];
$keywords=ucfirst($categoria).", ".ucfirst($arr['nome']).", ".ucfirst($arr['paese']).", ".ucfirst($arr['provincia']).", ".$_SESSION['lGenerDescription4'].".";

include "filecomuni/_prehead.html";
include "filecomuni/_posthead.html";
include "filecomuni/_top.html";
?>
<TABLE cellspacing="0" cellpadding="0" border="0" width="100%"><TR>
<TD width="10%" valign="top">

	<?php include "filecomuni/_menu.html";?>
	<?php include "filecomuni/_menu2.html";?>

</TD>
<TD width="90%" valign="top" style="padding-left:2px;padding-right:2px;">
	<h1><?=$_SESSION['lVariePerSvegliarsi']?></h1>

	<table width="100%" cellpadding="5" cellspacing="0" border="0" class="bordotopsfondo"><tr><td align="center">
		<h2><?=$categoria?> <?=ucfirst($arr['nome'])?> - <?=ucfirst($arr['paese'])?> (<?=ucfirst($arr['provincia'])?>)</h2>
	</td></tr></table>
	<br style="line-height:3px;">

	<TABLE cellpadding="5" cellspacing="0" border="0"><TR>
		<TD>
<?php
		$pathimg1="img_altreattivita/".$arr['id']."_1.".$arr['img_1'];
		$pathimg2="img_altreattivita/".$arr['id']."_2.".$arr['img_2'];
		$pathimg3="img_altreattivita/".$arr['id']."_3.".$arr['img_3'];
		$pathimg4="img_altreattivita/".$arr['id']."_4.".$arr['img_4'];
		$pathimg5="img_altreattivita/".$arr['id']."_5.".$arr['img_5'];
		if ($arr['img_1'] && file_exists($pathimg1)) {
			$arr_size=getimagesize($pathimg1); //[0]-width, [1]-height
			$width=250;
			$height=188;
			$ratio_orig = $arr_size[0]/$arr_size[1];
			if ($ratio_orig < 1) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; }
			$title=$categoria." ".$arr['nome']." ".$arr['paese'];
			echo "<A href=\"$pathimg1\" target=\"_blank\"><IMG src=\"".$pathimg1."\" width=\"$width\" height=\"$height\" title=\"$title\" alt=\"$title\"></A>";
		} else echo "<TABLE width=250 height=188><TR><TD bgcolor=#e0e0e0>".$_SESSION['lErrNoImmagine']."</TD></TR></TABLE>";
?>
		</TD>
		<TD valign="top">
			<b><?=$arr['nome']."<br>".$categoria?></b><br>
			<?=$arr['indirizzo']?><br>
			<?=$arr['cap']?> <?=$arr['paese']?> (<?=$arr['provincia']?>)<br>
			Tel <?=$arr['tel']?><br>
			Fax <?=$arr['fax']?><br>
			<br>
			<?=($arr['sitoweb']?'www: <A href="website.php?id='.$arr['id'].'" target="_blank">'.$arr['sitoweb'].'</A><br>':"")?>
			<?=($arr['emailweb']?'email: '.$arr['emailweb'].'<br>':"")?>
			<?=($arr['dataora_aggdati']!='0000-00-00 00:00:00'?'<br><i>('.$_SESSION['lCifreaggiornate'].' '.dataformata($arr['dataora_aggdati']).')</i><br>':"")?>
			<br>
		</TD>
	</TR></TABLE>
	<TABLE><TR><TD>
<?php
		if ($arr['img_2'] && file_exists($pathimg2)) {
			$arr_size=getimagesize($pathimg2); //[0]-width, [1]-height
			$width=250;
			$height=188;
			$ratio_orig = $arr_size[0]/$arr_size[1];
			if ($ratio_orig < 1) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; }
			echo "<A href=\"$pathimg2\" target=\"_blank\"><IMG src=\"".$pathimg2."\" width=\"$width\" height=\"$height\" title=\"$title\" alt=\"$title\"></A>";
		} else echo "<TABLE width=250 height=188><TR><TD bgcolor=#e0e0e0>".$_SESSION['lErrNoImmagine']."</TD></TR></TABLE>";
?>
	</TD><TD>
<?php
		if ($arr['img_3'] && file_exists($pathimg3)) {
			$arr_size=getimagesize($pathimg3); //[0]-width, [1]-height
			$width=250;
			$height=188;
			$ratio_orig = $arr_size[0]/$arr_size[1];
			if ($ratio_orig < 1) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; }
			echo "<A href=\"$pathimg3\" target=\"_blank\"><IMG src=\"".$pathimg3."\" width=\"$width\" height=\"$height\" title=\"$title\" alt=\"$title\"></A>";
		} else echo "<TABLE width=250 height=188><TR><TD bgcolor=#e0e0e0>".$_SESSION['lErrNoImmagine']."</TD></TR></TABLE>";
?>
	</TD></TR>
	<TR><TD>
<?php
		if ($arr['img_4'] && file_exists($pathimg4)) {
			$arr_size=getimagesize($pathimg4); //[0]-width, [1]-height
			$width=250;
			$height=188;
			$ratio_orig = $arr_size[0]/$arr_size[1];
			if ($ratio_orig < 1) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; }
			echo "<A href=\"$pathimg4\" target=\"_blank\"><IMG src=\"".$pathimg4."\" width=\"$width\" height=\"$height\" title=\"$title\" alt=\"$title\"></A>";
		} else echo "<TABLE width=250 height=188><TR><TD bgcolor=#e0e0e0>".$_SESSION['lErrNoImmagine']."</TD></TR></TABLE>";
?>
	</TD><TD>
<?php
		if ($arr['img_5'] && file_exists($pathimg5)) {
			$arr_size=getimagesize($pathimg5); //[0]-width, [1]-height
			$width=250;
			$height=188;
			$ratio_orig = $arr_size[0]/$arr_size[1];
			if ($ratio_orig < 1) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; }
			echo "<A href=\"$pathimg5\" target=\"_blank\"><IMG src=\"".$pathimg5."\" width=\"$width\" height=\"$height\" title=\"$title\" alt=\"$title\"></A>";
		} else echo "<TABLE width=250 height=188><TR><TD bgcolor=#e0e0e0>".$_SESSION['lErrNoImmagine']."</TD></TR></TABLE>";
?>
	</TD></TR></TABLE>


</TD></TR>
</TABLE>
<!--- middle end--->

<?php include "filecomuni/_bottom.html"?>