<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
  require_once "/home/luxurychartergroup/luxurychartergroup.com/cms/lib/viewer_functions.php";

  list($yachtsRecords, $yachtsMetaData) = getRecords(array(
    'tableName'   => 'yachts',
	'where'		  => whereRecordNumberInUrl(1) . ' AND active_fr ="1"',
    'limit'       => '1',
	'useSeoUrls'	=> true,
  ));
  $yachtsRecord = @$yachtsRecords[0]; // get first record

  // set broker for form fuction
  $broker = $yachtsRecord['broker'];
  
  // load records from 'testimonials'
  $yachtID = $yachtsRecord['num'];
  list($testimonialsRecords, $testimonialsMetaData) = getRecords(array(
    'tableName'   => 'testimonials',
    'limit'       => '10',
	'where' => "yacht_name = '$yachtID'" . ' AND lang_fr ="1"', 
    'loadUploads' => true,
    'allowSearch' => false,
	//'debugSql' => true,
  ));

  // load records from FR 'news/blog' for promo
  $yachtID2 = "%\t".$yachtID."\t%";
  list($news_frRecords, $news_frMetaData) = getRecords(array(
    'tableName'   => 'news_fr',
    'limit'       => '1',
    'loadUploads' => true,
    'allowSearch' => false,
	'where'		  => "yachts LIKE '$yachtID2'" . ' AND active ="1"' . ' AND promote ="1"', 
	'useSeoUrls'	=> true,
  ));
   
  // show error message if no matching record is found
  if (!$yachtsRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
  
  list($settingsRecords, $settingsMetaData) = getRecords(array(
    'tableName'   => 'settings',
    'limit'       => '1',
	// 'debugSql' =>'true',
  ));
  $settingsRecord = @$settingsRecords[0]; // get first record

?>
<? include("../library/inc/headers.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr">
<head>
<meta http-equiv="content-language" content="FR-fr" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php if ($yachtsRecord['yacht_title_fr']): ?><?php echo $yachtsRecord['yacht_title_fr'] ?><?php else: ?><?php echo $yachtsRecord['yacht_name'] ?> - Luxury Yacht Charters<?php endif ?> - <?php echo $settingsRecord['title_fr'] ?></title>
<?php if ($yachtsRecord['meta_description_fr']): ?><meta name="description" content="<?php echo $yachtsRecord['meta_description_fr'] ?>" /><?php else: ?><meta name="description" content="<?php echo $yachtsRecord['intro_fr'] ?>" /><?php endif ?>

<link rel="canonical" href="http://<?php echo $settingsRecord['web'] ?>/fr/<?php echo strtolower($yachtsRecord['_link']); ?>" />

<link rel="stylesheet" type="text/css" href="/library/css/style.css" />
<script type="text/javascript" src="/library/js/scripts.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<link rel="stylesheet" type="text/css" media="screen" href="/library/slimbox/slimbox2.css" />
<script type="text/javascript" src="/library/slimbox/slimbox2.js"></script>

<script src="/library/js/jquery.hashchange.min.js" type="text/javascript"></script>
<script src="/library/js/jquery.easytabs.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready( function() {
  $('#tab-container').easytabs();
});
</script>
  
<? include("../library/inc/head.php"); ?>

</head>
<body>
<div class="wrapper">
<? include("../library/inc/lang_fr.php"); ?>
	
	<div class="navbar">
		<? include("../library/inc/navbar_fr.php"); ?>
	</div>
	<div class="topbar">
		<div class="banner">
			<?php if ($yachtsRecord['banner_image']): ?>  
				<?php foreach ($yachtsRecord['banner_image'] as $upload): ?>
					<img src="<?php echo $upload['urlPath'] ?>" width="649" height="220" alt="<?php echo $yachtsRecord['yacht_name'] ?>" />
				<?php endforeach ?>
			<?php else: ?>
				<?php foreach ($settingsRecord['default_banner'] as $upload): ?>
					<img src="<?php echo $upload['urlPath'] ?>" width="649" height="220" alt="<?php echo $yachtsRecord['yacht_name'] ?>" />
				<?php endforeach ?>
			<?php endif ?>
		</div>
		<div class="logo"><img src="/library/img/logo.png" alt="<?php echo $settingsRecord['title'] ?>" width="300" height="220" /></div>
	</div>
	<div class="content">
		<div class="maincol">
			<h1><?php echo $yachtsRecord['yacht_name'] ?></h1>
			<?php if ($yachtsRecord['intro_fr']): ?><div class="intro"><?php echo $yachtsRecord['intro_fr'] ?></div><?php endif ?>

			<?php foreach ($news_frRecords as $record): ?>
                <div class="promo clearfix
                <?php if ($record['promote_badge'] == "1"): ?> promobadge promobadge1<?php endif ?>
                <?php if ($record['promote_badge'] == "2"): ?> promobadge promobadge2<?php endif ?>
                <?php if ($record['promote_badge'] == "3"): ?> promobadge promobadge3<?php endif ?>
                <?php if ($record['promote_badge'] == "4"): ?> promobadge promobadge4<?php endif ?>
                ">
                <?php if ($record['list_image']): ?>
                    <?php foreach ($record['list_image'] as $index => $upload): ?>
                    <img src="<?php echo $upload['thumbUrlPath2'] ?>" width="<?php echo $upload['thumbWidth2'] ?>" height="<?php echo $upload['thumbHeight2'] ?>" alt="" /><?php break ?>
                    <?php endforeach ?>
                <?php endif ?>
                <p class="promotext<?php if ($record['list_image']): ?> promoimage<?php endif ?>"><a class="promotitle" href="<?php echo strtolower($record['_link']) ?>"><?php echo htmlencode($record['title']) ?></a><br />
                <?php echo htmlencode($record['meta_desc']) ?> <a href="<?php echo strtolower($record['_link']) ?>">Learn more...</a></p>
                </div>
            <?php endforeach ?>

			<div id="tab-container" class="tab-container">
              <ul class="etabs">
                <li class="tab"><a href="#overview">Présentation</a></li>
                <li class="tab"><a href="#gallery">Galérie</a></li>
                <?php if ($yachtsRecord['show_video'] =="1"): ?><li class="tab"><a href="#video">Video</a></li><?php endif ?>
                <li class="tab"><a href="#specs">Spécifications</a></li>
                <?php if ($yachtsRecord['pdf_files']): ?><li class="tab"><a href="#brochures">Brochures</a></li><?php endif ?>
                <?php if ($yachtsRecord['rate_low_season'] or $yachtsRecord['rate_high_season']): ?><li class="tab"><a href="#rates">Conditions</a></li><?php endif ?>
                <li class="tab enquireicon"><a href="#enquire">Se renseigner</a></li>
              </ul>
			
            <div class='panel-container'>
            
            <!-- Tab Overview -->
            <div class="overview tabbox" id="overview">
			<?php foreach ($yachtsRecord['gallery_images'] as $upload): ?>
				<a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" rel="lightbox-gallery"><img src="<?php echo $upload['urlPath'] ?>" width="589" height="402" alt="<?php echo $upload['info1'] ?>" class="imglarge" /></a>
				<?php break ?>
			<?php endforeach ?>	
			
            <?php if ($yachtsRecord['destinations']): ?>
            <p><strong>Zone de navigation:</strong> 
            <?php 
              $values = getListValues('yachts','destinations',$yachtsRecord['destinations']); 
              $labels = getListLabels('yachts','destinations',$yachtsRecord['destinations']); 
              $valuesToLabels = array_combine($values, $labels); 
            ?>
            <?php $countD=0; ?><?php foreach ($valuesToLabels as $value => $label): ?><?php echo ($countD==0)? "" : ", " ?><a href="/fr/destination.php/<?php echo str_replace(" ","-",strtolower($label."-".$value)); ?>/"><?php echo htmlspecialchars($label); ?></a><?php $countD++;?><?php endforeach ?>
            </p><?php endif ?>
                
			<?php if ($yachtsRecord['content_fr']): ?><div><?php echo $yachtsRecord['content_fr'] ?></div><?php endif ?>
            
            <?php if ($testimonialsRecords): ?>
            <h2>Temoignages</h2>
			<?php foreach ($testimonialsRecords as $record): ?>
            <div class="testimonial">
                <div class="testimonial-content"><?php echo $record['testimonial_fr']; ?></div>
            </div>
            <?php endforeach ?>
            <?php endif ?>
            
			<div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Suivant: <a href="#gallery">Galérie</a></div>
            </div>
            
            <!-- Tab Photos -->
            <div class="gallery" id="gallery">
            <h2>Galérie de <?php echo $yachtsRecord['yacht_name'] ?> <span class="small">(cliquez pour agrandir l'image)</span></h2>
			<?php $count = 0; ?> 
			<?php foreach ($yachtsRecord['gallery_images'] as $upload): ?>
				<?php $count++; ?> 
				<?php if ($count>1): ?> 
					<a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" rel="lightbox-gallery"><img src="<?php echo $upload['thumbUrlPath2'] ?>" width="195" height="133" alt="<?php echo $upload['info1'] ?>" class="imgsmall <?php $maxCols=3; if (@++$count2 % $maxCols == 0): ?>last<?php endif; ?>" /></a>
				<?php endif ?>
			<?php endforeach ?>
			<div class="clear"></div>
            <?php if ($yachtsRecord['photo_credits']): ?><p class="small"><?php echo $yachtsRecord['photo_credits'] ?></p><?php endif ?>
            
            <?php if ($yachtsRecord['show_video'] =="1"): ?>
            <div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Suivant: <a href="#video">Video</a></div>
			<?php else: ?>
            <div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Suivant: <a href="#specs">Spécifications</a></div>
			<?php endif ?>
			</div>
            
            <!-- Tab Video -->
			<?php if ($yachtsRecord['show_video'] =="1"): ?>
            <div class="video tabbox gallery" id="video">
            <?php if ($yachtsRecord['youtube']): ?>
            <div style="margin: 10px 0 2px 0;"><iframe width="589" height="402" src="<?php echo $yachtsRecord['youtube'] ?>" frameborder="0" allowfullscreen></iframe></div>
            <?php endif ?>
            <div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Next: <a href="#specs">Spécifications</a></div>
            </div>
			<?php endif ?>
            
			<!-- Tab Specs -->
			<div class="specs tabbox" id="specs">
 				<h2>spécifications pour <?php echo $yachtsRecord['yacht_name'] ?></h2>
				
				<?php foreach ($yachtsRecord['spec_images'] as $upload): ?>
                    <a href="<?php echo $upload['urlPath'] ?>" title="<?php echo $upload['info1'] ?>" rel="lightbox-gallery"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="<?php echo $upload['info1'] ?>" /></a>
                <?php endforeach ?>
				<?php if ($yachtsRecord['destinations']): ?>
                <p><strong>Zone de navigation:</strong> 
                <?php 
                  $values = getListValues('yachts','destinations',$yachtsRecord['destinations']); 
                  $labels = getListLabels('yachts','destinations',$yachtsRecord['destinations']); 
                  $valuesToLabels = array_combine($values, $labels); 
                ?>
                <?php $countD=0; ?><?php foreach ($valuesToLabels as $value => $label): ?><?php echo ($countD==0)? "" : ", " ?><a href="/destination.php/<?php echo str_replace(" ","-",strtolower($label."-".$value)); ?>/"><?php echo htmlspecialchars($label); ?></a><?php $countD++;?><?php endforeach ?>
                </p><?php endif ?>
				<?php if ($yachtsRecord['guests_day']): ?><p><strong>Invités (Jour):</strong> <?php echo $yachtsRecord['guests_day'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['guests_night']): ?><p><strong>Invités:</strong> 
<?php echo $yachtsRecord['guests_night'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['accommodation_fr']): ?><p><strong>Hébergement:</strong><br />
<?php echo $yachtsRecord['accommodation_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['entertainment_fr']): ?><p><strong>Divertissement:</strong><br />
<?php echo $yachtsRecord['entertainment_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['leisure_fr']): ?><p><strong>Loisirs:</strong><br />
<?php echo $yachtsRecord['leisure_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['equipment_fr']): ?><p><strong>Equipement:</strong><br />
<?php echo $yachtsRecord['equipment_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['communications_fr']): ?><p><strong>Moyens de communication:</strong><br />
<?php echo $yachtsRecord['communications_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['flag']): ?><p><strong>Drapeau:</strong> <?php echo $yachtsRecord['flag'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['design_fr']): ?><p><strong>Design:</strong> <?php echo $yachtsRecord['design_fr'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['built']): ?><p><strong>Construction:</strong> <?php echo $yachtsRecord['built'] ?></p><?php endif ?>
				<?php if ($yachtsRecord['refit']): ?><p><strong>Dernière rénovation:</strong> <?php echo $yachtsRecord['refit'] ?></p><?php endif ?>				
				<?php if ($yachtsRecord['yacht_length']): ?><p><strong>Longueur:</strong> <?php echo $yachtsRecord['yacht_length'] ?>m, <?php echo round($yachtsRecord['yacht_length'] * 3.2808399); ?>'</p><?php endif ?>
				<?php if ($yachtsRecord['yacht_beam']): ?><p><strong>Largeur:</strong> <?php echo $yachtsRecord['yacht_beam'] ?>m, <?php echo round($yachtsRecord['yacht_beam'] * 3.2808399); ?>'</p><?php endif ?>
				<?php if ($yachtsRecord['yacht_draft']): ?><p><strong>Tirant d’eau:</strong> <?php echo $yachtsRecord['yacht_draft'] ?>m, <?php echo round($yachtsRecord['yacht_draft'] * 3.2808399); ?>'</p><?php endif ?>
				<?php if ($yachtsRecord['engines']): ?><p><strong>Moteurs:</strong> <?php echo $yachtsRecord['engines'] ?></p><?php endif ?>
                <?php if ($yachtsRecord['fuel_capacity']): ?><p><strong>Réservoir de carburant:</strong> <?php echo $yachtsRecord['fuel_capacity'] ?> l, <?php echo round($yachtsRecord['fuel_capacity'] * 0.264172); ?> g</p><?php endif ?>
                
				<?php if ($yachtsRecord['fuel_consumption']): ?><p><strong>Consommation de carburant:</strong> <?php echo $yachtsRecord['fuel_consumption'] ?> l, <?php echo round($yachtsRecord['fuel_consumption'] * 0.264172); ?> g (per hour)</p><?php endif ?>
                
				<?php if ($yachtsRecord['water_capacity']): ?><p><strong>Réservoir d’eau:</strong> <?php echo $yachtsRecord['water_capacity'] ?> l, <?php echo round($yachtsRecord['water_capacity'] * 0.264172); ?> g</p><?php endif ?>
				<?php if ($yachtsRecord['cruising_speed']): ?><p><strong>Vitesse de croisière:</strong> <?php echo $yachtsRecord['cruising_speed'] ?>Kts</p><?php endif ?>
				<?php if ($yachtsRecord['maximum_speed']): ?><p><strong>Vitesse maximum:</strong> <?php echo $yachtsRecord['maximum_speed'] ?>Kts</p><?php endif ?>
            
				<?php if ($yachtsRecord['pdf_files']): ?>
                <div class="next next1"><a href="#enquire">Enquire</a></div><div class="next next2">Suivant: <a href="#brochures">Brochures</a></div>
                <?php elseif ($yachtsRecord['rate_low_season'] or $yachtsRecord['rate_high_season']): ?>
                <div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Suivant: <a href="#rates">Rates</a></div>
				<?php else: ?>
                <div class="next next1"><a href="#enquire">Renseignez-vous sur  <?php echo $yachtsRecord['yacht_name'] ?></a></div>
                <?php endif ?>
            </div>
			
            <!-- Tab Brochures -->
			<?php if ($yachtsRecord['pdf_files']): ?>
            <div class="brochures tabbox" id="brochures">
            <p><b>Brochures vous pouvez télécharger:</b></p>
            <?php foreach ($yachtsRecord['pdf_files'] as $upload): ?>
                <a href="<?php echo $upload['urlPath'] ?>" class="pdf" target="_blank"><?php if ($upload['info1']): ?><?php echo $upload['info1'] ?><?php else: ?>Brochure<?php endif ?> <span>(télécharger le PDF)</span></a>
            <?php endforeach ?>
            
			<?php if ($yachtsRecord['rate_low_season'] or $yachtsRecord['rate_high_season']): ?>
            <div class="next next1"><a href="#enquire">Se renseigner</a></div><div class="next next2">Suivant: <a href="#rates">Conditions</a></div>
            <?php else: ?>
            <div class="next next1"><a href="#enquire">Renseignez-vous sur  <?php echo $yachtsRecord['yacht_name'] ?></a></div>
            <?php endif ?>
            </div>
            <?php endif ?>
            
            <!-- Tab Rates -->
			<?php if ($yachtsRecord['rate_low_season'] or $yachtsRecord['rate_high_season']): ?>
            <div class="rates tabbox" id="rates">
            <h2>Conditions d' <?php echo $yachtsRecord['yacht_name'] ?></h2>
            
            
            <?php if ($yachtsRecord['rate_low_season']): ?><p><b>Basse saison::</b> 
                <?php if ($yachtsRecord['rate_currency'] == 'nz'): ?>NZ$<?php elseif ($yachtsRecord['rate_currency'] == 'euro'): ?>&euro;<?php elseif ($yachtsRecord['rate_currency'] == 'au'): ?>AU$<?php else: ?>US$<?php endif ?><?php echo $yachtsRecord['rate_low_season'] ?> par semaine</p>
            <?php endif ?>
            
            <?php if ($yachtsRecord['rate_high_season']): ?><p><b>Haute saison:</b> 
                <?php if ($yachtsRecord['rate_currency'] == 'nz'): ?>NZ$<?php elseif ($yachtsRecord['rate_currency'] == 'euro'): ?>&euro;<?php elseif ($yachtsRecord['rate_currency'] == 'au'): ?>AU$<?php else: ?>US$<?php endif ?><?php echo $yachtsRecord['rate_high_season'] ?> par semaine</p>
            <?php endif ?>
            
            <?php if ($yachtsRecord['rate_low_season'] or $yachtsRecord['rate_high_season']): ?>
            <?php if ($yachtsRecord['rate_notes_fr']): ?><p><b>N.B.:</b><br /><?php echo $yachtsRecord['rate_notes_fr'] ?></p><?php endif ?>
            <?php endif ?> 
            
            <div class="next next1"><a href="#enquire">Renseignez-vous sur  <?php echo $yachtsRecord['yacht_name'] ?></a></div>
            </div>
            <?php endif ?>
            
            <!-- Tab Enquire -->
            <div class="enquire tabbox" id="enquire">
				<h2>Renseignez-vous sur  <?php echo $yachtsRecord['yacht_name'] ?></h2>
                <? include("../library/inc/enquiry_yacht_fullpage_fr.php"); ?>
			</div>
            </div><!-- End panel-container -->
            </div><!-- End tab-container -->
            
            <p class="disclaimer"><b>Désistement:</b> This document is not contractual. The charter yacht details displayed above are displayed in good faith and whilst believed to be correct are not guaranteed. The Luxury Charter Group does not warrant or assume any legal liability or responsibility for the accuracy, completeness, or usefulness of any information and/or images displayed. All information is subject to change without notice and is without warrantee.
</p>
			
</div>
		<div class="sidecol">
			<? include("../library/inc/searchbox_fr.php"); ?>
			<? include("../library/inc/usp_fr.php"); ?>
            
    <!-- RELATED YACHTS START -->
            <!-- NOTE: Similar code is used in destinations.php -->
            <!-- CRITERIA FOR RELATED: 1. Same yacht type 2. Matching destinations -->
            <!-- SORT BY: default search as per yachts table -->
	    <div class="block">
	    <h2>Bateaux similaires</h2>
        <?php
	    $relatedYachtType = explode("\t", trim($yachtsRecord['type'], "\t"));
	    $relatedYachtDestination = explode("\t", trim($yachtsRecord['destinations'], "\t"));
	    $relatedYachtDestination = $relatedYachtDestination[0];
	    
	    //showme($yachtsRecords); exit();
	    list($yachtCheckRecords, ) = getRecords(array(
	      'tableName'   => 'yachts',
	      'where'	    => ' active_fr ="1"' . ' AND hide_fr ="0" AND num !="' .$yachtsRecord['num']. '"' , 
	      'loadUploads' => true,
	      'allowSearch' => false,
		  'useSeoUrls'	=> true,  
	    ));
	    $counterLimit = 0;
	    foreach ($yachtCheckRecords as $yachtCheckIfRelated):
	      
	      $loadYachtType 	    = explode("\t", trim($yachtCheckIfRelated['type'], "\t"));
	      $loadYachtDestination = explode("\t", trim($yachtCheckIfRelated['destinations'], "\t"));
	      
	      if (!in_array($relatedYachtDestination, $loadYachtDestination)) { continue; }
	      
	      foreach ($relatedYachtType as $values){
		if (!in_array($values, $loadYachtDestination)) { continue; }
	      }
	      
	      foreach ($yachtCheckIfRelated['banner_image'] as $index => $upload):
	      
	    ?>
	    <div class="relatedYachts">
            <a href="/<?php echo strtolower($yachtCheckIfRelated['_link']); ?>">
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="290" height="99" alt="<?php echo $yachtCheckIfRelated['yacht_name']; ?>"/>
            </a><br/>
            <a href="/<?php echo strtolower($yachtCheckIfRelated['_link']); ?>"><?php echo $yachtCheckIfRelated['yacht_name']; ?></a> - 
            <span>
			<?php
            echo $yachtCheckIfRelated['yacht_length'] . " m, " . $yachtCheckIfRelated['guests_night'] . " Invités";
            ?></span>
        </div>
	    <?php
	      endforeach;
	      $counterLimit++;
	      if($counterLimit == 5) { break; }
	    endforeach;
	    ?>
        </div>
		<!-- END RELATED YACHTS START -->
        
		</div>
		<div class="clear"></div>
	</div>
	<div class="footer">
		<? include("../library/inc/footer_fr.php"); ?>
	</div>
	<div class="copyright">
		<? include("../library/inc/copyright_fr.php"); ?>
	</div>
</div>
</body>
</html>
