#!/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 "register") { &register; }
else { &main; }

sub register {

#########################################
### Run Checks  #########################
#########################################

if ($INPUT{Accepted} eq "") {
$checkaccept = "You Must Accept The Terms To Register!";
}

if ($INPUT{UserType} eq "") {
$checkUserType = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{FirstName} eq "") {
$checkFirstName = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{LastName} eq "") {
$checkLastName = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{Email} eq "") {
$checkEmail = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{Password} eq "") {
$checkPassword = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{email_block} eq "") {
$checkemail_block = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}

if ($INPUT{email_openhouses} eq "") {
$checkemail_openhouses = "&nbsp;&nbsp;&nbsp;<font color=\"red\" size=\"2\"><b>Required</b></font>";
}



use Mail::CheckUser qw(check_email last_check);
$Mail::CheckUser::Timeout = 5;
$Mail::CheckUser::Sender_Addr = 'myhomes@orrhomes.com';
$Mail::CheckUser::Helo_Domain = 'www04.idxnow.com';

if (check_email($INPUT{Email})) {
}
else {
$messagewindow = "E-Mail Address $INPUT{Email} Is Not Valid: " . last_check()->{reason};
&main;
exit 0;
}


unless ($INPUT{FirstName} && $INPUT{LastName} && $INPUT{Email} && $INPUT{Password} && $INPUT{Accepted} && $INPUT{UserType}) {
print "Content-type: text/html\n\n";
$messagewindow = "You Left Off Required Fields!";
&main;
exit 0;
}



#########################################
### End Run Checks  #####################
#########################################

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 $hasth = $dbh->prepare("select email from users where email = '$INPUT{Email}'");
$hasth->execute;
while (($email) = $hasth->fetchrow_array()) {
print "Content-type: text/html\n\n";
$messagewindow = "The User $INPUT{Email} Is Already Registered!  If You Lost Your Password You May <a href=\"lostpassword.idx?Email=$INPUT{Email}\">Retrieve It Here</a>!";
&main;
exit 0;
}

$INPUT{Email} =~ s/\"/CHR2/gi;
$INPUT{Email} =~ s/\'/CHR1/gi;
$INPUT{FirstName} =~ s/\"/CHR2/gi;
$INPUT{FirstName} =~ s/\'/CHR1/gi;
$INPUT{LastName} =~ s/\"/CHR2/gi;
$INPUT{LastName} =~ s/\'/CHR1/gi;
$new_firstname = ucfirst(lc($INPUT{FirstName}));
$new_lastname = ucfirst(lc($INPUT{LastName}));
$INPUT{Address} =~ s/\"/CHR2/gi;
$INPUT{Address} =~ s/\'/CHR1/gi;
$INPUT{City} =~ s/\"/CHR2/gi;
$INPUT{City} =~ s/\'/CHR1/gi;
$INPUT{State} =~ s/\"/CHR2/gi;
$INPUT{State} =~ s/\'/CHR1/gi;
$INPUT{Zip} =~ s/\"/CHR2/gi;
$INPUT{Zip} =~ s/\'/CHR1/gi;
$INPUT{Password} =~ s/\"/CHR2/gi;
$INPUT{Password} =~ s/\'/CHR1/gi;
$INPUT{TimeToMove} =~ s/\"/CHR2/gi;
$INPUT{TimeToMove} =~ s/\'/CHR1/gi;
$INPUT{realtor} =~ s/\"/CHR2/gi;
$INPUT{realtor} =~ s/\'/CHR1/gi;
$INPUT{FoundBy} =~ s/\"/CHR2/gi;
$INPUT{FoundBy} =~ s/\'/CHR1/gi;
$INPUT{UserType} =~ s/\"/CHR2/gi;
$INPUT{UserType} =~ s/\'/CHR1/gi;
$INPUT{myERAAgent} =~ s/\"/CHR2/gi;
$INPUT{myERAAgent} =~ s/\'/CHR1/gi;
$INPUT{Phone} =~ s/\"/CHR2/gi;
$INPUT{Phone} =~ s/\'/CHR1/gi;

#########  CHECK TO SEE IF THEY REALLY SELECTED A REALTOR OR NOT AND CHANGE IF THEY DID ####################

$inputrealtor = "$INPUT{myERAAgent}";

if ($inputrealtor ne "") {
$inputrealtor = "Yes";
}

###########################################################################################################

$oasth = $dbh->do("insert into users values ('','$INPUT{Email}',PASSWORD('$INPUT{Password}'),'$new_firstname','$new_lastname','$INPUT{Address}','$INPUT{City}','$INPUT{State}','$INPUT{Zip}','$INPUT{TimeToMove}','$inputrealtor',now(),now(),'$INPUT{FoundBy}','$INPUT{UserType}','$INPUT{myERAAgent}','$INPUT{Phone}','',now(),'','y','$INPUT{email_openhouses}')");

my $pasth = $dbh->prepare("select last_insert_id()");
$pasth->execute();
while (($lastnumber) = $pasth->fetchrow_array()) {
$thelastnumber = $lastnumber;
}






if ($INPUT{realtor} eq "No") {

my $yasth = $dbh->prepare("select mlsid from agents where leadsystem = 'Enrolled' and display = '1' ORDER BY RAND() limit 1");
$yasth->execute;
	while (($agent_mls_id) = $yasth->fetchrow_array()) {
	$assigned_to_who = $agent_mls_id;
	}
	$assigned_to_who = "notassigned" unless $assigned_to_who;
}
else {
$assigned_to_who = $INPUT{myERAAgent};
}

$fasth = $dbh->do("insert into leadtracking values ('$thelastnumber','','','','','','','$assigned_to_who','','','')");

$dbh->disconnect();


open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL "To: Messages\@ORRHomes.com\n";
print MAIL "From: Info\@ORRHomes.com\n";
print MAIL "Subject: NEW USER ($new_firstname $new_lastname) Registered at MuncieMLS.com!\n";
print MAIL "Content-type: text/html\n\n";
print MAIL qq~
<html>
<head>
<title>E-Mailer</title>
<link rel="stylesheet" TYPE="text/css" href="http://www.ORRHomes.com/includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<br><br>
Site: MuncieMLS.com<br>
Name: $new_firstname $new_lastname<br>
E-Mail: $INPUT{Email}<br>
Phone :$INPUT{Phone}<br>
Address: $INPUT{Address} $INPUT{City}, $INPUT{State} $INPUT{Zip}<br>
Time To Move: $INPUT{TimeToMove}<br>
User Type: $INPUT{UserType}<br>
Found By: $INPUT{FoundBy}<br>
</body>
</html>
~;
close(MAIL);




open(MAIL,"|/usr/sbin/sendmail -t");
print MAIL "To: $INPUT{Email}\n";
print MAIL "From: ryan\@orrhomes.com\n";
print MAIL "Subject: $INPUT{FirstName}, Welcome To MuncieMLS.com!\n";
print MAIL "Content-type: text/html\n\n";
print MAIL qq~
<html>
<head>
<title>E-Mailer</title>
<link rel="stylesheet" TYPE="text/css" href="http://www.ORRHomes.com/includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<br><br>
<center>
<table border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td valign="top" width="600">
<img src="http://www.ORRHomes.com/images/emailheader.gif"><br>
<table border="0" cellspacing="0" cellpadding="15" width="100%">
<tr>
<td valign="top" width="100%">
<font size="2">
$new_firstname $new_lastname,<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The ORR Home Selling Team would like to thank you for registering at www.MuncieMLS.com!<br><br>
<b>Your login information for future reference is</b><br>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td><b>E-Mail</b></td>
<td>$INPUT{Email}</td>
</tr>
<tr>
<td><b>Password</b></td>
<td>$INPUT{Password}</td>
</tr>
</table>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With your newly created MuncieMLS.com MyHomes Account Center, you have access to all residential, commercial, investment, and land for sale currently listed within the cooperating brokers of the Mid-Eastern Indiana Association Of REALTORS IDX exchange program!  You may also save searches and receive daily email notifications of new or updated listings that meet your saved search criteria.  If you find a certain property and you wish to keep it to view it at later you can save it directly into your MyHomes account and even create a note for later reference!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RE/MAX Real Estate Groups Muncie and The ORR Home Selling Team look forward to serving you.    If at anytime you have questions or comments regarding the use of MuncieMLS.com please email ryan\@orrhomes.com.<br><br><br>
</font>
</td>
</tr>
</table>
<img src="http://www.ORRHomes.com/images/emailfooter.gif"><br><br><br>
</td>
</tr>
</table>
</center>
</body>
</html>
~;
close(MAIL);

$send_body =qq~
<html>
<head>
<title>E-Mailer</title>
<link rel="stylesheet" TYPE="text/css" href="http://www.ORRHomes.com/includes/style.css">
</head>
<body bgcolor="white" leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
<br><br>
<center>
<table border="0" cellspacing="0" cellpadding="0" width="600">
<tr>
<td valign="top" width="600">
<img src="http://www.ORRHomes.com/images/emailheader.gif"><br>
<table border="0" cellspacing="0" cellpadding="15" width="100%">
<tr>
<td valign="top" width="100%">
<font size="2">
$new_firstname $new_lastname,<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The ORR Home Selling Team would like to thank you for registering at www.MuncieMLS.com!<br><br>
<b>Your login information for future reference is</b><br>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
<td><b>E-Mail</b></td>
<td>$INPUT{Email}</td>
</tr>
<tr>
<td><b>Password</b></td>
<td>$INPUT{Password}</td>
</tr>
</table>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;With your newly created MuncieMLS.com MyHomes Account Center, you have access to all residential, commercial, investment, and land for sale currently listed within the cooperating brokers of the Mid-Eastern Indiana Association Of REALTORS IDX exchange program!  You may also save searches and receive daily email notifications of new or updated listings that meet your saved search criteria.  If you find a certain property and you wish to keep it to view it at later you can save it directly into your MyHomes account and even create a note for later reference!<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RE/MAX Real Estate Groups Muncie and The ORR Home Selling Team look forward to serving you.    If at anytime you have questions or comments regarding the use of MuncieMLS.com please email ryan\@orrhomes.com.<br><br><br>
</font>
</td>
</tr>
</table>
<img src="http://www.ORRHomes.com/images/emailfooter.gif"><br><br><br>
</td>
</tr>
</table>
</center>
</body>
</html>
~;

######## RECORD COPY OF EMAIL IN DATABASE #################
@evariables = ("$thelastnumber","ryan\@orrhomes.com","Registration -> $new_firstname, Welcome To MuncieMLS.com!","$send_body");
$esql_query = "INSERT INTO emailstousers values ('',?,now(),?,?,?)";
my $zzaasth = $dbh->do($esql_query, undef, @evariables);
###########################################################

print "Set-cookie: userid=$thelastnumber\-$INPUT{Email}\n";
print "Content-type: text/html\n\n";
if ($INPUT{referrer}) {
print qq~
<html><head><title>Logging in...</title>
<meta http-equiv="Refresh" content="2; URL=http://$INPUT{referrer}.MuncieMLS.com">
</head>
<body>
<br><br><br><center><font face=verdana size=4>Logging in...</font><br><font face=Tahoma size=2>If you are not redirected in 5 seconds, <a href="myhomes.idx">click here</a>.
~;
}
else {
print qq~
<html><head><title>Logging in...</title>
<meta http-equiv="Refresh" content="2; URL=http://www.MuncieMLS.com/myhomes.idx">
</head>
<body>
<br><br><br><center><font face=verdana size=4>Logging in...</font><br><font face=Tahoma size=2>If you are not redirected in 5 seconds, <a href="myhomes.idx">click here</a>.
~;
}
$dbh->disconnect();

}


sub main {

if ($INPUT{FoundBy}) {
$buildFoundBy = "<option value=\"$INPUT{FoundBy}\">$INPUT{FoundBy}</option>";
}

if ($INPUT{UserType}) {
$buildUserType = "<option value=\"$INPUT{UserType}\">$INPUT{UserType}</option>";
}

if ($INPUT{Accepted}) {
$buildAccepted = " checked";
}

if ($INPUT{TimeToMove}) {
$buildTimeToMove = "<option value=\"$INPUT{TimeToMove}\">$INPUT{TimeToMove}</option>";
}

unless ($INPUT{State}) {
$getstateselected = "selected";
}

if ($INPUT{State}) {
$getstate = "<option value=\"$INPUT{State}\" selected>$INPUT{State}</option>";
}

if ($INPUT{realtor} eq "Yes") {
$checkYesrealtor = " checked";
}
else {
$checkNorealtor = " checked";
}


unless ($INPUT{myERAAgent} ne "") {
$checkYesrealtor = " checked";
}

if ($INPUT{email_block} eq "Yes") {
$checkYesemail_block = " checked";
}
else {
$checkNoemail_block = " checked";
}

if ($INPUT{email_openhouses} eq "Yes") {
$checkYesemail_openhouses = " checked";
}
else {
$checkNoemail_openhouses = " checked";
}

if ($INPUT{myERAAgent}) {
$buildmyERAAgent = "<option value=\"$INPUT{myERAAgent}\">$INPUT{myERAAgent}</option>";
}

print "Content-type: text/html\n\n";

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 $zasth = $dbh->prepare("select mlsid,firstname,lastname from agents where display = '1' order by lastname asc");
$zasth->execute;
while (($mlsid,$firstname,$lastname) = $zasth->fetchrow_array()) {
$agentbuildlist .= "<option value=\"$mlsid\">$lastname, $firstname</option>\n";
}


print qq~
<html>
<head>
<title>Muncie Real Estate Agents The ORR Home Selling Team, Muncie Homes For Sale, REALTORS and Muncie  Patrick Orr, Ryan Orr</title>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="description" CONTENT="Muncie Real Estate, real estate agents agent listings Muncie Indiana IN REALTOR REALTORS Ball State University, Campus, realty mls homes for sale home values appraisals new houses moving relocating mortgage real estate agents agent listings REALTOR REALTORS realty mls homes for sale home values appraisals new houses Muncie MLS Property Search Throughout East Central Indiana.  Albany, Eaton, Muncie, New Castle, Yorktown, Gaston, Redkey, Dunkirk, Parker City, Farmland, Selma, Hartford City, Cowan, Daleville, Chesterfield.  estate homes, fine homes, multi-million dollar estate homes, for sale, sale, buy, buyers, condominiums, townhomes, single story homes, two story homes, RV access, pool homes, golf course view, city lights view, neighborhood, single family residence, view homes, duplex, duplexes, split levels, ranch style homes, multi-million dollar estates, foreclosure, reo, repo, bank repo, short sales, fixer, property, Realtor, Realtors, Looking to browse homes throughout east central indiana or contact an agent?">
<meta name="keywords" content="Muncie Indiana Real Estate, Albany Indiana Real Estate, Muncie Property Search, Albany Property Search, Muncie Auction, Muncie Homes - Residential, Commercial, Investment, Lots & Land, Muncie Relocation, Muncie Homes, Muncie Real Estate, auction services, auction">
<META name="robots" content="index,follow">
<META NAME="revisit-after" CONTENT="30 days">
~;

&header;

print qq~
<td valign="top" width="581">
<span id=copy style="display:none;">
Muncie Relocation Homes Real Estate Ball State BSU Delaware county homebuyers land condominiums townhomes townhouses commercial Muncie MLS new construction auction services auction</span>
<script language="Javascript">
function checkMail()
{
	var x = document.registerform.Email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+/;
	if (filter.test(x));
	else alert('Sorry! You have entered an invalid email address!  Please check your email address  (Example: Username\@aol.com)');
}
</script>
<table border="0" cellpadding="0" cellspacing="0" width="581">
<tr>
<td colspan="2">
<img src="images/headers/register.gif" height="33" width="581" alt="Register For A FREE MyHomes Account"><Br>
</td>
</tr>
</table>

<table border="0" cellpadding="3" width="581" cellspacing="0">
<tr>
<td valign="top" width="100%">
<center><img src="images/register_top.gif"><a href="myhomes.idx"><img src="images/register_login.gif" border="0"></a></center><br>
<font size="2"><b>Just fill out the following form to become INSTANTLY registered!<br></b></font>
</font>
</td>
</tr>
<tr>
<td valign="top" width="100%">
		<form name="registerform" method="post" action="register.idx">
		<input type=hidden name=action value=register>
		<input type=hidden name=referrer value=$INPUT{referrer}>
		<input type="hidden" name="myERAAgent" value="122">
		<table border="0" cellspacing="0" cellpadding="0" width="100%">
		<tr>
		<td>
			<table border="0" cellpadding="3" cellspacing="0" width="100%">
				<tr>
					<td colspan="2" valign="top">
						<table border="0" cellpadding="3" cellspacing="1" width="100%" bgcolor="#000066">
						<tr>
						<td valign="top" bgcolor="#C6E1FC">
						<center><font color="red" size="1"><b>$checkaccept $messagewindow</b></font></center>
						<center>
						<label for="Accepted"><input id="Accepted" type="checkbox" name="Accepted"$buildAccepted>  <b><u>I have read and agree to the MuncieMLS.com</u></label> <a href="javascript:save=window.open('terms_popup.html','save','width=320, height=325, scrollbars=yes'); save.focus();">Terms And Conditions</a></b></center></td>
						</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td width="50%"><font size="2"><b>Please tell us how you found MuncieMLS.com</b></font></td>
					<td width="50%">
						<select name="FoundBy" class="search_form">
						$buildFoundBy
						<option value="">-- Choose One --</option>
						<option value="Business Card">Business Card</option>
						<option value="Homes and Lifestyles Magazine">Homes and Lifestyles Magazine</option>
						<option value="REALTOR Recommendation">REALTOR Recommendation</option>
						<option value="The Star Press">The Star Press</option>
						<option value="Emerald Pointe">Emerlad Pointe</option>
						<option value="Quincy Place">Quincy Place</option>
						<option value="Search Engine - Google">Search Engine - Google</option>
						<option value="Search Engine - MSN">Search Engine - MSN</option>
						<option value="Search Engine - Yahoo">Search Engine - Yahoo</option>
						<option value="Search Engine - AOL">Search Engine - AOL</option>
						<option value="Search Engine - Other">Search Engine - Other</option>
						<option value="Other Website">Other Website</option>
						</select> 
					</td>
				</tr>
				<tr>
					<td width="50%" bgcolor="#FFFF99">
						<font size="2"><b>I Am A
					</td>
					<td width="50%" bgcolor="#FFFF99">
							<select name="UserType" class="search_form">
							$buildUserType
							<option value="">-- Choose Type --</option>
							<option value="Buyer">Buyer</option>
							<option value="Seller">Seller</option>
							<option value="Seller & Buyer">Seller & Buyer</option>
							<option value="Investor">Investor</option>
							<option value="Real Estate Agent">Real Estate Agent</option>
							<option value="Real Estate Professional">Real Estate Professional</option>
						</select>$checkUserType
 					</td>
				</tr>
				<tr>
					<td><font size="2"><b>First Name</b></font></td><td><input type="text" name="FirstName" value="$INPUT{FirstName}" class="search_form">$checkFirstName</td>
				</tr>
				<tr>
					<td bgcolor="#FFFF99"><font size="2"><b>Last Name</b></font></td><td bgcolor="#FFFF99"><input type="text" name="LastName" value="$INPUT{LastName}" class="search_form">$checkLastName</td>
				</tr>
				<tr>
					<td><font size="2"><b>Phone Number</b></font></td><td bgcolor=""><input type="text" name="Phone" value="$INPUT{Phone}" class="search_form"></td>
				</tr>
				<tr>
					<td bgcolor="#FFFF99"><font size="2"><b>Email</b></font><br>ORRHomes will automatically communicate with your email system to verify your email address is valid.</td><td bgcolor="#FFFF99"><input type="text" name="Email" size="30" onFocusOut="javascript:checkMail();" value="$INPUT{Email}" class="search_form">$checkEmail</td>
				</tr>
				<tr>
					<td><font size="2"><b>Password</b></font></td><td bgcolor=""><input type="password" name="Password" value="$INPUT{Password}" class="search_form">$checkPassword</td>
				</tr>
				<tr>
					<td bgcolor="#FFFF99"><font size="2"><b>Address</b></font></td><td bgcolor="#FFFF99"><input type="text" name="Address" value="$INPUT{Address}" class="search_form"></td>
				</tr>
				<tr>
					<td><font size="2"><b>City</b></font></td><td bgcolor=""><input type="text" name="City" value="$INPUT{City}" class="search_form"></td>
				</tr>
				<tr>
					<td bgcolor="#FFFF99"><font size="2"><b>State</b></font></td><td bgcolor="#FFFF99">
				<select name="State" class="search_form">
$getstate
<option value="">-- Choose One --</option>
<option value="Alabama">Alabama</option>
<option value="Alaska">Alaska</option>
<option value="Arizona">Arizona</option>
<option value="Arkansas">Arkansas</option>
<option value="California">California</option>
<option value="Colorado">Colorado</option> 
<option value="Connecticut">Connecticut</option>
<option value="Delaware">Delaware</option>
<option value="District of Columbia">District of Columbia</option>
<option value="Florida">Florida</option>
<option value="Georgia">Georgia</option>
<option value="Hawaii">Hawaii</option>
<option value="Idaho">Idaho</option>
<option value="Illinois">Illinois</option>
<option value="Indiana" $getstateselected>Indiana</option>
<option value="Iowa">Iowa</option>
<option value="Kansas">Kansas</option>
<option value="Kentucky">Kentucky</option>
<option value="Louisiana">Louisiana</option>
<option value="Maine">Maine</option>
<option value="Maryland">Maryland</option>
<option value="Massachusetts">Massachusetts</option>
<option value="Michigan">Michigan</option>
<option value="Minnesota">Minnesota</option>
<option value="Mississippi">Mississippi</option>
<option value="Missouri">Missouri</option>
<option value="Montana">Montana</option>
<option value="Nebraska">Nebraska</option>
<option value="Nevada">Nevada</option>
<option value="New Hampshire">New Hampshire</option>
<option value="New Jersey">New Jersey</option>
<option value="New Mexico">New Mexico</option>
<option value="New York">New York</option>
<option value="North Carolina">North Carolina</option>
<option value="North Dakota">North Dakota</option>
<option value="Ohio">Ohio</option>
<option value="Oklahoma">Oklahoma</option>
<option value="Oregon">Oregon</option>
<option value="Pennsylvania">Pennsylvania</option>
<option value="Rhode Island">Rhode Island</option>
<option value="South Carolina">South Carolina</option>
<option value="South Dakota">South Dakota</option>
<option value="Tennessee">Tennessee</option>
<option value="Texas">Texas</option>
<option value="Utah">Utah</option>
<option value="Vermont">Vermont</option>
<option value="Virgin Islands">Virgin Islands</option>
<option value="Virginia">Virginia</option>
<option value="Washington">Washington</option>
<option value="West Virginia">West Virginia</option>
<option value="Wisconsin">Wisconsin</option>
<option value="Wyoming">Wyoming</option></select><br>
					</td>
				</tr>
				<tr>
					<td><font size="2"><b>Zip Code</b></font></td><td><input type="text" name="Zip" value="$INPUT{Zip}" class="search_form"></td>
				</tr>
				<tr>
					<td bgcolor="#FFFF99"><font size="2"><b>What Is Your Time Frame For Your Next Real Estate Transaction?</b></font></td>
					<td bgcolor="#FFFF99">
						<select name="TimeToMove" class="search_form">
						$buildTimeToMove
						<option value="Immediately">Immediately</option>
						<option value="1-2Months">1 - 2 Months</option>
						<option value="3-4Months">3 - 4 Months</option>
						<option value="5-6Months">5 - 6 Months</option>
						<option value="6-1YrMonths">6 Months - 1 Year</option>
						<option value="1YrUp">1 Year or Longer</option>
						</select>
					</td>
				</tr>
				<tr>
					<td><font size="2"><b>Could we remind you when new open houses are posted on our website?</b></font></td>
					<td><input type="radio" value="y" Name="email_openhouses" checked> Yes  	<input type="radio" value="n" Name="email_openhouses"> No$checkemail_openhouses<br>
				</td>
				</tr>
				<tr>
					<td colspan="2"><center><br><input type=submit value="Complete Registration"></center></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
		</form>
		</td>
	</tr>
</table>
</td>
</tr>
</table>
~;


&footer;

}



