<?php header('Content-type: text/html; charset=utf-8'); ?>
<?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('/usr/home/klemmr/www/htdocs/','','../','../../','../../../');
  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($land_listingsRecords, $land_listingsMetaData) = getRecords(array(
    'tableName'   => 'land_listings',
    'orderBy'     => 'price+0 DESC',
  ));
  
    list($officesRecords, $officesMetaData) = getRecords(array(
    'tableName'   => 'offices',
  ));
  $officesRecord = @$officesRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$officesRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
  
    list($opening_messageRecords, $opening_messageMetaData) = getRecords(array(
    'tableName'   => 'opening_message',
    'limit'       => '1',
  ));
  $opening_messageRecord = @$opening_messageRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$opening_messageRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
  
  list($page_headerRecords, $page_headerMetaData) = getRecords(array(
    'tableName'   => 'page_header',
  ));
  $page_headerRecord = @$page_headerRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$page_headerRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }
  
  list($footer_linksRecords, $footer_linksMetaData) = getRecords(array(
    'tableName'   => 'footer_links',
    'limit'       => '1',
  ));
  $footer_linksRecord = @$footer_linksRecords[0]; // get first record

  // show error message if no matching record is found
  if (!$footer_linksRecord) {
    header("HTTP/1.0 404 Not Found");
    print "Record not found!";
    exit;
  }

?>
<!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><?php echo $page_headerRecord['title_land'] ?></title>
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
  
  <meta name="description" content=" Klemm Real Estate, Washington Depot,
Connecticut.  Litchfield County's Premier broker of luxury properties. Serving all 26 towns and villages in Litchfield County, CT.">

<meta name="keywords" content=" Klemm Real Estate,Country Properties,Farm,Farmhouse,Land for Sale,Connecticut,Connecticut Real Estate,Country Rentals,Horse Properties, Estates,Litchfield,Litchfield County,Tanglewood,Prep Schools,Washington,Lakeville,Clemm,Clem,Klem,Sharon,Kent,CT,luxury real estate,lake properties,lake rentals,weekend house,antique,New England,Colonial,Bridgewater,Roxbury CT,Mayflower Inn,Carolyn Klemm,investments,second homes,Barns,Connecticut Rental,Candlewood Lake,Fairfield County,Greenwich CT,Private Properties,Farmland,Private Properties of Connecticut,weekend getaway, Investment Property,Waterfront House,Waterfront Land,Waterfront Property,Antique House,Northwest Conectcut,Salisbury CT,Country Estates,Country Cottage,Connecticut,Seasonal Rental,Summer Rental,New York State,Massachusetts">

<link href="main.css" rel="stylesheet" type="text/css">
<link href="base_kre_cmsb.css" rel="stylesheet" type="text/css">
<script src="nav.js" type="text/javascript"></script>
<script src="dropdowns_cmsb.js" type="text/javascript"></script>

 </head>
<body>

<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#003300">
  <tr>
    <td>

<table align="center" width="900" border="0">
	<tr>
	<?php foreach ($page_headerRecords as $record): ?>
		<td valign="middle" height="70">
		<?php foreach ($record['kre_logo'] 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 elseif ($upload['isImage']): ?>
            	<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" alt="" /><br/>

          	<?php else: ?>
            	<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          	<?php endif ?>
        	<?php endforeach ?>
		</td>
		
		<td align="center" valign="middle" height="70" class="header_italic">
		<?php echo $record['header_text'] ?><br/>
		</td>
		 <?php endforeach ?>
	</tr>
</table>

<table align="center" width="950" border="0" cellspacing="0" cellpadding="0" bgcolor="#3F613F">            
	<tr>
                <td>
                <div style="z-index:1; position:relative; left:100; top:165;">
                <table align="center" border="0" width="880" cellspacing="6" cellpadding="2">
			<tr bgcolor="#3F613F">
				<td align="center" width="90" height="25" class="nav_button">
				<a href="index.html" class="dropdown_menu">HOME</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" height="25" class="nav_button">
  				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu2, '125px')" onMouseout="delayhidemenu()" class="dropdown_menu">PROPERTIES</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" width="90" height="25" class="nav_button">
				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu3, '115px')" onMouseout="delayhidemenu()" class="dropdown_menu">LAND</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" width="90" height="25" class="nav_button">
				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu4, '115px')" onMouseout="delayhidemenu()" class="dropdown_menu">RENTALS</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" height="25" class="nav_button_about">
				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu5, '125px')" onMouseout="delayhidemenu()" class="dropdown_menu">ABOUT KLEMM</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" height="25" class="nav_button">
				<a href="agents.php" class="dropdown_menu">AGENTS</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" height="25" class="nav_button">
				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu6, '150px')" onMouseout="delayhidemenu()" class="dropdown_menu">CONTACT</a>
				</td>
				<td align="center"><img src="images/spacer.gif" alt="" width="1" height="1" /></td>
				<td align="center" height="25" class="nav_button_info">
				<a href="#" onClick="return clickreturnvalue()" onMouseover="dropdownmenu(this, event, menu7, '150px')" onMouseout="delayhidemenu()" class="dropdown_menu">LOCAL INFORMATION</a>
				</td>
			</tr>
		</table>
		</div>
                </td>
	</tr>
</table>

<table align="center" width="950" height="30" border="0" cellspacing="0" cellpadding="0" bgcolor="#3F613F">              
	<tr>
		<td align="right" valign="middle" width="120" class="text_14b_white">ADVANCED SEARCHES: &nbsp;&nbsp;&nbsp;</td>
                <td align="center" width="60"><a href="/search_houses.php" border="0"><img src="images/btn_houses3.gif" alt="" width="68" height="25" border="0" 
                /></a></td>
                <td align="center" width="60"><a href="/search_rentals.php" border="0"><img src="images/btn_rentals.gif" alt="" width="68" height="25" border="0" 
                /></td> 
                <td align="center" width="60"><a href="/search_land.php" border="0"><img src="images/btn_land.gif" alt="" width="68" height="25" border="0" 
                /></td>
                <td align="center" width="60"><a href="http://klemmnewclassics.com" target="_blank" border="0"><img src="images/btn_new_classics.gif" alt="" width="95" height="25" border="0" 
                /></td>
                 <td align="center" width="60"><a href="/properties.php?status=For+Sale&classification=Residential&features_keyword=antique" border="0"><img src="images/btn_antique.gif" alt="" width="68" height="25" border="0" 
                /></td>
                 <td align="center" width="60"><a href="/properties.php?status=For+Sale&classification=Residential&features_keyword=pool" border="0"><img src="images/btn_pool.gif" alt="" width="68" height="25" border="0" 
                /></td>
                 <td align="center" width="60"><a href="/properties.php?status=For+Sale&classification=Residential&features_keyword=tennis" border="0"><img src="images/btn_tennis.gif" alt="" width="68" height="25" border="0" 
                /></td>
                 <td align="center" width="60"><a href="/properties.php?status=For+Sale&classification=Residential&features_keyword=view" border="0"><img src="images/btn_view.gif" alt="" width="68" height="25" border="0" 
                /></td>
                </tr>
                <tr>
                	
                
                 <!--<td align="left" width="643" class="text_14b_white">
                 <form method="post" action="properties.php">	
		<input type="hidden" name="perpage" value="48">
		<input type="hidden" name="status_keyword" value="For Sale">
                 or enter a search word here: <input type="text" name="features,remarks,additional_remarks,style_keyword">
                 <input type="submit" name="search" value="  Search Listings  ">
                 </form>
                 </td>--> 
	</tr>
</table>
							
<table align="center" bgcolor="#E8DEA4" width="950" border="0" cellspacing="0" cellpadding="10">
	<tr>
		<td align="center" valign="top">
		<div class="page_title"><?php echo $land_listingsMetaData['totalRecords']; ?> Parcels of Land For Sale<br />
		</div>
		
		<p align="center"><?php echo $opening_messageRecord['message'] ?></p>
		</td>
	</tr>
</table>

<br />
<div align="center">

<table align="center" bgcolor="#003300" width="950" border="0" cellspacing="3" cellpadding="4">  
	<tr>
	<?php foreach ($land_listingsRecords as $record): ?>
		<td align="center" valign="top" class="listings">
		<span class="listing_heading"><?php echo $record['acreage'] ?> Acres</span><br/>
      		<?php echo $record['property_town'] ?><br/>
      		 		
     		<?php foreach ($record['listings_photo'] as $upload): ?>
          	<?php if ($upload['hasThumbnail']): ?>
            	<a href="<?php echo $record['_link'] ?>" class="navbar"><img src="<?php echo $upload['thumbUrlPath'] ?>" width="150" class="image_border" alt="" /></a><br/>

          	<?php elseif ($upload['isImage']): ?>
            	<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" class="image_border" alt="" /><br/>

          	<?php else: ?>
            	<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

          	<?php endif ?>
        	<?php endforeach ?>
     
      		<span class="price">$<?php echo number_format($record['price']) ?></span><br/>
      		<a href="<?php echo $record['_link'] ?>" class="details_link">Property Details</a><br/>
      		<span class="new_info"><?php echo $record['new_info'] ?></span><br/>
      		

    		<?php if (!$land_listingsRecords): ?>
     		 No records were found!<br/><br/>
    		<?php endif ?>
    		</td>
    		
    		<?php $maxCols=4; if (@++$count % $maxCols == 0): ?></tr><tr><?php endif; ?> 
		<?php endforeach ?>
	</tr>
</table>
</div>
<br />
<div align="center">
<a href="/properties.php?status=For+Sale&classification=Residential&price_min=4000000" class="price_range_white">Over $4 Million</a> &nbsp; | &nbsp;  
<a href="/properties.php?status=For+Sale&classification=Residential&price_max=4000000&price_min=2000000" class="price_range_white">$2 - $4 Million</a> &nbsp; | &nbsp; 
<a href="/properties.php?status=For+Sale&classification=Residential&price_max=2000000&price_min=1000000" class="price_range_white">$1 - $2 Million</a> &nbsp; | &nbsp; 
<a href="/properties.php?status=For+Sale&classification=Residential&price_max=1000000&price_min=500000" class="price_range_white">$500,000 - $1 Million</a> &nbsp; | &nbsp; 
<a href="/properties.php?status=For+Sale&classification=Residential&price_max=500000" class="price_range_white">Up to $500,000</a>
</div>
<br />


		
<table align="center" width="900" border="0">
	<tr>
		<td align="center" valign="middle"  class="panel_green">
		<table border="0" cellspacing="8" cellpadding="0">
                  <tr>
                    <td width="128" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">860.435.6789<br>
                      Lakeville/Salisbury</span></div></td>
                    <td><img src="/images/spacer.gif" width="4" height="20" alt=""></td>
                    
                    <td width="128" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">860.567.5060<br>
                      Litchfield</span></div></td>
                    <td><img src="/images/spacer.gif" width="4" height="20" alt=""></td>
                    
                    <td width="128" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">860.354.3263<br>
                      Roxbury</span></div></td>
                    <td><img src="/images/spacer.gif" width="4" height="20" alt=""></td>                   
                    
                    <td width="128" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">860.364.5993<br>
                      Sharon</span></div></td>
                       <td><img src="/images/spacer.gif" width="4" height="20" alt=""></td>
                       
                       <td width="128" height="48" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">860.868.7313<br>
                     Washington Depot</span></div></td>
                       <td><img src="/images/spacer.gif" width="4" height="20" alt=""></td>
                       
                    <td width="128" bordercolor="#cccc66" class="offices"><div align="center"><span class="txt_panel">203.263.4040<br>
                      Woodbury</span></div></td>
                  </tr>
                </table>

		<div align="center">
		<?php echo $footer_linksRecord['links'] ?>

		<?php if (!$footer_linksRecord): ?>
     		 No record found!<br/><br/>
    		<?php endif ?>
		</div>
		<br>
		</td>
	</tr>
</table>
</td></tr></table>

<br><br>

</body>
</html>