<?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
    

  // get records
    list($rentalsRecords, $rentalsMetaData) = getRecords(array(
    'tableName'   => 'rentals',
     'where'       => whereRecordNumberInUrl(0),
     'loadUploads' => true,
     'allowSearch' => false,
      'limit' => '1',
  ));
  $record = @$rentalsRecords[0]; // get first record
 
 // show error message if no matching record is found
if (!$record) {
header("HTTP/1.0 404 Not Found");
print "Record not found!";
exit;
}

?>


  <!-- STEP1: Map with single address: Put this in the <head> of your page, rename $record if needed -->
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
 <script type="text/javascript">
    function initialize() {
      var latitude    = <?php echo floatval(@$record['latitude']); ?>;
      var longitude   = <?php echo floatval(@$record['longitude']); ?>;
      var mapCanvasId = 'map_canvas';
      if (latitude) {
        var mapOptions  = { mapTypeId: google.maps.MapTypeId.ROADMAP };
        var map         = new google.maps.Map(document.getElementById(mapCanvasId), mapOptions);
        var latLng      = new google.maps.LatLng(latitude, longitude);
        var marker      = new google.maps.Marker({map: map, position: latLng });

        map.setCenter(latLng);
        map.setZoom(14);
      }
    }
  </script>  
  <!-- /STEP1: Map with single address -->
  
<title>FOR RENT - <?php echo htmlencode($record['address']) ?> 
				<?php echo join(', ', $record['City:values']); ?>,
				<?php echo htmlencode($record['state']) ?> <?php echo htmlencode($record['zip']) ?></title>



<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

<script type="text/javascript" src="js/stepcarousel.js">

/***********************************************
* Step Carousel Viewer script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/

</script>

<style type="text/css">

.stepcarousel{
position: relative; /*leave this value alone*/
border: 2px solid white;
overflow: scroll; /*leave this value alone*/
width: 415px; /*Width of Carousel Viewer itself*/
height: 280px; /*Height should enough to fit largest content's height*/
}

.stepcarousel .belt{
position: absolute; /*leave this value alone*/
left: 0;
top: 0;
}

.stepcarousel .panel{
float: left; /*leave this value alone*/
overflow: hidden; /*clip content that go outside dimensions of holding panel DIV*/
margin: 5px; /*margin around each panel*/
width: 415px; /*Width of each panel holding each content. If removed, widths should be individually defined on each content DIV then. */
}

.desc        { line-height: 140%; font-family: Verdana; font-size: 11pt; color: #000000 
}


</style>



<script type="text/javascript"> 
 
stepcarousel.setup({
	galleryid: 'gallerya', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:5000},
	panelbehavior: {speed:500, wraparound:false, persist:false},
	defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/arrowl.gif', -5, 120], rightnav: ['images/arrowr.gif', -8, 120]},
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})
 
</script>
 
 


        
 <body onload="initialize()">  
<?php include "inc_top.php"; ?>

  
      <div align="center">
		<table border="0" width="96%" id="table1">
		
                	<tr>
		
                	<td valign="top" align="left" width="50%">
		&nbsp;</td>
				<td valign="top" align="left" width="50%">
		<p align="right"><font face="Verdana" size="1"><b>
					
  					<a href="<?php echo $rentalsMetaData['_listPage'] ?>">
		<font color="#666633">&lt;&lt; Back to list page</font></a><font color="#666633">  |
  		</font>
  <a href="mailto:?subject=<?php echo urlencode(thisPageUrl()) ?>">
		<font color="#666633">Email this Page</font></a><br>
		<font color="#666633"><br>
		&nbsp; 
		</font> </b></font></p>
					</td>
			</tr>
					
                	<tr>
		
                	<td valign="top" align="left" width="50%">
				<p align="center"><b><font face="Verdana"> <?php echo htmlencode($record['address']) ?> 
				<?php echo join(', ', $record['City:values']); ?>,
				<?php echo htmlencode($record['state']) ?> <?php echo htmlencode($record['zip']) ?></font></b></td>
				<td valign="top" align="left" width="50%">
		<p align="center">  	  
 			<font face="Verdana"><b>CROSSROADS:
			<?php echo htmlencode($record['cross_street']) ?></b></font></td>
			</tr>
					
                	<td valign="top" align="left" width="50%">
		<div align="center">
		<table border="0" width="98%" id="table2">
		          <div id="gallerya" class="stepcarousel" style="width: 420px">
<div class="belt">
<?php foreach ($record['photos'] as $index => $upload): ?>
    <?php if ($upload['isImage']): ?> 
      <div align="center" class="panel" a href="<?php echo $upload['urlPath'] ?>"><img src="<?php echo $upload['thumbUrlPath3'] ?>" width="<?php echo $upload['thumbWidth3'] ?>" height="<?php echo $upload['thumbHeight3'] ?>" alt="" border="0" /></a>  
         
                                                                                                        						        
         <?php endif ?>  </div>  
          <?php endforeach ?>

</div>
</div>
 
<p id="gallerya-paginate" style="width: 420px;" align="center">
<img src="images/opencircle.png" data-over="images/graycircle.png" data-select="images/closedcircle.png" data-moveby="1" />

          
			</td>
				</table>
			</div>
			</td>
				<td valign="top" align="left" width="50%">
				<p align="center"><font size="1">&nbsp;</font><p align="center"><b><font color="#800000" face="Verdana">	
				<?php if ($record['notice']): ?> 
<?php echo htmlencode($record['notice']) ?><?php endif ?></font></b></p><font face="Verdana" size="2"> 
				<p align="center"> <?php echo $record['bedroom'] ?> <b>Bedrooms&nbsp; </b> <?php echo $record['bath'] ?><b> Baths&nbsp;
      Sq. Foot: </b> <?php echo htmlencode($record['approximate_square_footage']) ?>&nbsp;</font></p>
				<p align="center">
				<a target="_blank" href="<?php echo htmlencode($record['apply_now']) ?>"><img src="https://secure.ntnonline.com/securelease/ntnonline_90x60.jpg" border="2"></a><p align="center">
				<font face="Verdana" size="2"><b>Rent: </b>$<?php echo htmlencode($record['rent']) ?><b>
      Deposit:</b> $<?php echo htmlencode($record['deposit']) ?></font></p>
				<p align="center">
			<font size="2" face="Verdana">
			<?php if ($record['pool'] == 'Yes'): ?> 
																
																			
				
			<b>Pool:</b> Yes  |  <b>Pool Type:</b> <?php echo htmlencode($record['pool_type']) ?>
			<?php endif ?></p>
				<b>
				 <p align="center">
				 <?php if ($record['pet_friendly'] == 'Yes'): ?> 
									
					Pet Friendly: </b>Yes
<?php endif ?></p>


					</td>
			</tr>
			<tr>
				<td align="left" colspan="2" valign="top">
				

				
				<div class="desc">			
					<p><?php echo $record['description']; ?></p>
					&nbsp;<p>&nbsp;<b><!-- STEP3: Map with single address: Put this where you want your map displayed, rename $record if needed -->
					
				  <?php echo htmlencode($record['address']) ?> <?php echo join(', ', $record['City:values']); ?>, <?php echo htmlencode($record['state']) ?> <?php echo htmlencode($record['zip']) ?>&nbsp;
					<font size="1">Latitude: <?php echo htmlspecialchars( $record['latitude']); ?> |     Longitude: <?php echo htmlspecialchars( $record['longitude']); ?></font></b><br>
				
	<?php if (@$record['latitude']): ?>
    </p>
    <div id="map_canvas" style="width: 800px; height: 266px; float: left; margin: 0px 15px"></div>
  <?php endif ?>

  <?php if (!@$record['latitude']): ?>
    <div style="width: 799px; height: 265px; float: left; margin: 0px 15px; border: 1px solid #000;">
      <div style="text-align: center; padding-top: 135px">
        No map available!
      </div>
   	</b></div>
  <?php endif ?>
  <!-- STEP3: /Map with single address --><br> 	<b>
					
				
</div></td></table>
                	</div>
                	

    

<?php include "inc_footer.php"; ?>