<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php require_once "../cmsAdmin/lib/viewer_functions.php"; ?>
<?php if (!@$GLOBALS['GEOCODER_PLUGIN']) { die("You must activate the Geocoder plugin before you can access this page."); } ?>

<?php
  /* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('/home/visit/www/visitalliance.com/','','../','../../','../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // load records
  list($attractionsRecords, $attractionsMetaData) = getRecords(array(
    'tableName'   => 'attractions',
    'perPage'     => '30',
    'orderBy'     => 'title'
  ));


?>
<!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">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  <style type="text/css">
    body          { font-family: arial; }
    .instructions { border: 3px solid #000; background-color: #EEE; padding: 10px; text-align: left; margin: 25px}
  .content{
padding:10px;
width:500px
}
</style>
  
  
<!-- STEP1: Map with multiple addresses: Put this in the <head> of your page, rename $myRecords if needed --> 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script type="text/javascript"> 
function initialize() { 
  var mapCanvasId = 'map_canvas'; 
  var mapOptions  = { mapTypeId: google.maps.MapTypeId.ROADMAP }; 
  var map         = new google.maps.Map(document.getElementById(mapCanvasId), mapOptions); 
  var bounds      = new google.maps.LatLngBounds(); 
  var infowindow  = new google.maps.InfoWindow(); 
<?php 
foreach ($attractionsRecords as $record) { 
  if (!$record['latitude'] || !$record['longitude']) { continue; } 
  $jsFunctionArgs = "{$record['latitude']}, {$record['longitude']}, {$record['num']}, '" .escapeJs($record['_link']). "'"; 
  print "  _geocoder_addMarker($jsFunctionArgs);\n"; 
} 
?> 

  // 
  function _geocoder_addMarker(latitude, longitude, recordNum, detailLink) { 
    var latLng       = new google.maps.LatLng(latitude, longitude); 
    var infowindowEl = document.getElementById('marker_infowindow_' + recordNum); 
    var marker       = new google.maps.Marker({ map: map, position: latLng }); 
    google.maps.event.addListener(marker, 'click', function() { 
      if (infowindowEl) { 
        infowindow.setContent(infowindowEl.innerHTML); 
        infowindow.open(map, marker); 
      } 
      else { 
        window.location = detailLink; 
      } 
    }); 
    bounds.extend(latLng); 
  } 

  // 
  map.fitBounds(bounds); 
} 

</script> 
    
 </head>



			
				
				
				</td>
				<!-- Start Box Here -->

<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td align="center">
		


<table border="0" cellpadding="0" cellspacing="0" width="100%" height="20">
	<tr>
		<td width="20" background="../images/top_left.gif">&nbsp;</td>
		<td background="../images/top_center.gif">&nbsp;</td>
		<td width="20" background="../images/top_right.gif">&nbsp;</td>
	</tr>
</table>


<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="20" background="../images/left_vertical.gif">&nbsp;</td>
		<td>
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td valign="top" align="center" width="57%">
				


<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p align="left"></p>
<p align="left"></p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td align="center">
		
<!-- Start Map Here -->
<!-- STEP2: Map with multiple addresses: add this to body tag: onload="initialize() --> 
<body onload="initialize()"> 
<!-- STEP2: Map with multiple addresses --> 

<h1><font size="5">Attraction &amp; Fun things to do in Alliance</font></h1> 
<p>TIP: Click on markers for more details.</p>

  <!-- STEP3: Map with multiple addresses: Put this where you want your map disattractionsed, rename $myRecords if needed --> 
  <?php $hasAddresses = array_filter(array_pluck($attractionsRecords, 'latitude')); ?> 
  <?php if ($hasAddresses): ?> 
    <div id="map_canvas" style="width: 550px; height: 950px; float: left; margin: 0px 15px;"></div> 
  <?php endif ?> 

  <?php if (!$hasAddresses): ?> 
    <div style="width: 650px; height: 550px; float: left; margin: 0px 15px; border: 1px solid #000;"> 
      <div style="text-align: center; padding-top: 135px"> 
        No map available! 
      </div> 
    </div> 
  <?php endif ?> 
  <!-- STEP3: /Map with multiple addresses --> 

 


  <!-- STEP4: Map with multiple addresses: Set the popup window content, rename $myrecords if needed --> 
  <div id="marker_details" style="display: none;"> 
    <?php foreach ($attractionsRecords as $record): ?> 

      <?php // marker_infowindow_### is the content disattractionsed in the info-window on click ?> 
      <div id="marker_infowindow_<?php echo $record['num']; ?>" style="position: absolute; top: 1132px; left: 722px; width: 26px; height: 28px; z-index: 1"> 
        <font size="2">
        <b><?php echo $record['title'] ?></b></br>
        <font size="1">
        <?php echo $record['address'] ?><br/>
        <?php echo $record['city'] ?>, <?php echo $record['state'] ?>, <?php echo $record['zip'] ?><br>
                
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($record['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

          
          <?php endif ?>
        <?php endforeach ?>

        
        <!-- <a href="<?php echo $record['_link']; ?>">details</a> -->
      </div> 

    <?php endforeach ?> 
  </div> 
  <!-- STEP4: Map with multiple addresses --> 

<!-- End Map Here -->
		
		
		</td>
	</tr>
</table>
<p align="left">


<!-- Start Box Here -->

<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td align="center">
		


<table border="0" cellpadding="0" cellspacing="0" width="100%" height="20">
	<tr>
		<td width="20" background="../images/top_left.gif">&nbsp;</td>
		<td background="../images/top_center.gif">&nbsp;</td>
		<td width="20" background="../images/top_right.gif">&nbsp;</td>
	</tr>
</table>


<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td width="20" background="../images/left_vertical.gif">&nbsp;</td>
		<td>&nbsp;<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td align="center">
				<a target="_blank" href="http://www.visitnebraska.gov/travel-tools/travel-guide-request">
				<img border="0" src="../images/Nebraska_travel_guide.jpg"></a></td>
				<td width="500">You can also view or download an
				<a target="_blank" href="http://www.visitnebraska.gov/travel-tools/electronic-travel-guide">
				<u>electronic version</u></a> of the <em>Nebraska Travel Guide</em>.</td>
			</tr>
		</table>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</td>
		<td width="20" background="../images/right_vertical.gif">&nbsp;</td>
	</tr>
</table>


<table border="0" cellpadding="0" cellspacing="0" width="100%" height="20">
	<tr>
		<td width="20" background="../images/bottom_left.gif">&nbsp;</td>
		<td background="../images/bottom_center.gif">&nbsp;</td>
		<td width="20" background="../images/bottom_right.gif">&nbsp;</td>
	</tr>
</table>
		
		
		
		
		
		</td>
	</tr>
</table>

<!-- End Box Here -->

</p>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;</p>
<p align="left">&nbsp;<td valign="top" width="43%">
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					

					<tr>

						
	  							
	  
	  &nbsp;</td>

					</tr>
				</table>
				<p align="center"><font face="Verdana" size="2">&nbsp;</font>
<?php foreach ($attractionsRecords as $record): ?>				
				<table border="0" cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="16" valign="top">&nbsp;</td>
						<td valign="top" align="center">
						
     <!-- STEP 2a: Display Uploads for field 'images' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
        <?php foreach ($record['images'] as $upload): ?>
          <?php if ($upload['hasThumbnail']): ?>
            <img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" alt="" /><br/>

         <?php endif ?>
        <?php endforeach ?>
      <!-- STEP2a: /Display Uploads -->

						
						</td>
						<td valign="top" width="166" align="left">
      <font size="2">
	  <?php if (!$record['url']): ?>
	  <?php echo $record['title'] ?><br/></font>
	  <font size="1">
	  <?php echo $record['address'] ?></br/>
      <?php echo $record['city'] ?>, <?php echo $record['state'] ?>, <?php echo $record['zip'] ?><br/>
      PH: <?php echo $record['phone'] ?></br>
      FAX: <?php echo $record['fax'] ?></br>
      Email: <a href="mailto:<?php echo $record['email'] ?>"><?php echo $record['email'] ?><a/></br></br></font>

	  <?php else:?>
	  <font size="2">
	  <a target="_blank" href="<?php echo $record['url'] ?>"><b><?php echo $record['title'] ?></b></a><br/></font>
      <font size="1">
      <?php echo $record['address'] ?></br/>
      <?php echo $record['city'] ?>, <?php echo $record['state'] ?>, <?php echo $record['zip'] ?><br/>
      PH: <?php echo $record['phone'] ?></br>
      FAX: <?php echo $record['fax'] ?></br/>
      Email: <a href="mailto:<?php echo $record['email'] ?>"><?php echo $record['email'] ?><a/></br></br></font>
      <?php endif ?>
      

					
						
						
						</td>
					</tr>
					<tr>
						<td width="16" valign="top">&nbsp;</td>
						<td valign="top" align="center">
						
     &nbsp;</td>
						<td valign="top" width="166" align="left">
&nbsp;</td>
					</tr>
				</table>
<?php endforeach ?>

				
				<p align="center">&nbsp;</td>
			</tr>
		</table>
		<p>&nbsp;</p>
		</td>
		<td width="20" background="../images/right_vertical.gif">&nbsp;</td>
	</tr>
</table>


<table border="0" cellpadding="0" cellspacing="0" width="100%" height="20">
	<tr>
		<td width="20" background="../images/bottom_left.gif">&nbsp;</td>
		<td background="../images/bottom_center.gif">&nbsp;</td>
		<td width="20" background="../images/bottom_right.gif">&nbsp;</td>
	</tr>
</table>
	<center>
    <?php if ($attractionsMetaData['invalidPageNum']): ?>
      Results page '<?php echo $attractionsMetaData['page']?>' not found, <a href="<?php echo $attractionsMetaData['firstPageLink'] ?>">start over &gt;&gt;</a>.<br/><br/>
    <?php elseif (!$attractionsRecords): ?>
      No records were found!<br/><br/>
    <?php endif ?>
  <!-- /STEP2: Disattractions Records -->


  <!-- STEP3: Disattractions Page Links (Paste anywhere below "Load Record List") -->
    <?php if ($attractionsMetaData['prevPage']): ?>
      <a href="<?php echo $attractionsMetaData['prevPageLink'] ?>">&lt;&lt; prev</a>
    <?php else: ?>
      &lt;&lt; prev
    <?php endif ?>

    - page <?php echo $attractionsMetaData['page'] ?> of <?php echo $attractionsMetaData['totalPages'] ?> -

    <?php if ($attractionsMetaData['nextPage']): ?>
      <a href="<?php echo $attractionsMetaData['nextPageLink'] ?>">next &gt;&gt;</a>
    <?php else: ?>
      next &gt;&gt;
    <?php endif ?>
  <!-- /STEP3: Disattractions Page Links -->




  </center>		
		
		
		
		
		<p>&nbsp;</td>
	</tr>
</table>

<!-- End Box Here -->



  
</body>
</html>
