#!/perl64/bin
# Get the environment variables passe to the script
use CGI qw/:standard :html3 :netscape/;
use Win32::ODBC;
use CGI::Cookie;
use Env;
use Net::SMTP;
use Net::Config;
$query = new CGI;
$featured = "40562913";
$User_ID = "Guest";
$city_str = "Pleasanton";
$s_community = $city_str;
#$sqft_str = "3000";
$s_mtype = "Map";
$sld = "off";
$WC='off';
$soldd = "20120101";
@community = ('All','Danville','Diablo','San Ramon','Blackhawk','Alamo','Dublin','Pleasanton','Walnut Creek','Rossmoor','Lafayette','Livermore','Tracy','Castro Valley');
######## Read the cookie information ###############
$ID = $query->cookie('Page-Access');
$User_ID = $query->cookie('User-Session-ID');
#$User_ID = @User_STR;
@User_Vals = split(/;/, $User_ID);
@User_IDs = split(/=/,$User_Vals[0]);
$User_ID = $User_IDs[1];
set_cookie($ID);
if ($ENV{QUERY_STRING} eq "") {} else { set_search();}
@favorites=(40509408,40526932,40540700,40544185);
@recents=(40561702,40561762,40562172);
@map_props=();
$fav_Count = @favorites;
$rec_count = @recents;
$RHost = $ENV{$REMOTE_HOST};
$RAddr = $ENV{$REMOTE_ADDR};
$Host = $ENV{$HTTP_HOST};
@values = split(/:/, $ENV{QUERY_STRING});
################## Read the cookie information for the last search page refered to see if the request came from a serahc query ###############
$SRC_ID = $query->cookie('Last-Search');
if ($ENV{QUERY_STRING} eq "") { $SearchSTR = $SRC_ID; } else { $SearchSTR = $ENV{QUERY_STRING}; }
#@FormValues = split(/&/, $ENV{QUERY_STRING});
@FormValues = split(/&/, $SearchSTR);
$FV1 = @FormValues;
$MList="n";
for ($x=0;$x<=$FV1-1;$x++) {
@Attributes = split(/=/,$FormValues[$x]);
if ($Attributes[0] eq "Community") {
$city_str=$Attributes[1];
$city_str =~ tr/+/ /;
$city_str =~ s/%([1-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$s_community=$city_str;
}
if ($Attributes[0] eq "SqFt") {
$sqft_str=$Attributes[1];
}
if ($Attributes[0] eq "MinPrice") { $s_minprice=$Attributes[1]; $s_minprice =~ tr/+/ /; $s_minprice =~ s/%([1-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;}
if ($Attributes[0] eq "Sold") { $sld=$Attributes[1];}
if ($Attributes[0] eq "WC") { $WC=$Attributes[1];}
if ($Attributes[0] eq "MList") {
$MList = "y";
$MListID=$Attributes[1];
@MIDS = split(/:/, $MListID);
$mcount = @MIDS;
}
}
if ($s_minprice eq "Any") { $minprice = 0; } else { $minprice = $s_minprice; }
#### Initialize the Search Arrays
getmlsdate();
printheader();
place_heading();
make_menu();
build_map();
build_sidebar();
printending();
exit(0);
###############################################################################################
### Setup and Ending ROutines for Header and Footer- Header could be unique to the page i.e. maps
###############################################################################################
sub printheader {
$title = "AgentRobin.com - Real Estate Source for Danville, San Ramon, Alamo, Pleasanton, Dublin and Walnut Creek";
$description = "AgentRobin Tri-valley Real Estate";
print "\n\n <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
# print "Content-type: content='text/html; charset=utf-8'\n\n"
print "<HTML xmlns='http://www.w3.org/1999/xhtml'>\n";
print "<HEAD>\n";
$DefaultMetaDesciption= "Homes for Sale in Danville, San Ramon, Blackhawk, Alamo, Walnut Creek, Pleasanton and Dublin, CA";
$title = "San Ramon Valley Real Estate and Homes Sales";
print "<TITLE>$title</title>\n";
# print "<script src=\"http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAASkFux1vu2CL12cfQRPzhaxTQDHf3fRnwNjZr31Uuu6mHpv_Z1xQcDuycguTOaEUUoU-7Z6FqKryXxQ\" type=\"text/javascript\"></script>\n";
print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
print "<meta name=\"description\" content=\"$DefaultMetaDescription\">\n";
print "<meta name=\"keywords\" content=\"$DefaultMetaKeywords $didit11\">\n";
print "<meta http-equiv='X-UA-Compatible' content='IE=edge' />\n";
print "<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />\n";
#### HORIZONTAL MENU FUNCTIONS
print "<link type='text/css' href='Default_files/AgentRobin_CSS.css' rel='stylesheet'>\n";
print "<link rel='stylesheet' type='text/css' href='http://www.agentrobin.com/css/Prop_menu_cma.css'/>\n";
print "<!--[START-LJ]--><script type='text/javascript' src='http://www.agentrobin.com/scripts/AR_Menu.js'></script><!--[END-LJ]-->\n";
#### INITALIZE BING MAP FUNCTIONS
print "<script type='text/javascript' src='http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0'></script>\n";
print "<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js' type='text/javascript'></script>\n";
print "<script src='js/jquery.ui.widget.js' type='text/javascript'></script>\n";
put_map_script();
print "</head>\n";
print "<body onload=\"InitiateMap();\">\n";
}
###############################################################################################
### Makes the Agent Robin Main Banner and Logo (Not the drop down menu)
###############################################################################################
sub place_heading() {
$bimage = "Maroon1.png";
# $bimage = "bluebanner.png";
print "<DIV style=\"position: absolute; left: 0px; top: 0px; width: 100%; height: 80px; border: 1px solid black; float: right;\">\n";
# print " <IMG BORDER=0 SRC='http://www.agentrobin.com/Img/$bimage' WIDTH=100% HEIGHT=100%>\n";
print " <DIV style='position: absolute; left: 0px; top: 0px;'>\n";
print " <IMG BORDER=0 SRC='http://www.agentrobin.com/Img/ArLogo.jpg'>\n";
print " </DIV>\n";
# if ($auth_status eq "yes") {
# print " <DIV style='position: absolute; left: 800px; top: 10px;'>\n";
# print " <IMG BORDER=0 SRC='http://www.agentrobin.com/Img/vip_signup_back.png'>\n";
# print " </DIV>\n";
# } else {
# print " <DIV style='position: absolute; left: 800px; top: 14px;'>\n";
# print " <IMG BORDER=0 SRC='http://www.agentrobin.com/Img/guest_signup_back.png'>\n";
# print " </DIV>\n";
# }
# print " <DIV style='position: absolute; left: 865px; top: 18px;'>\n";
# print " <SPAN style='font-family: Segoe UI; font-size: .8em; color: rgb(255,255,255);'>$User_ID</SPAN>\n";
# print " </DIV>\n";
print " <DIV style='position: absolute; left: 565px; top: 24px;'>\n";
print " <SPAN style='font-family: Segoe UI; font-size: 1.3em; color: rgb(255,255,255);'>COMPARATIVE MARKET ANALYSIS (CMA)</SPAN>\n";
print " </DIV>\n";
# if ($auth_status eq "yes") {
# print " <DIV style='position: absolute; left: 860px; top: 50px;'>\n";
# print " <SPAN style='font-family: Segoe UI; font-size: .7em; color: rgb(255,255,255);'>Logout</SPAN>\n";
# print " </DIV>\n";
# } else {
# print " <DIV style='position: absolute; left: 860px; top: 50px;'>\n";
# print " <SPAN style='font-family: Segoe UI; font-size: .7em; color: rgb(255,255,255);'>Login</SPAN><SPAN style='font-family: Segoe UI; font-size: .7em; color: rgb(255,255,255);'>VIP Sign Up (What's this?)</SPAN>\n";
# print " </DIV>\n";
# }
print " <DIV style='position: absolute; left: 128px; top: 1px;'><SPAN style='font-family: century; font-size: 1.8em; color: rgb(188,161,154);'> AgentRobin.com</SPAN></DIV>\n";
print " <DIV style='position: absolute; left: 130px; top: 40px;'><SPAN style='font-family: Segoe UI; font-size: 1.2em; color: rgb(255,255,255);'>San Ramon Valley Real Estate</SPAN></DIV>\n";
print "</DIV>\n";
}
###############################################################################################
### Builds the Main Page: FORM submission and
###############################################################################################
sub make_menu() {
#### This is the top horizontal Menu Code
print " <div style=\"position: absolute; top: 83px; left:0px; width: 1425px; height: 33px; z-index:100000; border: 0px solid black; text-align: right; padding: 0px;\">\n";
print " <div style=\"position: absolute; top: -1px; left:0px; width: 1425px; height: 25px; z-index:101000; border: 0px solid black; text-align: right; padding: 0px;\">\n";
print "<FORM Name=CMASubmit Action='http://www.AgentRobin.com/cma.pl'>\n";
print " <div style=\"position: absolute; top: 10px; left:0px; width: 50px; height: 25px; z-index:100000; border: 0px solid black; text-align: left; padding: 0px;\"><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>CITY</SPAN></DIV>\n";
print " <div style=\"position: absolute; top: 10px; left:205px; width: 50px; height: 25px; z-index:100000; border: 0px solid black; text-align: left; padding: 0px;\"><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>SqFt</SPAN></DIV>\n";
print " <div style=\"position: absolute; top: 10px; left:390px; width: 50px; height: 25px; z-index:100000; border: 0px solid black; text-align: left; padding: 0px;\"><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>Price</SPAN></DIV>\n";
print " <DIV style='position: absolute; left: 50px; top: 10px; width: 65px; height: 20px; border-style: solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN class='searchfont'>\n";
print " <SELECT Name=Community>\n";
$pcount1 = @community;
for ($x=0;$x<=$pcount1-1; $x++) {
if ($s_community eq $community[$x]) {
print " <OPTION Value='$community[$x]' SELECTED>$community[$x]</OPTION>\n";
} else {
print " <OPTION Value='$community[$x]'>$community[$x]</OPTION>\n";
}
}
print " </SELECT>\n";
print "</DIV>\n";
print " <DIV style='position: absolute; left: 250px; top: 10px; width: 40px; height: 20px; border-style: solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>\n";
print " <INPUT Type=Text Name=SqFt Value='$sqft_str' SIZE=12>\n";
print "</DIV>\n";
print " <DIV style='position: absolute; left: 435px; top: 10px; width: 115px; height: 20px; border-style:solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN class='searchfont'>\n";
print " <SELECT Name=MinPrice>\n";
print " <OPTION>Any</OPTION>\n";
$pcount2 = 20;
$sprice = 100000;
for ($x=0;$x<=$pcount2-1; $x++) {
if ($s_minprice eq $sprice) {
print " <OPTION Value='$sprice' SELECTED><SPAN style='font-family: cordiaUPC,sans-serif; font-size: .8em; color: rgb(0,0,0); font-weight: normal;'>$sprice</SPAN></OPTION>\n";
} else {
print " <OPTION Value='$sprice'><SPAN style='font-family: cordiaUPC,sans-serif; font-size: .8em; color: rgb(0,0,0); font-weight: normal;'>$sprice</SPAN></OPTION>\n";
}
$sprice=$sprice+100000;
}
print " <OPTION>2000000+</OPTION>\n";
print " </SELECT>\n";
print "</DIV>\n";
print " <DIV style='position: absolute; left: 740px; top: 10px; width: 115px; height: 20px; border-style: solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>\n";
print " <INPUT Type=Submit Name=Submit>\n";
print "</DIV>\n";
print " <DIV style='position: absolute; left: 530px; top: 10px; width: 115px; height: 20px; border-style: solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>\n";
if ($sld eq "off") { print " <INPUT Type=checkbox Name=Sold> SOLD\n"; } else { print " <INPUT Type=checkbox Name=Sold checked> SOLD\n"; }
print "</DIV>\n";
print " <DIV style='position: absolute; left: 610px; top: 10px; width: 115px; height: 20px; border-style: solid; border-width: 0px; text-align: left; vertical-align: top;'><SPAN style='font-family: Segoe UI; font-size: 1em; color: rgb(255,255,255);'>\n";
if ($WC eq "off") { print " <INPUT Type=checkbox Name=WC> WC/EXPR\n"; } else { print " <INPUT Type=checkbox Name=WC checked> WC/EXPR\n"; }
print "</DIV>\n";
## insert_hor_menu();
print "</FORM>\n";
print " </div>\n";
print " </div>\n";
}
###############################################################################################
### Builds the Map DIV - Sometimes over legend as well
###############################################################################################
sub build_map() {
print " <DIV id=\"MapDiv\" style='position: absolute; left: 270px; top: 130px; width: 100%; height: 900px; border-style:solid; border-width: 1px;'>\n";
print " </DIV>\n";
#### Legend if necessary #####
#print "$SQL";
}
###############################################################################################
### prints the ending HTML for the Page
###############################################################################################
sub printending {
print "</body>\n";
print "</html>\n";
}
sub build_srch_string() {
if ($sqft_str eq "") {
$sqlow=0;
$sqhigh = 9000;
} else {
$sqlow = int($sqft_str * .90);
$sqhigh = int($sqft_str * 1.10);
}
$o_by = "ORDER BY Price DESC";
$s_str1 = "(Area='$city_str')";
$s_str2 =" AND (Status='ACTV' OR Status='BOMK' OR Status='New' OR Status='PCH')";
$s_str3 =" AND (BuildingType='Detached' OR BuildingType='Condo' OR BuildingType='Townhouse' OR BuildingType='Duet' OR BuildingType='Patio Home')";
$s_str4 =" AND (Price > $minprice)";
$s_str7 =" AND (SqFt > '$sqlow' AND SqFt < '$sqhigh')";
if ($s_community eq "All") { $s_str1 = "(Area='Danville' OR Area='San Ramon' OR Area='Dublin' OR Area='Blackhawk' OR Area='Alamo' OR Area='Pleasanton' OR Area='Walnut Creek' OR Area='Rossmoor' OR Area='Diablo' OR Area='Lafayette' OR Area='Livermore' OR Area='Tracy' OR Area='Castro Valley')"; }
if ($sld eq "off" && $WC eq "off") { $s_str2 = " AND (Status='ACTV' OR Status='BOMK' OR Status='New' OR Status='PCH')"; }
if ($sld eq "on" && $WC eq "off") { $s_str2 = " AND (Status='SLD') AND (SoldDate > '$soldd') "; }
if ($sld eq "off" && $WC eq "on") { $s_str2 = " AND (Status='WC' OR Status='EXPR' OR Status='WT') AND (SoldDate > '$soldd') "; }
if ($sld eq "on" && $WC eq "on") { $s_str2 = " AND (((Status='WC' OR Status='EXPR' OR Status='WT') AND (OffMarketDate > '2012-03-01')) OR (Status='SLD' AND SoldDate > '$soldd')) "; }
if ($type_str eq "Detached") { $s_str3 = " AND (BuildingType='Detached')"; }
if ($type_str eq "Condo") { $s_str3 = " AND (BuildingType='Condo' OR BuildingType='Townhouse' OR BuildingType='Duet' OR BuildingType='Patio Home')"; }
$SQL = "SELECT * FROM PropMLS WHERE $s_str1 $s_str2 $s_str3 $s_str4 $s_str5 $s_str7 ORDER BY Price";
}
#############################################################################################
### Common Routines to build the header and menu structure
### This should be the same in every routine which is called
#############################################################################################
sub insert_hor_menu() {
print "<!-- QuickMenu Structure [Menu 0] -->
<ul id=\"qm0\" class=\"qmmc\">
<li><a class=\"qmparent\" href=\"http://www.agentrobin.com/home.pl\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>home</SPAN></a>
<ul>
<li><a href=\"http://www.agentrobin.com/home.pl\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>AGENT ROBIN HOME</a></li>
<li><a class=\"qmparent\" href=\"http://www.AgentRobin.com/Home.pl?MF=10\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>SITE MAP</a></li>
# <li><span class=\"qmdivider qmdividerx\" ></span></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>CONTACT ME</a>
<ul>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Send me an E-Mail</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Call me at (925) 212-2446</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Fax: (925) XXX-XXXX</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Ask Me a Question</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Request More Information</a></li>
</ul></li>
<li><span class=\"qmdivider qmdividerx\" ></span></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>ABOUT ME</a>
<ul>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Biography</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Client Testimonials</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>On LinkedIn</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>On Trulia</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>On WordPress</a></li>
</ul></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>MY PORTFOLIO</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>CAREERS @ Keller Williams</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"http://www.AgentRobin.com/PSearch.pl\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>properties</SPAN></a>
<ul>
<li><a href=\"http://www.AgentRobin.com/PSearch.pl\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>PROPERTY SEARCH</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>COMMUNITIES</a></li>
<li><a href=\"http://www.agentrobin.com/investment.pl\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>INVESTMENT PROPERTIES</a></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>QUICK SEARCH</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>New Listings</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Foreclosures</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Short Sales</a></li>
</ul></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>services</SPAN></a>
<ul>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>FOR BUYERS</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Exclusive Buyer Agent</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Home Buyer Process</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Market Reports</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>FOR SELLERS</SPAN></a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Listing Your Home</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>What's my home worth</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>FOR INVESTORS</SPAN></a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Investment Property Search</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Exclusive Investment Report</a></li>
</ul></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>QUICK QUESTIONAIRE</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>videos</SPAN></a>
<ul>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>ALL VIDEOS</a></li>
<li><a class=\"qmparent\" href=\"http://www.AgentRobin.com/Home.pl?Vid=1000000\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>BUYER</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Home Buying Process</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Loan Pre-approval</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Inspections</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>SELLER</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Listing Your Home</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Agency Agreement</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Preparing to Sell Your Home</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Contingencies</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>FINANCIAL</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Loan Process</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Short Sale</a></li>
</ul></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>GENERAL</a></li>
<li><a href=\"javascript:void(0)\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>AGENT ROBIN's CORNER</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>tools</SPAN></a>
<ul>
<li><a href=\"javascript:void(0);\" title=\"Home Affordability Calculator\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Calculator</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Amortization Schedule</a></li>
<li><a class=\"qmparent\" href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Links</a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>School District Information</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>City Live</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Real Estate Reports</a></li>
</ul></li>
<li><span class=\"qmdivider qmdividerx\" ></span></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Professional Referal Services</a></li>
</ul></li>
<li><a class=\"qmparent\" href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .9em;'>myAgent</SPAN></a>
<ul>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>Login</a></li>
<li><a href=\"javascript:void(0);\"><SPAN style='font-family: Segoe UI; font-size: .7em;'>What's This?</a></li>
</ul></li>
<li class=\"qmclear\"> </li></ul>
<!-- Create Menu Settings: (Menu ID, Is Vertical, Show Timer, Hide Timer, On Click (options: 'all' * 'all-always-open' * 'main' * 'lev2'), Right to Left, Horizontal Subs, Flush Left, Flush Top) -->
<script type=\"text/javascript\">qm_create(0,false,0,500,false,false,false,false,false);</script><!--[END-QM0]-->
";
}
sub set_cookie() {
##### Set the cookie
$CCount = @_[0];
$CCount++;
$cookie1 = new CGI::Cookie(-name => 'User-Session-ID',
-value => 'USER=dobrooks@microsoft.com;Pref=5',
-expires => '+3M',
-domain => '.agentrobin.com',
-path => '/',
-secure => 0
);
print "Set-Cookie: $cookie1;\n";
$cookie1 = new CGI::Cookie(-name => 'Page-Access',
-value => $CCount,
-expires => '+3M',
-domain => '.agentrobin.com',
-path => '/',
-secure => 0
);
print "Set-Cookie: $cookie1;\n";
}
sub set_search() {
$cookie1 = new CGI::Cookie(-name => 'Last-Search',
-value => $ENV{'QUERY_STRING'},
-expires => '+3M',
-domain => '.agentrobin.com',
-path => '/',
-secure => 0
);
print "Set-Cookie: $cookie1;\n";
}
sub authorize_user() {
$eid = lc($User_ID);
$SQL ="SELECT * FROM FContacts WHERE email='$eid'";
# fetch and display data, ensure user has requested some rows
$db=new Win32::ODBC("DSN=YFDH;UID=aglogin;PWD=J0shKr1s"); #New instance
if (! $db){
print "Error opening data source $DSN $db";
exit(0);
}
# Use $rc to check if we could query the database and $db to hold the SQL results
$rc=$db->Sql($SQL); #execute SQL query
if ($rc){
$db->Close();
print "Error $rc getting INFO from table $OPTable in First Iteration";
exit(0);
}
$db->FetchRow();
@data=$db->Data();
if ($data[0] eq "") { $auth_status = 'no'; } else { $auth_status = 'yes'; }
$db->Close();
}
############################
## MLS Updated INformations
############################
sub getmlsdate() {
$SQLMLS="SELECT * FROM Dates WHERE [Key]='1'";
# fetch and display data, ensure user has requested some rows
$dbs=new Win32::ODBC("DSN=YFDH;UID=aglogin;PWD=J0shKr1s"); #New instance
if (! $dbs){
print "Error opening data source $db";
$dbs->close();
exit(0);
}
# Use $rc to check if we could query the database and $db to hold the SQL results
$rcs=$dbs->Sql($SQLMLS);
$position = 1;
$rcount=0;
$dbs->FetchRow();
@data=$dbs->Data();
$mlsupdated = $data[1];
$dbs->Close();
}
sub mlsstatus(){
if ($_[0] eq "map") { $ztop = "712px"; } else { $ztop = "680px"; }
print "<div style=\"position: absolute;top: $ztop;left: 270px;width: 650px;height:32px;border: 0px black solid; text-align: center;\">\n";
print "<div style=\"position: absolute; top: 1px; left: 1px; width: 200px;height:20px; border: 0px black solid; text-align: left;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: left;\">MLS Information provided by..</SPAN></div>\n";
print "<div style=\"position: absolute; top: 1px;left: 440px; width: 200px;height:20px; border: 0px black solid; text-align: left;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: right;\">Updated: $mlsupdated</SPAN></div>\n";
print "<div style=\"position: absolute; top: 1px; left: 210px; width: 200px;height:20px; border: 0px black solid; text-align: center;\"><IMG SRC=\"http://www.agentrobin.com/images/bayeast1.jpg\"></div>\n";
print "</div>\n";
}
sub put_map_script() {
$mapcx="37.81873440"; $mapcy="-121.99699401"; $i_zoom="13";
if ($s_community eq "All") { $mapcx="37.81873440"; $mapcy="-121.99699401"; $i_zoom="10"; }
if ($s_community eq "Danville") { $mapcx="37.79265055620592"; $mapcy="-121.92132150985717";}
if ($s_community eq "Pleasanton") { $mapcx="37.644749"; $mapcy="-121.82616754"; }
if ($s_community eq "San Ramon") { $mapcx="37.737308544142205"; $mapcy="-121.90685976364135"; }
if ($s_community eq "Dublin") { $mapcx="37.67415608306407"; $mapcy="-121.87475908615111"; }
if ($s_community eq "Blackhawk") { $mapcx="37.80557957"; $mapcy="-121.906013488"; }
if ($s_community eq "Alamo") { $mapcx="37.824291462"; $mapcy="-121.950038215"; }
if ($s_community eq "Walnut Creek") { $mapcx="37.880411590"; $mapcy="-121.9904351425"; }
if ($s_community eq "Lafayette") { $mapcx="37.86411590"; $mapcy="-122.04351425"; }
if ($s_community eq "Livermore") { $mapcx="37.6701"; $mapcy="-121.6904279425"; }
if ($s_community eq "Tracy") { $mapcx="37.707704"; $mapcy="-121.38968"; }
if ($s_community eq "Castro Valley") { $mapcx="37.67988"; $mapcy="-122.007925"; }
build_srch_string();
print "
<script type=\"text/javascript\">
var map = null;
var pins = null;
var i = null;
var boxes = new Array();
var mapOptions = {
credentials: \"AgIOXexuz3ScDawNnUB41FDLx7FXOKp68N4hJ68kwHBeWzbr6bP8ypQPcIlTn_BN\"
}
function InitiateMap(){
map = new Microsoft.Maps.Map(document.getElementById('MapDiv'), mapOptions);
map.setView({ zoom: $i_zoom, center: new Microsoft.Maps.Location($mapcx, $mapcy) });
AddMultiplePins();
}
function AddMultiplePins(){
pins = new Microsoft.Maps.EntityCollection();
i = 1;
";
build_pushpins();
print "
map.entities.push(pins);
}
function addPinToCollection(position, title, description, ic, vis, ul){
// PushPin
var pin = new Microsoft.Maps.Pushpin(position, {text: i.toString(), icon: ic, draggable: false});
pins.push(pin);
// InfoBox
var infoboxOptions = {
width:250,
height: 100,
title: title,
description: description,
showPointer: true,
showCloseButton: false,
zIndex: i,
offset: new Microsoft.Maps.Point(0,32),
visible: false,
showCloseButton: true
};
var myInfobox = new Microsoft.Maps.Infobox(position, infoboxOptions);
map.entities.push(myInfobox);
boxes[pin.getText()] = myInfobox;
// Event Handler
Microsoft.Maps.Events.addHandler(pin, 'click', pinMouseOver);
i++;
}
function pinMouseOver(e){
var pin = e.target;
if (pin != null){
boxes[pin.getText()].setOptions({ visible: true });
}
}
function hideInfobox(e){
var pin = e.target;
var infobox = boxes[pin.getText()];
if (pin != null){
infobox.setOptions({ visible: false });
}
}
function displayprop(e){
if (e.targetType == \"pin\") {
alert('HERE');
}
}
</script>
";
# Microsoft.Maps.Events.addHandler(pin, 'mouseover', pinMouseOver);
# Microsoft.Maps.Events.addHandler(pin, 'mouseout', hideInfobox);
}
sub build_pushpins() {
$db=new Win32::ODBC("DSN=YFDH;UID=aglogin;PWD=J0shKr1s"); #New instance
if (! $db){
print "Error opening data source $DSN $db";
exit(0);
}
# Use $rc to check if we could query the database and $db to hold the SQL results
# print "$SQL\n";
$rc=$db->Sql($SQL); #execute SQL query
if ($rc){
$db->Close();
print "Error $rc getting INFO from table $OPTable in First Iteration";
exit(0);
}
$count = 0;
$skipped=1;
while ($db->FetchRow()){
@data=$db->Data();
$pcount = $count+1;
$price = $data[4];
$lc = "loc" . $pcount;
$gpsx = $data[31];
$gpsy = $data[32];
if ($gpsx eq "" || $gpsx<32 || $gpsx > 44) { $skipped++; goto SKIPPED101; }
if ($gpsy eq "" || $gpsy<-127 || $gpsy > -117) { g$skipped++; oto SKIPPED101; }
$mprice = $data[4];
if(length($price)==6) { $nmprice = "\$ " . substr($mprice,0,3) . "," . substr($mprice,3,3); }
if(length($price)==7) { $nmprice = "\$ " . substr($mprice,0,1) . "," . substr($mprice,1,3) . "," . substr($mprice,4,3); }
## Build the string to get MLS PICTURE
$MLSIDMAP = $data[0];
$MLSPin1 = substr($MLSIDMAP, 0, 1);
$MLSPin2 = substr($MLSIDMAP, 1, 1);
$MLSPin3 = substr($MLSIDMAP, 2, 1);
$MLSPin4 = substr($MLSIDMAP, 3, 1);
$MLSPin5 = substr($MLSIDMAP, 4, 1);
$MLSPin6 = substr($MLSIDMAP, 5, 1);
$MLSPin7 = substr($MLSIDMAP, 6, 1);
$MLSPin8 = substr($MLSIDMAP, 7, 1);
$IMGURL10t = "http://ca-ccar.photos.mlsfinder.com/thumbs/" . $MLSPin1 . "/" . $MLSPin2 . "/" . $MLSPin3 . "/" . $MLSPin4 . "/" . $MLSPin5 . "/" . $MLSPin6 . "/" . $MLSPin7 . "/" . $MLSPin8 . "/" . $MLSIDMAP . "-1.jpg";
$ip_url = "http://www.AgentRobin.com/prop_display.pl?MLSID=$data[0]". "PT";
$i_title = "<DIV style=\"position: absolute; top: 2px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 9pt; font-weight: bold; color: rgb(135,0,21);\"><A HREF=\"http://www.AgentRobin.com/prop_display.pl?MLSID=$MLSIDMAP\">$data[5] ($data[9])</A></SPAN></DIV>";
$i_description0 = "<DIV style=\"position: absolute; top: 15px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 8pt; font-weight: bold; color: rgb(0,39,114);\">$data[3], CA $data[8]</SPAN></DIV>";
$i_description1 = "<DIV style=\"position: absolute; top: 28px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 7pt; font-weight: bold; color: rgb(133,133,133);\">Bedrooms: $data[11] Bathrooms: $data[12]</SPAN></DIV>";
$i_description2 = "<DIV style=\"position: absolute; top: 40px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 7pt; font-weight: bold; color: rgb(133,133,133);\">House SqFt: $data[13] Lot SqFt: $data[34]</SPAN></DIV>";
$i_description3 = "<DIV style=\"position: absolute; top: 54px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 8pt; font-weight: bold; color: rgb(133,133,133);\">$data[19]</SPAN></DIV>";
if ($sld eq "off") {
$i_description4 = "<DIV style=\"position: absolute; top: 72px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 10pt; font-weight: normal; color: rgb(133,133,133);\">$nmprice</SPAN></DIV>";
} else {
$i_description4 = "<DIV style=\"position: absolute; top: 72px; left: 5px;\"><SPAN style=\"font-family: Segoe UI; font-size: 10pt; font-weight: normal; color: rgb(133,133,133);\">$nmprice / $data[37]</SPAN></DIV>";
}
$i_description5 = "<DIV style=\"position: absolute; top: 25px; left: 160px; width: 85px; height: 66px;\"><IMG WIDTH=100% HEIGHT=100% SRC=\"$IMGURL10t\"></DIV>";
$i_description = $i_description0 . $i_description1 . $i_description2 . $i_description3 . $i_description4 . $i_description5;
if ($data[9] eq "ACTV") { $i_pin = "http://www.agentrobin.com/Img/bluepin.png"; }
if ($data[9] eq "NEW") { $i_pin = "http://www.agentrobin.com/Img/greenpin.png"; }
if ($data[9] eq "PCH") { $i_pin = "http://www.agentrobin.com/Img/goldpin.png"; }
if ($data[9] eq "BOMK") { $i_pin = "http://www.agentrobin.com/Img/purplepin.png"; }
if ($data[9] eq "SLD") { $i_pin = "http://www.agentrobin.com/Img/redpin.png"; }
if ($data[9] eq "EXPR" || $data[9] eq "WC" || $data[9] eq "WT") { $i_pin = "http://www.agentrobin.com/Img/yellowpin.png"; }
print " addPinToCollection(new Microsoft.Maps.Location($gpsx, $gpsy), '$i_title', '$i_description', '$i_pin', false, '$ip_url');\n";
push(@map_props,$data[0]);
# print " var $lc = new Microsoft.Maps.Location($gpsx, $gpsy);\n";
# print " forsale.push(new Microsoft.Maps.Pushpin($lc, {icon: '/Img/greenpin.png', width: 50, height: 50, draggable: true}))\n";
$count++;
# if ($count > 5) { goto ENDIT1; }
SKIPPED101:
}
ENDIT1:
$db->Close();
}
sub build_sidebar() {
$db=new Win32::ODBC("DSN=YFDH;UID=aglogin;PWD=J0shKr1s"); #New instance
if (! $db){
print "Error opening data source $DSN $db";
exit(0);
}
# Use $rc to check if we could query the database and $db to hold the SQL results
# print "$SQL\n";
$rc=$db->Sql($SQL); #execute SQL query
if ($rc){
$db->Close();
print "Error $rc getting INFO from table $OPTable in First Iteration";
exit(0);
}
$count = 1;
print "<div style=\"position: absolute;top: 130px;left: 0px;width: 270px;height:600px;border: 0px black solid; text-align: center; background: url('http://www.AgentRobin.com/Img/blk_over.png'); background-size: 100%; overflow: auto;\">\n";
if ($sld eq "on") {
print "<div style=\"position: absolute; top: -1px; left: -1px; width: 250px;height:20px; border: 0px black solid; text-align: center; background: black;\"><SPAN style=\"font-family: helvetica; font-size: .8em; float: middle; color: gold;\">SHOWING SOLD PROPERTIES ($skipped)</SPAN></div>\n";
} else {
print "<div style=\"position: absolute; top: -1px; left: -1px; width: 250px;height:20px; border: 0px black solid; text-align: center; background: black;\"><SPAN style=\"font-family: helvetica; font-size: .8em; float: middle; color: gold;\">SHOWING ACTIVE PROPERTIES</SPAN></div>\n";
}
$top1 = 45;
$top1px = $top1 . "px";
while ($db->FetchRow()){
@data=$db->Data();
if ($data[13] eq "") { $psqft=0; } else { $psqft = int($data[4]/$data[13]); }
$fgc = "rgb(255,255,255)";
$bgc = "rgb(0,0,0)";
if ($data[9] eq "WC" || $data[9] eq "WT") { $bgc = "rgb(255,255,0)"; $fgc="rgb(0,0,0)";}
if ($data[9] eq "SLD") { $bgc = "rgb(187,0,28)"; $fgc="rgb(255,255,255)";}
if ($data[9] eq "ACTV") { $bgc = "rgb(109,200,255)"; $fgc="rgb(0,0,0)";}
if ($data[9] eq "NEW") { $bgc = "rgb(80,168,0)"; $fgc="rgb(0,0,0)";}
if ($data[9] eq "PCH") { $bgc = "rgb(254,146,21)"; $fgc="rgb(0,0,0)";}
if ($data[9] eq "BOMK") { $bgc = "rgb(169,56,110)"; $fgc="rgb(0,0,0)";}
print "<div style=\"position: absolute; top: $top1px; left: 1px; width: 20px;height:14px; border: 0px black solid; text-align: left; background: $bgc;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: left; color: $fgc;\">$count</SPAN></div>\n";
print "<div style=\"position: absolute; top: $top1px; left: 20px; width: 130px;height:14px; border: 0px black solid; text-align: left; overflow: hidden;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: left; color: white;\"><A HREF='http://www.AgentRobin.com/prop_display.pl?MLSID=$data[0]'>$data[5]</A></SPAN></div>\n";
print "<div style=\"position: absolute; top: $top1px; left: 150px; width: 50px;height:14px; border: 0px black solid; text-align: right;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: right; color: white;\">\$$data[4]</SPAN></div>\n";
print "<div style=\"position: absolute; top: $top1px; left: 200px; width: 47px;height:14px; border: 0px black solid; text-align: right;\"><SPAN style=\"font-family: helvetica; font-size: .7em; float: right; color: white;\">\$$psqft</SPAN></div>\n";
$top1 = $top1 +24;
$top1px = $top1 . "px";
$count++;
}
print "</div>\n";
print "<div style=\"position: absolute; top: 130px; left: 600px; width: 386px;height:26px; border: 0px black solid; text-align: left; background: url('http://www.AgentRobin.com/Img/blk_over.png'); \"><SPAN style=\"font-family: helvetica; font-size: .7em; float: left;\"></SPAN>\n";
print "<div style=\"position: absolute; top: 3px; left: 3px; width: 60px;height:20px; border: 0px black solid; text-align: center; background: rgb(109,200,255);\">Active</DIV>\n";
print "<div style=\"position: absolute; top: 3px; left: 63px; width: 60px;height:20px; border: 0px black solid; text-align: center; background: rgb(80,168,0);\">New</DIV>\n";
print "<div style=\"position: absolute; top: 3px; left: 123px; width: 60px;height:20px; border: 0px black solid; text-align: center; background: rgb(254,146,21);\">PCH</DIV>\n";
print "<div style=\"position: absolute; top: 3px; left: 183px; width: 60px;height:20px; border: 0px black solid; text-align: center; background: rgb(169,56,110);\">BOMK</DIV>\n";
print "<div style=\"position: absolute; top: 3px; left: 243px; width: 60px;height:20px; border: 0px black solid; text-align: center; background: rgb(187,0,28);\">Sold</DIV>\n";
print "<div style=\"position: absolute; top: 3px; left: 303px; width: 80px;height:20px; border: 0px black solid; text-align: center; background: rgb(255,255,0);\">Withdrawn</DIV>\n";
print "</div>\n";
}