<?

	$rootPath = '';
	
	require_once($rootPath . 'application.php');
	require_once($rootPath . 'security.php');
	require_once($rootPath . 'initialize.php');

	// Menus
	require_once($rootPath . 'menus.php');
	
	// ---
	
	initVar($_REQUEST[URL_HOTEL_ID], 0);
	initVar($_REQUEST[URL_DESTINATION_ID], 0);
	initVar($_REQUEST[URL_ZONE_ID], 0);
	initVar($_REQUEST[URL_THEME_ID], 0);
	
	$filters = array();
	$filters['Language'] = $_gLanguage['LanguageID'];
	$filters['IsActive'] = true;
	$filters['ID'] = $_REQUEST[URL_HOTEL_ID];
		
	$hotel = fetchHotel($filters);
	
	$_gHotel = $db->sql_fetch_assoc($hotel);

	// Création de la balise Title de la page
	$_gTitle = $_gHotel['HotelMetaTitle'];
	$_gMetaFooter = $_gHotel['HotelMetaFooter'];
	
	$_tpl->assign_by_ref('Title', $_gTitle);
	$_tpl->assign_by_ref('MetaFooter', $_gMetaFooter);


	$_gBreadcrumbs->add($_gHotel['DestinationName']." - Voyage, Circuit, Séjour, Safari ");	

	$_gBreadcrumbs->add($_gHotel['HotelName']);
	
	if ($_REQUEST[URL_THEME_ID]){
		$_gBreadcrumbs->add($_gHotel['ThemeName']);	
	}
	else
	{
		$_gBreadcrumbs->add($_gHotel['ZoneName']);	
	}
	
	$_gHotel['HotelSerieImages'] = unserialize($_gHotel['HotelSerieImages']);
	
	foreach($_gHotel['HotelSerieImages'] as $key => $HotelSerieImages)
	{
		$thumb="";
		$temp=explode('/',$HotelSerieImages['Url']);
		for ($i=0;$i<count($temp);$i++)
		{
			if ($i==count($temp)-1)
			{
				$thumb.=".thumb_".$temp[$i];
			}
			else
			{
				$thumb.=$temp[$i]."/";
			}
		}
		$_gHotel['HotelSerieImages'][$key]['Thumb']=$thumb;
	}
	

	
	$temp=explode('/',$_gHotel['HotelImage']);
	$thumbimage="";
	for ($i=0;$i<count($temp);$i++)
	{
		if ($i==count($temp)-1)
		{
			$thumbimage.=".thumb_".$temp[$i];
		}
		else
		{
			$thumbimage.=$temp[$i]."/";
		}
	}
	$_gHotel['HotelThumb']=$thumbimage;
	$_gHotel['HotelUrl'] = getThemeHotelsUrl($_gHotel);
	
	if ($_REQUEST[URL_DESTINATION_ID]!=0)
	{
		$_gDestination = getDestination($_REQUEST[URL_DESTINATION_ID], $filters);
		$_gHotel['DestinationUrl'] = getDestinationUrl($_gDestination);
	}
	if ($_REQUEST[URL_THEME_ID]!=0) 
	{
		$_gTheme = getTheme($_REQUEST[URL_THEME_ID], $filters);
		$_gHotel['ThemeUrl'] = getThemeUrl($_gTheme);
	}
		
	$_gHotel['ContactUrl'] = getDestinationHotelUrl($_gHotel,'contact');
	$_tpl->assign('Hotel', $_gHotel);
	
	if ( empty($_gHotel) )
	{
		$url = $_gResources->get('ERR404');
		
		redirectTo( $url );
	}
	
	// ---

	// Affichage
	$_tpl->display('hotel.htm');

?>