#!/usr/bin/perl
require "config.idx";

$long = $ENV{'QUERY_STRING'};

if ($long) {
	@pairs=split(/&/,$long);
	foreach $item(@pairs) {
		($name,$content)=split (/=/,$item,2);
		$content=~tr/+/ /;
		$content=~ s/%(..)/pack("c",hex($1))/ge;
		if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$content; }
		else { $INPUT{$name} = $content; }
	}
}
else {
	read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
	@pairs = split(/&/, $buffer);
	foreach $pair (@pairs) {
		($name, $value) = split(/=/, $pair);
		$value =~ tr/+/ /;
		$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
		if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
		else { $INPUT{$name} = $value; }
	}
}

if ($INPUT{action} eq "choose") { &choose; }
else { &main; }


sub main {


use DBI;
my $dsn = "DBI:mysql:database=$d_name;host=localhost";
my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;
my $pasth = $dbh->prepare("select * from listings_res where mlsnum = '$INPUT{mlsnumber}'");
$pasth->execute;

while (($MLSNUM,$Class,$Type,$Area,$Price,$AddressNumber,$AddressDirection,$AddressStreet,$Address2,$City,$State,$Zip,$Status,$SaleRent,$Rooms,$Bedrooms,$FullBaths,$HalfBaths,$Garage,$FloodZone,$Outbuildings,$OldMLSNUM,$AgentID,$AgentName,$AgentPhone,$ListingOffice1ID,$ListingOffice1Name,$ListingOffice1Phone,$CoAgentID,$CoAgentName,$CoAgentPhone,$ListingOffice2ID,$ListingOffice2Name,$ListingOffice2Phone,$Blank35,$Blank36,$PhotoVideo,$Blank38,$Blank39,$LinkedMLSNUM,$Blank41,$Blank42,$Blank43,$County,$Township,$Subdivision,$Zoning,$Legal,$ApproxLotSize,$Irregular,$Acres,$PricePerAcre,$YearBuilt,$TotalSqFt,$MainLevelSqFt,$UpperLevel1SqFt,$UpperLevel2SqFt,$LowerLevelSqFt,$Source,$BsmntSqFt,$BsmntFinSqFt,$BsmntUnfinSqFt,$ElementarySchool,$MiddleSchool,$HighSchool,$LivingRoomSize,$LivingRoomLevel,$LivingRoomComments,$GreatRoomSize,$GreatRoomLevel,$GreatRoomComments,$FamilyRoomSize,$FamilyRoomLevel,$FamilyRoomComments,$KitchenSize,$KitchenLevel,$KitchenComments,$DiningRoomSize,$DiningRoomLevel,$DiningRoomComments,$DenStudySize,$DenStudyLevel,$DenStudyComments,$Bedroom1Size,$Bedroom1Level,$Bedroom1Comments,$Bedroom2Size,$Bedroom2Level,$Bedroom2Comments,$Bedroom3Size,$Bedroom3Level,$Bedroom3Comments,$Bedroom4Size,$Bedroom4Level,$Bedroom4Comments,$Bedroom5Size,$Bedroom5Level,$Bedroom5Comments,$Bathroom1Size,$Bathroom1Level,$Bathroom1Comments,$Bathroom2Size,$Bathroom2Level,$Bathroom2Comments,$UtilityRoomSize,$UtilityRoomLevel,$UtilityRoomComments,$OtherRoom1Size,$OtherRoom1Level,$OtherRoom1Comments,$OtherRoom2Size,$OtherRoom2Level,$OtherRoom2Comments,$OtherRoom3Size,$OtherRoom3Level,$OtherRoom3Comments,$Outbuilding1,$Outbuilding1Comments,$Outbuilding2,$Outbuilding2Comments,$Outbuilding3,$Outbuilding3Comments,$Reserved,$Blank124,$Directions,$DirectionsContinued,$Blank127,$TaxIDNUM,$LandValue,$ImproveValue,$EstimatedAnnualTax,$Exempt,$DitchFee,$OtherExp,$OtherExpPerQMY,$Fee,$Gas,$Electric,$Water,$Sewage,$GasAvailableYN,$AssocDues,$AssocDuesPerQMY,$Remarks,$Blank145,$Auction,$AuctionDate,$Assumption,$Contract,$SellerAssisted,$Blank151,$Blank152,$Blank153,$Blank154,$Blank155,$Blank156,$Blank157,$Blank158,$Blank159,$Blank160,$Blank161,$Blank162,$Blank163,$Blank164,$Blank165,$Blank166,$Blank167,$Blank168,$Blank169,$Blank170,$Blank171,$Blank172,$Blank173,$UsesFeaturesDataToChoose) = $pasth->fetchrow_array()) {

$TotalSqFt = &commas($TotalSqFt);

open(DBFILE,"remarksdb.txt");
@dbfile = <DBFILE>;
close(DBFILE);

foreach $dbline (@dbfile) {
$dbline =~ s/\n//gi;
if ($dbline) {
$Remarks =~ s/(.*?)$dbline//gi;
}
#$makestuff .= "$dbline\n";
}




($LivingRoomLength,$LivingRoomWidth) = split(/X/i,$LivingRoomSize);
($GreatRoomLength,$GreatRoomWidth) = split(/X/i,$GreatRoomSize);
($FamilyRoomLength,$FamilyRoomWidth) = split(/X/i,$FamilyRoomSize);
($KitchenLength,$KitchenWidth) = split(/X/i,$KitchenSize);
($DiningRoomLength,$DiningRoomWidth) = split(/X/i,$DiningRoomSize);
($DenStudyLength,$DenStudyWidth) = split(/X/i,$DenStudySize);
($Bedroom1Length,$Bedroom1Width) = split(/X/i,$Bedroom1Size);
($Bedroom2Length,$Bedroom2Width) = split(/X/i,$Bedroom2Size);
($Bedroom3Length,$Bedroom3Width) = split(/X/i,$Bedroom3Size);
($Bedroom4Length,$Bedroom4Width) = split(/X/i,$Bedroom4Size);
($Bedroom5Length,$Bedroom5Width) = split(/X/i,$Bedroom5Size);
($Bathroom1Length,$Bathroom1Width) = split(/X/i,$Bathroom1Size);
($Bathroom2Length,$Bathroom2Width) = split(/X/i,$Bathroom2Size);
($UtilityRoomLength,$UtilityRoomWidth) = split(/X/i,$UtilityRoomSize);
($OtherRoom1Length,$OtherRoom1Width) = split(/X/i,$OtherRoom1Size);
($OtherRoom2Length,$OtherRoom2Width) = split(/X/i,$OtherRoom2Size);
($OtherRoom3Length,$OtherRoom3Width) = split(/X/i,$OtherRoom3Size);
($Outbuilding1Length,$Outbuilding1Width) = split(/X/i,$Outbuilding1Size);


unless ($GreatRoomLevel) {
$GreatRoomLevel = "-";
}
unless ($FamilyRoomLevel) {
$FamilyRoomLevel = "-";
}
unless ($KitchenLevel) {
$KitchenLevel = "-";
}
unless ($DiningRoomLevel) {
$DiningRoomLevel = "-";
}
unless ($DenStudyLevel) {
$DenStudyLevel = "-";
}
unless ($Bedroom1Level) {
$Bedroom1Level = "-";
}
unless ($Bedroom2Level) {
$Bedroom2Level = "-";
}
unless ($Bedroom3Level) {
$Bedroom3Level = "-";
}
unless ($Bedroom4Level) {
$Bedroom4Level = "-";
}
unless ($Bedroom5Level) {
$Bedroom5Level = "-";
}
unless ($Bathroom1Level) {
$Bathroom1Level = "-";
}
unless ($Bathroom2Level) {
$Bathroom2Level = "-";
}
unless ($OtherRoom1Level) {
$OtherRoom1Level = "-";
}
unless ($OtherRoom2Level) {
$OtherRoom2Level = "-";
}
unless ($UtilityRoomLevel) {
$UtilityRoomLevel = "-";
}
unless ($Level) {
$Level = "-";
}
unless ($Level) {
$Level = "-";
}


unless ($LivingRoomLevel) {
$LivingRoomLevel = "-";
}



unless ($LivingRoomLength) {
$LivingRoomLength = "-";
}
unless ($LivingRoomWidth) {
$LivingRoomWidth = "-";
}
unless ($GreatRoomLength) {
$GreatRoomLength = "-";
}
unless ($GreatRoomWidth) {
$GreatRoomWidth = "-";
}
unless ($FamilyRoomLength) {
$FamilyRoomLength = "-";
}
unless ($FamilyRoomWidth) {
$FamilyRoomWidth = "-";
}
unless ($KitchenLength) {
$KitchenLength = "-";
}
unless ($KitchenWidth) {
$KitchenWidth = "-";
}
unless ($DiningRoomLength) {
$DiningRoomLength = "-";
}
unless ($DiningRoomWidth) {
$DiningRoomWidth = "-";
}
unless ($DenStudyLength) {
$DenStudyLength = "-";
}
unless ($DenStudyWidth) {
$DenStudyWidth = "-";
}
unless ($Bedroom1Length) {
$Bedroom1Length = "-";
}
unless ($Bedroom1Width) {
$Bedroom1Width = "-";
}
unless ($Bedroom2Length) {
$Bedroom2Length = "-";
}
unless ($Bedroom2Width) {
$Bedroom2Width = "-";
}
unless ($Bedroom3Length) {
$Bedroom3Length = "-";
}
unless ($Bedroom3Width) {
$Bedroom3Width = "-";
}
unless ($Bedroom4Length) {
$Bedroom4Length = "-";
}
unless ($Bedroom4Width) {
$Bedroom4Width = "-";
}
unless ($Bedroom5Length) {
$Bedroom5Length = "-";
}
unless ($Bedroom5Width) {
$Bedroom5Width = "-";
}
unless ($Bathroom1Length) {
$Bathroom1Length = "-";
}
unless ($Bathroom1Width) {
$Bathroom1Width = "-";
}
unless ($Bathroom2Length) {
$Bathroom2Length = "-";
}
unless ($Bathroom2Width) {
$Bathroom2Width = "-";
}
unless ($OtherRoom1Length) {
$OtherRoom1Length = "-";
}
unless ($OtherRoom1Width) {
$OtherRoom1Width = "-";
}
unless ($OtherRoom2Length) {
$OtherRoom2Length = "-";
}
unless ($OtherRoom2Width) {
$OtherRoom2Width = "-";
}
unless ($UtilityRoomLength) {
$UtilityRoomLength = "-";
}
unless ($UtilityRoomWidth) {
$UtilityRoomWidth = "-";
}


$LivingRoomLength =~ s/CHR1/\'/gi;


$LivingRoomWidth =~ s/CHR1/\'/gi;


$GreatRoomLength =~ s/CHR1/\'/gi;


$GreatRoomWidth =~ s/CHR1/\'/gi;


$FamilyRoomLength =~ s/CHR1/\'/gi;


$FamilyRoomWidth =~ s/CHR1/\'/gi;


$KitchenLength =~ s/CHR1/\'/gi;


$KitchenWidth =~ s/CHR1/\'/gi;


$DiningRoomLength =~ s/CHR1/\'/gi;


$DiningRoomWidth =~ s/CHR1/\'/gi;


$DenStudyLength =~ s/CHR1/\'/gi;


$DenStudyWidth =~ s/CHR1/\'/gi;


$Bedroom1Length =~ s/CHR1/\'/gi;


$Bedroom1Width =~ s/CHR1/\'/gi;


$Bedroom2Length =~ s/CHR1/\'/gi;


$Bedroom2Width =~ s/CHR1/\'/gi;


$Bedroom3Length =~ s/CHR1/\'/gi;


$Bedroom3Width =~ s/CHR1/\'/gi;


$Bedroom4Length =~ s/CHR1/\'/gi;


$Bedroom4Width =~ s/CHR1/\'/gi;


$Bedroom5Length =~ s/CHR1/\'/gi;


$Bedroom5Width =~ s/CHR1/\'/gi;


$Bathroom1Length =~ s/CHR1/\'/gi;


$Bathroom1Width =~ s/CHR1/\'/gi;


$Bathroom2Length =~ s/CHR1/\'/gi;


$Bathroom2Width =~ s/CHR1/\'/gi;


$OtherRoom1Length =~ s/CHR1/\'/gi;


$OtherRoom1Width =~ s/CHR1/\'/gi;


$OtherRoom2Length =~ s/CHR1/\'/gi;


$OtherRoom2Width =~ s/CHR1/\'/gi;


$UtilityRoomLength =~ s/CHR1/\'/gi;


$UtilityRoomWidth =~ s/CHR1/\'/gi;




$LivingRoomLength =~ s/CHR2/\"/gi;


$LivingRoomWidth =~ s/CHR2/\"/gi;


$GreatRoomLength =~ s/CHR2/\"/gi;


$GreatRoomWidth =~ s/CHR2/\"/gi;


$FamilyRoomLength =~ s/CHR2/\"/gi;


$FamilyRoomWidth =~ s/CHR2/\"/gi;


$KitchenLength =~ s/CHR2/\"/gi;


$KitchenWidth =~ s/CHR2/\"/gi;


$DiningRoomLength =~ s/CHR2/\"/gi;


$DiningRoomWidth =~ s/CHR2/\"/gi;


$DenStudyLength =~ s/CHR2/\"/gi;


$DenStudyWidth =~ s/CHR2/\"/gi;


$Bedroom1Length =~ s/CHR2/\"/gi;


$Bedroom1Width =~ s/CHR2/\"/gi;


$Bedroom2Length =~ s/CHR2/\"/gi;


$Bedroom2Width =~ s/CHR2/\"/gi;


$Bedroom3Length =~ s/CHR2/\"/gi;


$Bedroom3Width =~ s/CHR2/\"/gi;


$Bedroom4Length =~ s/CHR2/\"/gi;


$Bedroom4Width =~ s/CHR2/\"/gi;


$Bedroom5Length =~ s/CHR2/\"/gi;


$Bedroom5Width =~ s/CHR2/\"/gi;


$Bathroom1Length =~ s/CHR2/\"/gi;


$Bathroom1Width =~ s/CHR2/\"/gi;


$Bathroom2Length =~ s/CHR2/\"/gi;


$Bathroom2Width =~ s/CHR2/\"/gi;


$OtherRoom1Length =~ s/CHR2/\"/gi;


$OtherRoom1Width =~ s/CHR2/\"/gi;


$OtherRoom2Length =~ s/CHR2/\"/gi;


$OtherRoom2Width =~ s/CHR2/\"/gi;


$UtilityRoomLength =~ s/CHR2/\"/gi;


$UtilityRoomWidth =~ s/CHR2/\"/gi;


if ($ListingOffice1ID eq "130") {
$printoffice = "<b>Offered By:</b> $AgentName at $ListingOffice1Name (765) 741-9111"
}
else {
$printoffice = "<b>Listed By</b> $ListingOffice1Name<br>";
}

@thefeatures = split(/\|/,$UsesFeaturesDataToChoose);


$startcount = "0";
foreach $one (@thefeatures) {

$yasth = $dbh->prepare("select featurename,categoryname from codes where codenum = '$one'");
$yasth->execute;

while (($realname,$categoryname) = $yasth->fetchrow_array()) {

$categoryname = lc($categoryname);
$realname = lc($realname);

$realname =~ s/CHR1/\'/gi;
$realname =~ s/CHR2/\"/gi;
$categoryname =~ s/CHR1/\'/gi;
$categoryname =~ s/CHR2/\"/gi;

$showfeaturestable .= "<td valign=\"top\" width=\"33%\"><img src=\"images/dot.gif\">$categoryname<b>$realname</b></td>\n";


if ($startcount eq "2") {
$showfeaturestable .= "<tr>\n";
$startcount = "0";
}
else {
$startcount++;
}

}
}


if ($Garage) {
$fGarage = "<img src=images/dot.gif>Garage <b>$Garage</b><br>";
}
else {
}

if ($FloodZone) {
$fFloodZone = "<img src=images/dot.gif>FloodZone <b>$FloodZone</b><br>";
}
else {
}

if ($OutBuildings) {
$fOutBuildings = "<img src=images/dot.gif>OutBuildings <b>$OutBuildings</b><br>";
}
else {
}

if ($Zoning) {
$fZoning = "<img src=images/dot.gif>Zoning <b>$Zoning</b><br>";
}
else {
}

if ($Legal) {
$fLegal = "<img src=images/dot.gif>Legal <b>$Legal</b><br>";
}
else {
}

if ($ApproxLotSize) {
$fApproxLotSize = "<img src=images/dot.gif>Lot Size <b>$ApproxLotSize</b><br>";
}
else {
}

if ($Irregular) {
$fIrregular = "<img src=images/dot.gif>Irregular <b>$Irregular</b><br>";
}
else {
}

if ($PricePerAcre) {
$fPricePerAcre = "<img src=images/dot.gif>Per / Acre <b>$PricePerAcre</b><br>";
}
else {
}

if ($YearBuilt) {
$fYearBuilt = "<img src=images/dot.gif>Year Built <b>$YearBuilt</b><br>";
}
else {
}

if ($TaxIDNum) {
$fTaxIDNum = "<img src=images/dot.gif>TaxID <b>\#$TaxIDNum</b><br>";
}
else {
}

if ($LandValue) {
$LandValue = &commas($LandValue);
$fLandValue = "<img src=images/dot.gif>Land Value <b>\$$LandValue</b><br>";
}
else {
}

if ($ImproveValue) {
$ImproveValue = &commas($ImproveValue);
$fImproveValue = "<img src=images/dot.gif>Improv. Value <b>\$$ImproveValue</b><br>";
}
else {
}


if (-e "/home/muncieml/public_html/images/photos/full/meiar$MLSNUM\.jpg") {
$showpicture = "http://www.munciemls.com/images/photos/full/meiar$MLSNUM\.jpg";
}
else {
$showpicture = "http://www.munciemls.com/images/nophoto.gif";
}




print qq~

<html>
<head>
<title>Eagle  MLS #$MLSNUM Flyer</title>
<link rel="stylesheet" TYPE="text/css" href="includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
	<table border="0" cellpadding="0" cellspacing="0" widht="665">
		<tr>
			<td valign="top" width="665">

				<table border="0" cellpadding="0" cellspacing="0" width="665">
					<tr>
						<td valign="top" width="382">
							<img src="images/quickflyer.gif" width="382"><br>
						</td>
~;
if ($ListingOffice1ID eq "130") {
						my $dsn = "DBI:mysql:database=$d_name;host=localhost";
						my $dbh = DBI->connect($dsn, $d_username, $d_pass, {RaiseError => 1}) || die $DBI::errstr;
						my $iasth = $dbh->prepare("select agentid,mlsid,firstname,lastname,image,title from agents where display = '1' AND mlsid = '$AgentID' order by lastname desc LIMIT 0,1");
						$iasth->execute;

						while (($agentid,$mlsid,$firstname,$lastname,$image,$title) = $iasth->fetchrow_array()) {
						print qq~
			 			<td valign="top" width="283">
						<table border="0" cellpadding="3" cellspacing="0" width="100%">
						<tr>
						<td valign="middle" align="right">
							<br>
							$firstname $lastname<br>
							<b>Eagle Real Estate</b><br>
							4020 N. Rosewood Ave.<br>
							Muncie, Indiana 47304<br>
							(765) 741-9111<br>
							<font size="2"><i><b>We can sell your home!</i></b></font><br>
						</td>
						<td valign="middle">
						<br>
						<img src="images/agentpics/$image" width="60" height="83"><br>
						</td>
						</tr>
						</table>
~;
}
}
else {
print qq~
<td valign="middle" width="283">
<center>
You may be represented by Eagle Real Estate, Inc. when purchasing this property<br><b>Experience the buyer agency difference!</b><br><font size="2"><b>Call (765) 741-9111 for info</b></font><br>
</center>
~;
}
print qq~						
						</td>
					</tr>
					<tr>
						<td valign="top" colspan="2"><img src="images/quickflyer_2.gif"><br></td>
					</tr>
				</table>
				<table border="0" cellpadding="0" cellspacing="0" width="665">
					<tr>
						<td width="341" valign="top">
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
									<tr>
										<td valign="top" width="70%">
											<font size="3" face="Arial" color="navy"><b><i>$AddressNumber $AddressDirection $AddressStreet</i></b></font><br>
										</td>
										<td valign="top" width="30%">
											<font size="3" face="Arial" color="navy"><b><i>$ShowCity{$City}</i></b></font><br>
										</td>
									</tr>
								</table>
							<img src="images/line_spacer.gif" height="3" width="1"><br>
							<img src="$showpicture" name="picture"><br>
						</td>
						<td width="324" valign="top">
							<table border="0" cellpadding="4" cellspacing="0" width="100%">
								<tr>
									<td valign="top">
										<br><br>
										<font face="Arial, Helvetica, sans-serif"><font size="3"><b>Listing Remarks</b></font></font><br>
										<img src="images/line_spacer.gif" height="3" width="1"><br>
										<img src="images/black_fill.gif" height="1" width="320"><br>
										<img src="images/line_spacer.gif" height="1" width="11">
										<font size="3"><i>$Remarks</i></font><br>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
				<br>
				<table border="0" cellpadding="0" cellspacing="0" width="665">
					<tr>
						<td valign="top" width="665">
							<font face="Arial, Helvetica, sans-serif"><font size="3"><b>Property Details</b></font></font><br>
							<img src="images/line_spacer.gif" height="3" width="1"><br>
							<img src="images/black_fill.gif" height="2" width="665"><br>
							<img src="images/line_spacer.gif" height="2" width="1"><br>
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
									<tr>
										<td valign="top" width="33%">
											<img src="images/dot.gif">MLS Number <b>$MLSNUM</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Total Rooms <b>$Rooms</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Bedrooms <b>$Bedrooms</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Full Bathrooms <b>$FullBaths</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Half Bathrooms <b>$HalfBaths</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">County <b>$County</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
										</td>
										<td valign="top" width="33%">
											<img src="images/dot.gif">Township <b>$Township</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Area <b>$Area</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Subdivision <b>$Subdivision</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Acres <b>$Acres</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Year Built <b>$YearBuilt</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Square Feet <b>$TotalSqFt</b><br>
										</td>
										<td valign="top" width="34%">
											<img src="images/dot.gif">Elem. School <b>$ElementarySchool</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">Middle School <b>$MiddleSchool</b><br><img src="images/line_spacer.gif" height="1" width="1"><br>
											<img src="images/dot.gif">High School <b>$HighSchool</b><br><img src=images/line_spacer.gif height=1 width=1><br>
											<img src="images/dot.gif">Est. Annual Taxes <b>$EstimatedAnnualTax</b><img src="images/line_spacer.gif" height="1" width="1"><br>
											$fGarage<img src="images/line_spacer.gif" height="1" width="1"><br>
											$fApproxLotSize<img src="images/line_spacer.gif" height="1" width="1"><br>
										</td>
									</tr>
								</table>
						</td>
					</tr>
				</table>
				<br>
				<table border="0" cellpadding="0" cellspacing="0" width="665">
					<tr>
						<td valign="top" width="665">
							<font face="Arial, Helvetica, sans-serif"><font size="3"><b>Property Features</b></font></font><br>
							<img src="images/line_spacer.gif" height="2" width="1"><br>
							<img src="images/black_fill.gif" height="2" width="665"><br>
							<img src="images/line_spacer.gif" height="2" width="1"><br>
								<table border="0" cellpadding="0" cellspacing="0" width="100%">
									<tr>
										$showfeaturestable
									</tr>
								</table>
						</td>
					</tr>
				</table>
				
				<table border="0" cellpadding="0" cellspacing="0" width="665">
					<tr>
						<td valign="top" width="665">
							<font face="Arial, Helvetica, sans-serif"><font size="3"><b>Room Sizes</b></font></font><br>
							<img src="images/line_spacer.gif" height="2" width="1"><br>
							<img src="images/black_fill.gif" height="2" width="665"><br>
							<img src="images/line_spacer.gif" height="2" width="1"><br>
							    <table border="0" cellpadding="1" cellspacing="0" width="665">
					              <tr bgcolor="#999999"> 
					                <td valign="top"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Room</b></font></td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Length</b></font></div></td>
					                <td valign="top">&nbsp;</td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Width</b></font></div></td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Level</b></font></div></td>
					                <td valign="top"><strong><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Room</font></strong></td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Length</b></font></div></td>
					                <td valign="top">&nbsp;</td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Width</b></font></div></td>
					                <td valign="top"><div align="center"><font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif"><b>Level</b></font></div></td>
					              </tr>
					              <tr> 
					                <td valign="top"><b>Bedroom 1</b></td>
					                <td valign="top"><div align="center"><b>$Bedroom1Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom1Width</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom1Level</b></div></td>
					                <td valign="top"><b>Kitchen</b></td>
					                <td valign="top"><div align="center"><b>$KitchenLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$KitchenWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$KitchenLevel</b></div></td>
					              </tr>
					              <tr bgcolor="#EAE7E7"> 
					                <td valign="top"><b>Bedroom 2</b></td>
					                <td valign="top"><div align="center"><b>$Bedroom2Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom2Width</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom2Level</b></div></td>
					                <td valign="top"><b>Dining Room</b></td>
					                <td valign="top"><div align="center"><b>$DiningRoomLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$DiningRoomWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$DiningRoomLevel</b></div></td>
					              </tr>
					              <tr> 
					                <td valign="top"><b>Bedroom 3</b></td>
					                <td valign="top"><div align="center"><b>$Bedroom3Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom3Width</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom3Level</b></div></td>
					                <td valign="top"><b>Family Room</b></td>
					                <td valign="top"><div align="center"><b>$FamilyRoomLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$FamilyRoomWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$FamilyRoomLevel</b></div></td>
					              </tr>
					              <tr bgcolor="#EAE7E7"> 
					                <td valign="top"><b>Bedroom 4</b></td>
					                <td valign="top"><div align="center"><b>$Bedroom4Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom4Width</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom4Level</b></div></td>
					                <td valign="top"><b>Den / Study</b></td>
					                <td valign="top"><div align="center"><b>$DenStudyLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$DenStudyWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$DenStudyLevel</b></div></td>
					              </tr>
					              <tr> 
					                <td valign="top"><b>Bedroom 5</b></td>
					                <td valign="top"><div align="center"><b>$Bedroom5Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom5Width</b></div></td>
					                <td valign="top"><div align="center"><b>$Bedroom5Level</b></div></td>
					                <td valign="top"><b>Other Room 1</b></td>
					                <td valign="top"><div align="center"><b>$OtherRoom1Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</B></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom1Width</b></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom1Level</b></div></td>
					              </tr>
				    	          <tr bgcolor="#EAE7E7"> 
				        	        <td valign="top"><b>Bathroom 1</b></td>
					                <td valign="top" colspan="4"><div align="center"><b>$Bathroom1Size</b></div></td>
					                <td valign="top"><b>Other Room 2</b></td>
					                <td valign="top"><div align="center"><b>$OtherRoom2Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom2Width</b></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom2Level</b></div></td>
					              </tr>
					              <tr> 
					                <td valign="top"><b>Bathroom 2</b></td>
					                <td valign="top" colspan="4"><div align="Center"><b>$Bathroom2Size</b></div></td>
							        <td valign="top"><b>Other Room 3</b></td>
					                <td valign="top"><div align="center"><b>$OtherRoom3Length</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom3Width</b></div></td>
					                <td valign="top"><div align="center"><b>$OtherRoom3Level</b></div></td>
					              </tr>
					              <tr bgcolor="#EAE7E7"> 
					                <td valign="top"><b>Living Room</b></td>
					                <td valign="top"><div align="center"><b>$LivingRoomLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$LivingRoomWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$LivingRoomLevel</b></div></td>
					                <td valign="top"><b>Utility Room</b></td>
					                <td valign="top"><div align="center"><b>$UtilityRoomLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$UtilityRoomWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$UtilityRoomLevel</b></div></td>
					              </tr>
					              <tr> 
					                <td valign="top"><b>Great Room</b></td>
					                <td valign="top"><div align="center"><b>$GreatRoomLength</b></div></td>
					                <td valign="top"><div align="center"><b>x</b></div></td>
					                <td valign="top"><div align="center"><b>$GreatRoomWidth</b></div></td>
					                <td valign="top"><div align="center"><b>$GreatRoomLevel</b></div></td>
					                <td valign="top" colspan="5">&nbsp;</td>
					              </tr>
				            </table>
</td>
</tr>
</table>
<br>
$printoffice
<br><br>
This information is deemed reliable, but not guaranteed. All room sizes are approximate.<br>
<br>

<script language="JavaScript" type="text/javascript">
<!--

var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1);

function printWin()
{
    if (pr) {
        // NS4+, IE5+
        window.print();
    } else if (!mac) {
        // IE3 and IE4 on PC
        VBprintWin();
    } else {
        // everything else
        handle_error();
    }
}

function handle_error()
{
    window.alert('Your browser does not support this print option. Press Control/Option + P to print.');
    return true;
}

// -->
</script>

<script language="VBSCript" type="text/vbscript">
<!--

sub window_onunload
    on error resume next
    ' Just tidy up when we leave to be sure we aren't
    ' keeping instances of the browser control in memory
    set WB = nothing
end sub

sub VBprintWin
    OLECMDID_PRINT = 6
    on error resume next

    ' IE4 object has a different command structure
    if da then
        call WB.ExecWB(OLECMDID_PRINT, 1)
    else
        call WB.IOleCommandTarget.Exec(OLECMDID_PRINT, 1, "", "")
    end if
end sub

' -->
</script>

<script language="JavaScript" type="text/javascript">
<!--
printWin();
// -->
</script>

</body>
</html>

~;
}
$dbh->disconnect;
}