<?php
// ----------------------------------------------------------------------------
// Copyright (C) 2013-2016, Vinos de Frutas Tropicales
// Created expressly for PB Publishing, xcountryski-vermont.com.
// ----------------------------------------------------------------------------
$pageTitle = 'Vermont Cross Country Ski Reports and Cross Country Skiing Guide to Vermont Xcountry ski centers and trails';
$metaDescription = $commonInfo['meta_description'];
$metaKeywords = $commonInfo['meta_keywords'];
$headerImage = $commonInfo['logo_main'];
$top_content = $commonInfo['content_main_top'];
$page_content = nl2br($commonInfo['content_main']);
$banner_ad_top = html_entity_decode($commonInfo['banner_ad_top'], ENT_COMPAT, 'UTF-8');
$banner_ad_bottom = html_entity_decode($commonInfo['banner_ad_bottom'], ENT_COMPAT, 'UTF-8');

//-bof-20160107-lat9-Add the javascript to enable the home-page map of all the centers
if ($current_page == 'home' && !empty ($commonInfo['map_lead_in'])) {
  $page_content .=  "\n" . $commonInfo['map_lead_in'] . "\n" . '<div id="the-map"></div>' . "\n";
  $additionalScripts .= '<script src="https://maps.googleapis.com/maps/api/js"></script>' . "\n";
  $additionalScripts .= '<script src="includes/map_points.js"></script>' . "\n";
  $additionalScripts .= '<script>' . "\n";
  $additionalScripts .= 'var mapPoints = [' . "\n";

  $notCenters = array (ADMIN_NAME, 'northern', 'central', 'southern');
  foreach ($dbMain as $center => $centerInfo) {
    if (!in_array ($center, $notCenters)) {
      if ($centerInfo['latitude'] != 0 && $centerInfo['longitude'] != 0) {
        $name = addslashes ($centerInfo['name']);
        $longitude = $centerInfo['longitude'];
        $latitude = $centerInfo['latitude'];
        
        $additionalScripts .= "  ['$name', $latitude, $longitude, 'index.php?center=$center'],\n";
        
      }
    }
  }
    
  $additionalScripts .= '];' . "\n";
  $additionalScripts .= 'var centerLongitude = ' . $commonInfo['longitude'] . ';' . "\n";
  $additionalScripts .= 'var centerLatitude = ' . $commonInfo['latitude'] . ';' . "\n";
  $additionalScripts .= '</script>' . "\n";

  $onload = ' onload="initializeMaps();"';
  
}
//-eof-20160107-lat9