/****************************************************************************************************/
/*                           		CORCORAN MAPS/html												*/
/* 								This file contains HTML output funtions. 							*/
/*										Date Created: 09/06/2006			 						*/
/*																			 						*/
/*						Copyright © 2006-2007 The Corcoran Group, Inc. All Rights Reserved 				*/
/****************************************************************************************************/

var next="<a class=\"graylink\" style=\"cursor:pointer;\" onclick=\"BrowseResults('n')\">Next</a>";
var prev="<a class=\"graylink\" style=\"cursor:pointer;\" onclick=\"BrowseResults('p')\">Previous</a>";
var s_str="";

//html checkboxes and dropdown lists

var apmt="";
var rent="";
var beds="";
var baths="";
var rooms="";
var apmt="";
var ngbh="";
var price="";
var mulfam="";
var single="";
var twnhse="";
var coop="";
var condos="";
var loft="";
var prewar="";
var postwar="";
var pets="";
var outdoor="";
var doorman="";
var subwayline="";
var opnhse="";
var fireplace="";
var tennis="";
var pool="";
var dock="";
var southofthehwy="";
var diningroom="";
var similarlistings="";
var vflgclear = 0;
var idxprice=39;
var idxbeds=0;
var idxbaths=0;
var idxngbh=0;
var end_pointer=0;
var start_pointer=0;
var vcuridxprice = 0;
//var idxsbwy=0;

function BStrSecured(f,v)
{

//alert('BStrSecured');
//alert('vlink1click');
//alert(vlink1click);
if(vlink1click2 == "true")
{
	beds="";
	rooms="";
	apmt="";
	baths="";
	ngbh="";
	price="";
	mulfam="";
	single="";
	twnhse="";
	coop="";
	condos="";
	prewar="";
	postwar="";
	loft="";
	pets="";
	outdoor="";
	doorman="";
	rent="";
	opnhse="";
	fireplace="";
	tennis="";
	pool="";
	dock="";
	southofthehwy="";	
	diningroom="";
	vlink1click2 = "";
}

	if(f=="bldgtype" && v.match("Apartment")){apmt=f+"='"+v+"'";}
	if(f=="bldgtype" && v.match("Townhouse M%")){mulfam=f+" like '"+v+"'";}
	if(f=="bldgtype" && v.match("Townhouse S%")){single=f+" like '"+v+"'";}
	//"Townhouse Multi-Family Residential";}
	// "Townhouse Single Family";}
	//if(f=="bldgtype" && v.match("Townhouse M%")){mulfam=f+" like 'Townhouse Multi-Family Residential'";}
	//if(f=="bldgtype" && v.match("Townhouse S%")){single=f+" like 'Townhouse Single Family'";}
	if(f=="bldgtype" && v.match("Townhouse %")){twnhse=f+" like '"+v+"'";}
	if(f=="propertytype" && v.match("Coop")){coop=f+"='"+v+"'";}
	if(f=="propertytype" && v.match("Condo")){condos=f+"='"+v+"'";}
	if(f=="bldgtype" && v.match("Loft")){loft=f+"='"+v+"'";}
	if(f=="beds" && !v.match("all")){if(v.match("0")){beds=f+"="+v;}else if(v.match("only")){var vt=v.split('_');beds=f+"="+vt[1];}else{beds=f+">="+v;}}else if(f=="beds" && v.match("all")){beds="";}
	if(f=="baths" && !v.match("all")){if(v.match("only")){var vt=v.split('_');baths=f+"="+vt[1];}else{baths=f+">="+v;}}else if(f=="baths" && v.match("all")){baths="";}
	if(f=="rooms" && !v.match("all") &&v!=""){if(v.match("0")&v!="10"){rooms=f+"<3 and (isnull(beds,'0')=0)";}else if(v.match("only")){var vt=v.split('_');rooms=f+"="+vt[1];}else{rooms=f+">="+v;}}else if(f=="rooms" && v.match("all")){rooms="";}
	if(f=="price"){price=f+"<="+v;}
	if(vngbh != "1"){
		if(f=="area"){if(v.match("all")){ngbh="";}else{ngbh=f+"='"+v+"'";}}	
		vngbh = "";
	
	}
	//alert('be14'+beds);
	//alert('h ' + vngbh);
	//alert(ngbh);
	if(f=="prewar"){prewar=f+"='"+v+"'";}
	if(f=="postwar"){postwar="prewar <> '"+v+"'";}
	if(f=="petsallowed"){pets=f+"='"+v+"'";}
	if(f=="outdoor"){outdoor=f+"='"+v+"'";}
	if(f=="doorman"){doorman=f+"='"+v+"'";}
	if(f=="fireplace"){fireplace=f+"='"+v+"'";}
	if(f=="tennis"){tennis=f+"='"+v+"'";}
	if(f=="pool"){pool=f+"='"+v+"'";}
	if(f=="dock"){dock=f+"='"+v+"'";}
	if(f=="southofthehwy"){southofthehwy=f+"='"+v+"'";}	
	if(f=="diningroom"){diningroom=f+"='"+v+"'";}	
	if(f=="openhouseflag"){opnhse=f+"='"+v+"'";}	
	if(f=="subway"){subwayline=v;}
	if(f=="rentsale")
	{
	//alert('in rentsale option');
	//alert(category);
		switch(category)
		{
			case "manhattan":
			{
			    //alert('in manhattan');
				rent=f+" in ('RU','RB')";
			}
				break;
			case "brooklyn":
				rent=f+" in ('RU','RB')";
				break;
			case "queens":
				rent=f+" in ('RU','RB')";
				break;
			case "hamptons":
				rent=f+" in ('RH')";
				break;
			case "palmbeach":
				rent=f+" in ('RU','RH')";
				break;
		}
	}
	
	q_detail=CompileQ();
	//alert('mulfam');
	//alert(mulfam);
	//alert(q_detail);
	return q_detail;
}

function BSubStrSecured(id)
{
	//empty variables
	if(id=="beds"){beds="";}
	if(id=="rooms"){rooms="";}
	if(id=="apmt"){apmt="";}
	if(id=="baths"){baths="";}
	if(id=="ngbh"){ngbh="";}
	if(id=="price"){price="";}
	if(id=="mulfam"){mulfam="";}
	if(id=="single"){single="";}
	if(id=="twnhse"){twnhse="";}
	if(id=="coop"){coop="";}
	if(id=="condos"){condos="";}
	if(id=="prewar"){prewar="";}
	if(id=="postwar"){postwar="";}
	if(id=="loft"){loft="";}
	if(id=="pets"){pets="";}
	if(id=="outdoor"){outdoor="";}
	if(id=="doorman"){doorman="";}
	if(id=="rentsale"){rent="";}
	if(id=="opnhse"){opnhse="";}
	if(id=="fireplace"){fireplace="";}
	if(id=="tennis"){tennis="";}
	if(id=="pool"){pool="";}
	if(id=="dock"){dock="";}
	if(id=="southofthehwy"){southofthehwy="";}	
	if(id=="diningroom"){diningroom="";}
	q_detail=CompileQ();
	
	return q_detail;
}

function chk(id,t,v){	
//alert('in chk');
//alert(requestType);
//alert('t');
//alert(t);
//alert('v');
//alert(v);
	var b=document.getElementById(id);
	if(b.checked==true)	{
	//alert('checkbox selected');
	vflgclear = 0;
		RequestPreciseListings(requestType,subRequest,BStrSecured(t,v));	
	}else{
	//alert('in unchecked');
	    clearflags();
	    vflgclear = 1;
		RequestPreciseListings(requestType,subRequest,BSubStrSecured(id));
	}
}

function clearflags()
{
    bapmt   = "";
	bmulfam = "";
	bsingle = "";
	btwnhse = "";
	bloft = "";
	bcoop = "";
	bcondos = "";
	brentsale = "";
	bprewar = "";
	bpostwar = "";
	bopenhouseflag = "";
	boutdoor = "";
	bfireplace = "";
	bpetsallowed = "";
	bdoorman = "";
	bdiningroom = "";
	brooms = "";
	bsubway = "";
	barea = "";
	bflgbeds = "";
	bflgbaths = "";
	bprice = "";

}
function shwcat(id){
	document.getElementById("divMapLoading").style.display="block";
	var b=document.getElementById(id);
	if(b.getAttribute("key")=="on"){
		b.setAttribute("key","off");
		b.setAttribute("src",LocateOffIcon(id));
		RequestThisNgbhInfo(id,ngbhinfo_areas);		
	}
	else{
		b.setAttribute("key","on");
		b.setAttribute("src",LocateOnIcon(id));
		RemoveMarker(id);
	}
}
function sel(t,v,idx){//for the drop down menu
//alert('sel function');
//alert('requestType');

//alert(t);
//alert(subRequest);
if(t == 'beds')
 //alert('se-'+v+'va-'+idx);

	if(t=="beds"){idxbeds=idx;}
	if(t=="baths"){idxbaths=idx;}
	if(t=="price"){
			  idxprice=idx;
			//alert('price');
			//alert(v);
		}
	if(t=="area"){idxngbh=idx;}

	RequestPreciseListings(requestType,subRequest,BStrSecured(t,v));
}

function isThisBed(index){
	if(index==idxbeds)
		return "selected=\"selected\"";
	else
		return "";
}

function isThisBath(index){
	if(index==idxbaths)
		return "selected=\"selected\"";
	else
		return "";
}

function isThisPrice(index){
	
	if(index==idxprice)
		return "selected=\"selected\"";
	else
		return "";
}

function isThisNgbh(index){
	if(index==idxngbh)
		return "selected=\"selected\"";
	else
		return "";
}

function CompileQ()
{
    //alert('in CompileQ');
	//alert(ngbh);
	//alert(_selectedNgbh);
	var str="";
	if(beds!="" && beds != "all"){str+=" and "+beds;}
	if(rooms!="" && rooms != "all"){str+=" and "+rooms;}	
	if(baths!=""&& baths != "all"){str+=" and "+baths;}
	if(apmt!=""){str+=" and "+apmt;}	
	if(ngbh!="" && ngbh != "all"){str+=" and "+ngbh;}	
	if(price!=""){str+=" and "+price;}
	if(mulfam!=""){str+=" and "+ mulfam;} //"Townhouse Multi-Family Residential";}
	if(single!=""){str+=" and "+single;}  // "Townhouse Single Family";}
	if(twnhse!=""){str+=" and "+twnhse;}
	if(coop!=""){str+=" and "+coop;}
	if(condos!=""){str+=" and "+condos;}
	if(loft!=""){str+=" and "+loft;}
	if(prewar!=""){str+=" and "+prewar;}
	if(postwar!=""){str+=" and "+postwar;}
	if(pets!=""){str+=" and "+pets;}
	if(outdoor!=""){str+=" and "+outdoor;}
	if(doorman!=""){str+=" and "+doorman;}
	if(rent!=""){str+=" and "+rent;}
	if(opnhse!=""){str+=" and "+opnhse;}
	if(fireplace!=""){str+=" and "+fireplace;}
	if(tennis!=""){str+=" and "+tennis;}
	if(pool!=""){str+=" and "+pool;}
	if(dock!=""){str+=" and "+dock;}
	if(southofthehwy!=""){str+=" and "+southofthehwy;}
	if(diningroom!=""){str+=" and "+diningroom;}
	if(similarlistings!=""){str+=" and "+similarlistings;}
	if((ngbh=="" || ngbh == "all") && _selectedNgbh!=""){str+=" and "+_selectedNgbh;}
	if(ohdate!=""){str+=" and "+ohdate;}
	//alert('str');
	//alert(str);
	return str;
}

function ReturnSearchOptionsHtml()
{
	var sbwystate=(subRequest!="manhattan" && subRequest!="brooklyn" && subRequest!="queens" && subRequest!="NYC")?"disabled":"enabled";
	var optionA="";
	var optionB="";
	var OptionC=ReturnDefaultSbwyOption();
	var DisableOhChkBox="";
	if(document.URL.toLowerCase().match("openhouseplanner"))	DisableOhChkBox="disabled";
	if(document.URL.toLowerCase().match("mysubscriptions")){optionA="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}else{optionA="<input type=\"checkbox\" onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}
	switch(subRequest)
	{
		case "palmbeach":
			if(document.URL.toLowerCase().match("mysubscriptions")){optionA="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'pool',this.value);\" id=\"pool\" value=\"Y\" /> Pool";}else{optionA="<input type=\"checkbox\" onClick=\"chk(this.id,'pool',this.value);\" id=\"pool\" value=\"Y\" /> Pool";}
			if(document.URL.toLowerCase().match("mysubscriptions")){optionB="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'dock',this.value);\" id=\"dock\" value=\"Y\" /> Dock";}else{optionB="<input type=\"checkbox\" onClick=\"chk(this.id,'dock',this.value);\" id=\"dock\" value=\"Y\" /> Dock";}
			OptionC=ReturnDefaultNYCOption();
			break;
		case "FL":
			if(document.URL.toLowerCase().match("mysubscriptions")){optionA="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'pool',this.value);\" id=\"pool\" value=\"Y\" /> Pool";}else{optionA="<input type=\"checkbox\" onClick=\"chk(this.id,'pool',this.value);\" id=\"pool\" value=\"Y\" /> Pool";}
			if(document.URL.toLowerCase().match("mysubscriptions")){optionB="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'dock',this.value);\" id=\"dock\" value=\"Y\" /> Dock";}else{optionB="<input type=\"checkbox\" onClick=\"chk(this.id,'dock',this.value);\" id=\"dock\" value=\"Y\" /> Dock";}
			OptionC=ReturnDefaultNYCOption();
			break;
		case "hamptons":
			if(document.URL.toLowerCase().match("mysubscriptions")){optionA="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}else{optionA="<input type=\"checkbox\" onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}
			if(document.URL.toLowerCase().match("mysubscriptions")){optionB="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'southofthehwy',this.value);\" id=\"southofthehwy\" value=\"Y\" /> South Of Highway";}else{optionB="<input type=\"checkbox\" onClick=\"chk(this.id,'southofthehwy',this.value);\" id=\"southofthehwy\" value=\"Y\" /> South Of Highway";}
			break;		
		case "LI":
			if(document.URL.toLowerCase().match("mysubscriptions")){optionA="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}else{optionA="<input type=\"checkbox\" onClick=\"chk(this.id,'tennis',this.value);\" id=\"tennis\" value=\"Y\" /> Tennis";}
			if(document.URL.toLowerCase().match("mysubscriptions")){optionB="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'southofthehwy',this.value);\" id=\"southofthehwy\" value=\"Y\" /> South Of Highway";}else{optionB="<input type=\"checkbox\" onClick=\"chk(this.id,'southofthehwy',this.value);\" id=\"southofthehwy\" value=\"Y\" /> South Of Highway";}
			break;
		default:
			optionA=ReturnDefaultNYCOption();
			if(document.URL.toLowerCase().match("mysubscriptions")){optionB="<input type=\"checkbox\" disabled onClick=\"chk(this.id,'diningroom',this.value);\" id=\"diningroom\" value=\"Y\" /> Dining Room";}else{optionB="<input type=\"checkbox\" onClick=\"chk(this.id,'diningroom',this.value);\" id=\"diningroom\" value=\"Y\" /> Dining Room";}
			break;
	}
	var html="";
	html+="<table>";
    html+="<tr>";
    html+="<td class=\"text11px\">";
    html+="<b>Show on map</b>";
    html+="</td>";
	html+="</tr>";
  	html+="<tr class=\"text11px\">";
  	if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"apmt\" value=\"Apartment\" /> Apartments";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"apmt\" value=\"Apartment\" /> Apartments";}                 
    
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'propertytype',this.value);\" id=\"coop\" value=\"Coop\" /> Co-ops";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'propertytype',this.value);\" id=\"coop\" value=\"Coop\" /> Co-ops";}                       
	html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'propertytype',this.value);\" id=\"condos\" value=\"Condo\" /> Condos";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'propertytype',this.value);\" id=\"condos\" value=\"Condo\" /> Condos";}                     
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"twnhse\" value=\"Townhouse %\" /> Townhouses";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"twnhse\" value=\"Townhouse %\" /> Townhouses";}                      
    html+="</td>";
	if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"single\" value=\"Townhouse S%\" /> Single-Family";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"single\" value=\"Townhouse S%\" /> Single-Family";}
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td style=\"width:115px\"> <input type=\"checkbox\" disabled onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"mulfam\" value=\"Townhouse M%\" /> Multi-Family";}else{html+="<td style=\"width:115px\"> <input type=\"checkbox\" onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"mulfam\" value=\"Townhouse M%\" /> Multi-Family";}
    html+="</td>";
	html+="</tr>";
    html+="<tr class=\"text11px\">";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'rentsale',this.value);\" id=\"rentsale\" value=\"RU\" /> Rentals";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'rentsale',this.value);\" id=\"rentsale\" value=\"RU\" /> Rentals";}                    
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'prewar',this.value);\" id=\"prewar\" value=\"Y\" /> Pre-War";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'prewar',this.value);\" id=\"prewar\" value=\"Y\" /> Pre-War";}                   
	html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'postwar',this.value);\" id=\"postwar\" value=\"Y\" /> Post-War";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'postwar',this.value);\" id=\"postwar\" value=\"Y\" /> Post-War";}                   
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"loft\" value=\"Loft\" /> Loft";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'bldgtype',this.value);\" id=\"loft\" value=\"Loft\" /> Loft";}                    
    html+="</td>";
  	if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'openhouseflag',this.value);\" id=\"opnhse\" value=\"Y\" /> Open Houses";}else{html+="<td><input type=\"checkbox\" "+DisableOhChkBox+" onClick=\"chk(this.id,'openhouseflag',this.value);\" id=\"opnhse\" value=\"Y\" /> Open Houses";}                     
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'outdoor',this.value);\" id=\"outdoor\" value=\"Y\" /> Outdoor Space";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'outdoor',this.value);\" id=\"outdoor\" value=\"Y\" /> Outdoor Space";}                       
    html+="</td>";
	html+="</tr>";
    html+="<tr class=\"text11px\">";
    html+="<td>"+OptionC;
	html+="</td>";
  	html+="<td>"+optionA;                    
    html+="</td>";
    html+="<td>"+optionB;                    
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'fireplace',this.value);\" id=\"fireplace\" value=\"Y\" /> Fireplace";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'fireplace',this.value);\" id=\"fireplace\" value=\"Y\" /> Fireplace";}                      
	html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'petsallowed',this.value);\" id=\"pets\" value=\"Y\" /> Pets Allowed";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'petsallowed',this.value);\" id=\"pets\" value=\"Y\" /> Pets Allowed";}                      
    html+="</td>";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<td><input type=\"checkbox\" disabled onClick=\"chk(this.id,'doorman',this.value);\" id=\"doorman\" value=\"yes\" /> Doorman";}else{html+="<td><input type=\"checkbox\" onClick=\"chk(this.id,'doorman',this.value);\" id=\"doorman\" value=\"yes\" /> Doorman";}                      
    html+="</td>";
	html+="</tr>";

	return html;
}
function GetNotes(){
	var txt="Refine your search and add or remove the properties you're interested in to ";
    txt+="create your day's itinerary. Once you are ready to begin building your ";
    txt+=" Open House Planner, simply enter your starting address and click ";
    txt+="'Create Open House Planner' to create the plan for your day. ";
	return txt;
}
function NgbhInfoHtml(){
	var html="";
	html+="<div id=\"div\" style=\"width:430px;height:45;background-color:#FFFF99;\">";
    html+="<table class=\"text10px\"><tr>";
    html+="<td ><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Bar.gif' onClick=\"shwcat(this.id);\" id=\"Bars\" key='on' alt='Show Bars'></td><td valign='middle'>Bars</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Bank.gif' onClick=\"shwcat(this.id);\" id=\"Banks\" key='on' alt='Show Banks'></td><td valign='middle'>Banks</td>";
	html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Bookstore.gif' onClick=\"shwcat(this.id);\" id=\"book\" key='on' alt='Show Bookstores'></td><td valign='middle'>Bookstores</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_GroceryStore.gif' onClick=\"shwcat(this.id);\" id=\"Delicatessens\" key='on' alt='Show Grocery Stores'></td><td valign='middle'>Grocery Stores</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Laundry.gif' onClick=\"shwcat(this.id);\" id=\"Laundries\" key='on' alt='Show Laundries'></td><td valign='middle'>Laundry</td>";
    html+="</tr><tr height='25'>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Pharmacy.gif' onClick=\"shwcat(this.id);\" id=\"Pharmacies\" key='on' alt='Show Pharmacies'></td><td valign='middle'>Pharmacy</td>";
    html+=" <td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_PostOffice.gif' onClick=\"shwcat(this.id);\" id=\"Post Offices\" key='on' alt='Show Post Offices'></td><td valign='middle'>Post Offices</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Restaurants.gif' onClick=\"shwcat(this.id);\" id=\"Restaurants\" key='on' alt='Show Restaurants'></td><td valign='middle'>Restaurants</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_Movies.gif' onClick=\"shwcat(this.id);\" id=\"theatres\" key='on' alt='Show Movie Theatres'></td><td valign='middle'>Movies</td>";
    html+="<td><img onmouseover=\"this.style.cursor='pointer'\"  src='/gfx/map_icons/Icon_HealthClub.gif' onClick=\"shwcat(this.id);\" id=\"Health Clubs\" key='on' alt='Show Health Clubs'></td><td valign='middle'>Health Clubs</td>";
 	html+=" </tr> </table> </div>";
    return html;
}
function changeCase(frmObj) {
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	tmpStr = frmObj
	strLen = tmpStr.length;
	if (strLen > 0){
		for (index = 0; index < strLen; index++){
			if (index == 0){
				tmpChar = tmpStr.substring(0,1).toUpperCase();
				postString = tmpStr.substring(1,strLen);
				tmpStr = tmpChar + postString;
			}
			else{
				tmpChar = tmpStr.substring(index, index+1);
				if (tmpChar == " " && index < (strLen-1)){
					tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
					preString = tmpStr.substring(0, index+1);
					postString = tmpStr.substring(index+2,strLen);
					tmpStr = preString + tmpChar + postString;
				}
			}
	   }
	}
	return tmpStr;
}

function UpdateItinerary(){
	var d=document.getElementById("itinerary_td");
	var loc=document.getElementById("location_td");
	var tr="";td="";var r="";var c=0;m=0;gd=0;var v=itinerary_items.length/3;	
	var t=v+'';
	var $new_end=0;	
	end_pointer++;
	if(t.indexOf(".")!=-1){
		var k=t.split(".");
		c=(parseInt(k[0])+1);
	}else c=t;
	for(var i=0;i<c;i++){
		td="";gd=0;
		do{
			td+="<td align='left' width='240'>"+BlockHtml(itinerary_items[m])+"</td>";
			m++;gd++;
		}while(m<end_pointer && gd<3);
		tr+="<tr>"+td+"</tr>";
	}
	//d.style.display="block";
	d.innerHTML=ItineraryHtml(tr);
	loc.innerHTML=LocationHtml("");
	return true;
}
function RemoveItem(){
	var d=document.getElementById("itinerary_td");
	var loc=document.getElementById("location_td");
	var tr="";td="";var r="";var c=0;m=0;gd=0;var v=itinerary_items.length/3;	
	var t=v+'';var $new_end=0;
	
	end_pointer--;
	if(t.indexOf(".")!=-1){
		var k=t.split(".");
		c=(parseInt(k[0])+1);
	}else c=t;
	if(c==0){
		r="";
	}else{
		for(var i=0;i<c;i++){
			td="";gd=0;
			do{
				td+="<td align='left' width='240'>"+BlockHtml(itinerary_items[m])+"</td>";
				m++;gd++;
			}while(m<end_pointer && gd<3);
			tr+="<tr>"+td+"</tr>";
		}
		r=ItineraryHtml(tr);
	}	
	d.innerHTML=(r!="")?r:ItineraryHtml("<tr><td></td></tr>");
	if(itinerary_items.length==0)loc.innerHTML="";
	return true;
}

function BlockHtml(r)
{
	var html="";
	var infoRow1="";//rooms
	var infoRow2="";//beds//units
	var infoRow3="";//baths
	var infoRow4="";//floors
	var infoRow5="";//property type
	var pic="";
	var opnhse="";
	
	infoRow1=(r[8]!=undefined && r[8]!=null && r[8]!=" ")?'<br>'+r[8]+' Rooms':"";	//first row	
	
	if(r[3]!=undefined && r[3]!=null && r[3]!=" "){//second row
		infoRow2='<br>'+r[3]+' Beds';
	}else if(r[5]!=undefined && r[5]!=null && r[5]!=" "){
		infoRow2='<br>'+r[5]+' Units';
	}else{
		infoRow2="";
	}	
	infoRow3=(r[4]!=undefined && r[4]!=null && r[4]!=" ")?'<br>'+r[4]+' Baths':"";	//baths	
	infoRow4=(r[6]!=undefined && r[6]!=null && r[6]!=" ")?'<br>'+r[6]+' Floors':"";	//floors	
	if(r[1]!=" " && r[1]!=undefined){
		pic='<a class=\"graylink\" style=\"cursor:pointer;\" onclick=\"SearchByMap(\''+r+'\')\"><img src='+r[1]+' style="border-style:solid;border-width:1px;border-color:#666666;" width="120" height="75" border="0" OnError="ImageLoadFailedSm()" alt="View this listing on the map"></a>';
	}
	if(r[18]!=undefined && r[18]!=null && r[18]!=null && r[18]!="")	{
		var opnhse_t=new Array();
		var o_new=new Array();
		var o_new2=new Array();
		opnhse_t=r[18].split('<br>');
		o_new=opnhse_t[0].split(' ');
		o_new2=o_new.shift();
		var st=o_new+'';
		st=st.replace(','," ");st=st.replace(','," ");st=st.replace(','," ");st=st.replace(','," ");st=st.replace(','," ");
		st=st.replace('12:00 Noon',"Noon");st=st.replace('12:00 PM',"Noon");
		opnhse='<br><b>Open House Times</b>';
		opnhse+='<br>'+st+'';
	}	
	//if(r[18]!=undefined && r[18]!=null && r[18]!="")	{
	
	html+="<table><tr><td valign='top'>";
	html+=pic;
	html+="</td><td valign='top' class=\"text10px\">";
	html+='<b>'+FormatPrice(r[9])+'</b>';
	html+=infoRow1;//rooms
	html+=infoRow2;//beds//units
	html+=infoRow3;//baths
	html+=infoRow4;//floors
	html+=opnhse;
	html+="</td></tr>";
	html+="<tr><td class=\"text10px\"><a class=\"graylink\" title=\"View this listing on the map\" style=\"cursor:pointer;\" onclick=\"SearchByMap('"+r+"')\">"+ReduceAddrLength(unescape(r[11]))+"</a><br><b>"+r[17]+"</b></td>";
	html+="<td></td></tr>";
	html+="<tr><td class=\"text10px\">";
	html+="<div id=\"div_itBottom_"+r[0]+">";
	html+="<div class=\"text10px\" title=\"Remove This Listing From My Itinerary\" style=\"background-color:#999999;color:#FFFFFF;padding-left:2px;cursor:pointer;\" onclick=\"RemoveListingAndLink('"+r+"')\">- Remove From My List</div>";
	html+="</div>";
	html+="</td><td></td></tr>";
	html+="</table>";
	return html;
}
function ItineraryHtml(h)
{
	var html="";
	html+="<table width=\"100%\">";
    html+="<tr>";
    html+="<td class=\"text11px\">";
	html+="</td></tr>";
	html+="<tr><td><img src='/gfx/openhouse_itinerary.gif'></td></tr>";
	html+="<tr><td width=\"100%\" id=\"td_items\"><table>";
	html+=h;
	html+="</table>";
	html+="</td></tr>";
	html+="";
	html+="</table>";
	
	return html;
}
function LocationHtml(h){
	var html="";
	html+="<table width=\"100%\">";
    html+="<tr>";
    html+="<td class=\"text11px\">";
	html+="</td></tr>";
	html+="<tr><td><img src='/gfx/openhouse_loc_itinerary.gif'></td></tr>";
	html+="<tr><td width=\"100%\" class=\"text11px\">";
	html+="Street Address: <input type='text' id='s_address' class='quickSearchBox' size=40/ maxlength=\"50\">  ";
	html+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "+LocationsOpt();
	html+="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Zip: <input type='text' id='s_zip' class='quickSearchBox' size=10 maxlength=\"5\"/>";
	html+="</td></tr>";
	html+="<tr><td align=right height=45 valign=bottom><img src='/gfx/btn_create_planner.gif' alt='Create My Open House Planner' onclick='CreatePlanner()' onmouseover=\"this.style.cursor='pointer'\">";
	html+="</td></tr>";
	html+="</table>";
	
	return html;
}
function LocationsOpt(){
	var opt="";
	if(subRequest!="hamptons" && subRequest!="palmbeach"){
		opt="Borough: <select id='s_city' class='quickSearchBox' width='25'/>";
		opt+="<option value='Manhattan'>Manhattan</option><option value='Brooklyn'>Brooklyn</option><option value='Queens'>Queens</option><option value='Bronx'>Bronx</option><option value='Staten Island'>Staten Island</option>";
		opt+="</select>";
	}
	else{
		opt="City: <input type='text' id='s_city' class='quickSearchBox' size=14 maxlength=\"25\">";
	}
	return opt;
}
function TopOptionsHtml(d){
	var html="";
	html+="<table width=\"156\"  border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align='right'>";
	html+="<tr class='text11px'>";
	html+="<td width=\"5\" style=\"padding-left:2px;\" align=\"right\"><a class='graylink' title='Print Your Open House Itinerary' href='javascript:void(0)' onclick='PrintItinerary()'><img src='/gfx/icon_print.gif' border=0 align='right'></a></td>";
	html+="<td width=\"80\" align=\"left\"><a class='graylink' title='Print Your Open House Itinerary' href='javascript:void(0)' onclick='PrintItinerary()'>&nbsp;Print</a></td>";
	html+="</tr>";
	html+="<tr class='text11px'>";
	html+="<td width=\"5\" style=\"padding-left:2px;\" align=\"right\"><a class='graylink' title='Email Your Itinerary' href='javascript:void(0)' onclick=\"ShowOptsDiv('email')\"><img src='/gfx/email_me.gif' border=0 align='right'></a></td>";
	html+="<td width=\"85\" align=\"left\">&nbsp;<a class='graylink' title='Email Your Itinerary' href='javascript:void(0)' onclick=\"ShowOptsDiv('email')\">E-Mail</a></td>";
	html+="</tr>";
	html+="<tr class='text11px'>";
	html+="<td width=\"5\" style=\"padding-left:2px;\" align=\"right\"><a class='graylink' title='Send Planner To...' href='javascript:void(0)' onmouseOver=\"ShowHideSendOptions('Show')\" onmouseout=\"HideSendOptions('')\"><img src='/gfx/icon_send.gif' border=0 align='right'></a></td>";
	html+="<td width=\"150\" align=\"left\"><div width=\"150\">&nbsp;<a class='graylink' title='Send Planner To...' href='javascript:void(0)' onmouseOver=\"ShowHideSendOptions('Show')\" onmouseout=\"HideSendOptions('')\">Send Planner To... </a></div></td>";
	html+="</tr>";
	html+="<tr class='text11px'>";
	html+="<td colspan='2' id='td_SendOptions'>";
	html+="";
	html+="</td>";
	html+="</tr>";	
	html+="</table>";
	return html;
}
function EmailInputHtml(){
	var html="";
	html+="<table id='tr_send' style='display:none;'><tr>";
	html+="<td><input class=\"quickSearchBox\" value=\"Enter Your Email Address\" onFocus=\"GenericShowText(this.id)\" onBlur=\"GenericHideText(this.id)\" size=\"22\" type=\"text\" id=\"txt_email\">";
	html+="</td>";
	html+="<td><img src='/gfx/global/global_send_button.gif' alt='Email Your Itinerary' style=\"cursor:pointer;\" onclick='SendEmail()' border=0></td>";
	html+="</tr></table>";
	return html;
}
function PhoneInputHtml(){
	var html="";
	html+="<table id='tr_phone' style='display:none;'><tr>";
	html+="<td><input class=\"quickSearchBox\" value=\"Enter Your 10-Digit Phone\" onFocus=\"GenericShowText(this.id)\" onBlur=\"GenericHideText(this.id)\" size=\"23\" type=\"text\" id=\"txt_phone\" maxLength=10>";
	html+="&nbsp;&nbsp;<select name=\"Provider\" id=\"Provider\" class=\"quickSearchBox\">";
	html+="<option value=\"x\">Choose Provider</option>";
	html+="<option value=\"1\">Verizon</option>";
	html+="<option value=\"2\">AT&T</option>";
	html+="<option value=\"3\">Nextel</option>";
	html+="<option value=\"4\">SprintPCS</option>";
	html+="<option value=\"5\">T-Mobile</option>";
	//html+="<option value=\"6\">Cingular</option>";
	html+="</select>";
	html+="</td><td>";
	html+="<img src='/gfx/global/global_send_button.gif' alt='Enter Your 10-Digit Phone' style=\"cursor:pointer;\" onclick='SendToPhone()' border=0>";
	html+="</td></tr></table>";
	return html;
}
function FaxInputHtml(){
	var html="";
	html+="<table id='tr_fax' style='display:none;'><tr>";
	html+="<td ><input class=\"quickSearchBox\" value=\"Enter Your 10-Digit Fax #\" onFocus=\"GenericShowText(this.id)\" onBlur=\"GenericHideText(this.id)\" size=\"23\" type=\"text\" id=\"txt_fax\">";
	html+="</td>";
	html+="<td><img src='/gfx/global/global_send_button.gif' alt='Enter Your 10-Digit Fax #' style=\"cursor:pointer;\" onclick='SendToFax()' border=0></td>";
	html+="</tr></table>";
	return html;
}
function PrintItinerary(){
	var s="";
	var t=document.getElementById("TblSearchResults_td").innerHTML;
	if(document.getElementById("TblSearchResults_div")){
		s=document.getElementById("TblSearchResults_div");
		s.removeAttribute("style");
		window.print();
		document.getElementById("TblSearchResults_td").innerHTML=t;
		t="";
	}
}
function ResetDoc(){
	this.document.reload(true);
}
function USStates()
{
	var s=""
	s+="<option value=\"AL\">Alabama</option>";
   s+=" <option value=\"AK\">Alaska</option>";
   s+=" <option value=\"AZ\">Arizona</option>";
   s+=" <option value=\"AR\">Arkansas</option>";
   s+=" <option value=\"CA\">California</option>";
   s+=" <option value=\"CO\">Colorado</option>";
   s+=" <option value=\"CT\">Connecticut</option>";
   s+=" <option value=\"DE\">Delaware</option>";
   s+=" <option value=\"DC\">Dist. of Columbia</option>";
   s+=" <option value=\"FL\">Florida</option>";
   s+=" <option value=\"GA\">Georgia</option>";
   s+=" <option value=\"HI\">Hawaii</option>";
   s+=" <option value=\"ID\">Idaho</option>";
   s+=" <option value=\"IL\">Illinois</option>";
   s+=" <option value=\"IN\">Indiana</option>";
   s+=" <option value=\"IA\">Iowa</option>";
   s+=" <option value=\"KS\">Kansas</option>";
   s+=" <option value=\"KY\">Kentucky</option>";
   s+=" <option value=\"LA\">Louisiana</option>";
   s+=" <option value=\"ME\">Maine</option>";
   s+=" <option value=\"MD\">Maryland</option>";
   s+=" <option value=\"MA\">Massachusetts</option>";
   s+=" <option value=\"MI\">Michigan</option>";
   s+=" <option value=\"MN\">Minnesota</option>";
   s+=" <option value=\"MS\">Mississippi</option>";
   s+=" <option value=\"MO\">Missouri</option>";
   s+=" <option value=\"MT\">Montana</option>";
   s+=" <option value=\"NE\">Nebraska</option>";
   s+=" <option value=\"NV\">Nevada</option>";
   s+=" <option value=\"NH\">New Hampshire</option>";
   s+=" <option value=\"NJ\">New Jersey</option>";
   s+=" <option value=\"New Mexico\">New Mexico</option>";
   s+=" <option value=\"New York\" selected>New York</option>";
   s+=" <option value=\"NC\">North Carolina</option>";
   s+=" <option value=\"ND\">North Dakota</option>";
   s+=" <option value=\"OH\">Ohio</option>";
   s+=" <option value=\"OK\">Oklahoma</option>";
   s+=" <option value=\"OR\">Oregon</option>";
   s+=" <option value=\"PA\">Pennsylvania</option>";
   s+=" <option value=\"RI\">Rhode Island</option>";
   s+=" <option value=\"SC\">South Carolina</option>";
   s+=" <option value=\"SD\">South Dakota</option>";
   s+=" <option value=\"TN\">Tennessee</option>";
   s+=" <option value=\"TX\">Texas</option>";
   s+=" <option value=\"UT\">Utah</option>";
   s+=" <option value=\"VT\">Vermont</option>";
   s+=" <option value=\"VA\">Virginia</option>";
   s+=" <option value=\"WA\">Washington</option>";
   s+=" <option value=\"WV\">West Virginia</option>";
   s+=" <option value=\"WI\">Wisconsin</option>";
   s+=" <option value=\"WY\">Wyoming</option>";
   return s;
}
function ReturnDefaultNYCOption()
{
	var html;
	if(document.URL.toLowerCase().match("mysubscriptions")){html="<select name=\"rooms\"  disabled class=\"quickSearchBox\" id=\"rooms\" onChange=\"sel('rooms',this.options[selectedIndex].value,this.selectedIndex);\">";}else{html="<select name=\"rooms\"  class=\"quickSearchBox\" id=\"rooms\" onChange=\"sel('rooms',this.options[selectedIndex].value,this.selectedIndex);\">";}
	html+="<option value=\"null\">Room Count</option>";
	html+="<option value=\"all\">All</option>";
	html+="<option value=\"0\">Studio</option>";
	html+="<option value=\"only_1\">1</option>";
	html+="<option value=\"1\">1 or more</option>";	
	html+="<option value=\"only_2\">2</option>";
	html+="<option value=\"2\">2 or more</option>";	
	html+="<option value=\"only_3\">3</option>";
	html+="<option value=\"3\">3 or more</option>";	
	html+="<option value=\"only_4\">4</option>";
	html+="<option value=\"4\">4 or more</option>";	
	html+="<option value=\"only_5\">5</option>";
	html+="<option value=\"5\">5 or more</option>";
	html+="</select>";
	
	return html;
}

function ReturnDefaultSbwyOption()
{
	var html="";
	var sbwystate=(subRequest!="manhattan" && subRequest!="brooklyn" && subRequest!="queens" && subRequest!="NYC")?"disabled":"enabled";
	if(document.URL.toLowerCase().match("mysubscriptions")){html+=" <select name=\"subway\" id=\"subway\" disabled onChange=\"sel('subway',this.options[selectedIndex].value,this.selectedIndex);\" "+sbwystate+" class=\"quickSearchBox\">";}else{html+=" <select name=\"subway\" id=\"subway\" onChange=\"sel('subway',this.options[selectedIndex].value,this.selectedIndex);\" "+sbwystate+" class=\"quickSearchBox\">";}
	
	html+=" <option value=\"\">Subway Line</option>";
	html+="	<option value=\"1\">1</option>";
	html+="	<option value=\"2\">2</option>";
	html+="	<option value=\"3\">3</option>";
	html+="	<option value=\"4\">4</option>";
	html+="	<option value=\"5\">5</option>";
	html+="	<option value=\"6\">6</option>";
	html+="	<option value=\"7\">7</option>";
	html+="	<option value=\"A\">A</option>";
	html+="	<option value=\"B\">B</option>";
	html+="	<option value=\"C\">C</option>";
	html+="	<option value=\"D\">D</option>";
	html+="	<option value=\"E\">E</option>";
	html+="	<option value=\"F\">F</option>";
	html+="	<option value=\"G\">G</option>";
	html+="	<option value=\"J\">J</option>";
	html+="	<option value=\"L\">L</option>";
	html+="	<option value=\"M\">M</option>";
	html+="	<option value=\"N\">N</option>";
	html+="	<option value=\"Q\">Q</option>";
	html+="	<option value=\"R\">R</option>";
	html+="	<option value=\"S\">S</option>";
	html+="	<option value=\"V\">V</option>";
	html+="	<option value=\"W\">W</option>";
	html+="	</select>";
	
	return html;
}

function NeighborhoodDropDown()
{
	//_nghbdropdownstate="disabled"; //disabled=\""+_nghbdropdownstate+"\"
	if(document.URL.toLowerCase().match("mysubscriptions")){_nghbdropdown="<select name=\"neighborhoods\" disabled class=\"quickSearchBox\" onChange=\"sel('area',this.options[selectedIndex].value,this.selectedIndex);\" id=\"area\">";}else{_nghbdropdown="<select name=\"neighborhoods\" class=\"quickSearchBox\" onChange=\"sel('area',this.options[selectedIndex].value,this.selectedIndex);\" id=\"area\">";}
	_nghbdropdown+="<option value=\"all\" "+isThisNgbh(0)+">All</option>";
	for(var i=0;i<_neighborhoods.length;i++)
	{
		_nghbdropdown+="<option value=\""+_neighborhoods[i]+"\" "+isThisNgbh(i+1)+">"+_neighborhoods[i]+"</option>";
	}
	
	_nghbdropdown+="</select>";
	return true;
}

function ReviseSearch()
{
	//The 2 elements below are the same. The 2 different references 
	//are due to the fact there are 2 different entry points
	if(category!=null && category!=undefined && category!="")
	{document.getElementById("div_"+category+"_loading").style.display='none';}
	if(subRequest!=null && subRequest!=undefined && subRequest!="" && document.getElementById("div_"+subRequest+"_loading"))
	{document.getElementById("div_"+subRequest+"_loading").style.display='none';}
	oh_results=false;
	/***************************************************************************/
	if(document.getElementById('td_header_img'))
		document.getElementById('td_header_img').innerHTML = "<a href=\"/property/openhouseplanner\"><img src=\"/gfx/header_ophsesearchbymap.png\" alt=\"Corcoran, Manhattan, Brooklyn, New York, Palm Beaches Real Estate, Open Houses, Homes For Sale\" border=\"0\"/></a>";

	if(document.getElementById('div_TblWeath'))
	   document.getElementById('div_TblWeath').style.display = 'none';
	   
	   
	if(document.getElementById('div_topoptions'))
	   document.getElementById('div_topoptions').style.display = 'block';
	   
	clearMap();//clear map results
	//reset
	start=0;
	increment=50;
	idxprice=39;
	idxbeds=0;
	idxbaths=0;
	idxngbh=0;
	apmt="";
	rent="";
	beds="";
	baths="";
	rooms="";
	apmt="";
	ngbh="";
	price="";
	mulfam="";
	single="";
	twnhse="";
	coop="";
	condos="";
	loft="";
	prewar="";
	postwar="";
	pets="";
	outdoor="";
	doorman="";
	subwayline="";
	_selectedNgbh="";
	ohdate="";
	fireplace="";
	tennis="";
	pool="";
	dock="";
	opnhse="";
	q_detail="";
	similarlistings="";
	southofthehwy="";
	diningroom="";
	srchOpLoaded=false;
	sortOpLoaded=false;
	total_listings=0;	
	itinerary_items.length=0;
	end_pointer=0;
	pic_count=0;
	document.getElementById('TblSearchResults').style.display='none';	
	document.getElementById('searchOptions_td').innerHTML="";
	document.getElementById('sortoptions_td').innerHTML ="";
	if(document.getElementById("TblSearch"))document.getElementById("TblSearch").style.display='block';	
	if(document.getElementById("div_topoptions"))document.getElementById("div_topoptions").innerHTML=ohdatehtml;	
	if(document.getElementById('div_ngbhinfo'))document.getElementById('div_ngbhinfo').innerHTML ="";
	if(document.getElementById('td_howto'))document.getElementById('td_howto').innerHTML ="";	
	if(document.getElementById('div_TblSearch'))document.getElementById("div_TblSearch").innerHTML=initialTblSrch;	
	if(document.getElementById('td_items'))document.getElementById('td_items').innerHTML ="";
	if(document.getElementById('location_td'))document.getElementById('location_td').innerHTML ="";
}
function OhDateReset(){
	if(oh_results){
		document.getElementById("div_topoptions").innerHTML=ohdatehtml;
		if(document.getElementById('td_header_img'))document.getElementById("td_header_img").innerHTML=HideDirectionsBtn();
		var wControl=document.getElementById("td_Control");
		if(wControl){
			document.getElementById("div_TblWeath").innerHTML="";
			wControl.width="1%";
		}
		ReviseSearch();
	}
}
function HideDirectionsBtn(){
	var html=document.getElementById("td_header_img").innerHTML;
	var new_html=html.substr(0,93);
	return new_html;
}
function ReturnSortOptionsHtml(listings_length,new_start,new_end){
	var s_nav="";//=(new_start<=1 && new_end<listings_length)?next:prev+" | "+next;
	if(new_start>listings_length){//adjust end display	{
		if((listings_length-s_limit)>0)
			new_start=listings_length-s_limit;
		else
			new_start=0;	
	}	
	if(new_start==0 && new_end<listings_length){//show next	{
		s_nav=next;
	}else if(new_end>listings_length){//adjust end display{
		new_end=listings_length;
	}else if(new_start>0 && new_end<listings_length){//show previous and next
		s_nav=prev+" | "+next;
	}else if(new_start>0 && new_end>=listings_length){//show previous	{
		s_nav=prev;
	}else{// if(new_start>1 && new_end>=listings_length){//show previous
		s_nav=prev;
	}
	
	if((new_start<listings_length && new_start>0) && new_end==listings_length)//show previous
		s_nav=prev;			
	//
	var html="";
	html+="<table class=\"text11px\">";
    html+="<tr><td style=\"width:240px\">Total: <b>"+listings_length+"</b> Listings Found. Showing "+new_start+"-"+new_end+"</td>";
    html+="<td id=\"Td1\" style=\"width:160px\">Sort by number of bedrooms:</td>";
    html+="<td id=\"Td3\" style=\"width:100px\">";
   if(document.URL.toLowerCase().match("mysubscriptions")){html+="<select name=\"beds\" disabled onChange=\"sel('beds',this.options[selectedIndex].value,this.selectedIndex);\"  class=\"quickSearchBox\" id=\"beds\">";}else{html+="<select name=\"beds\" onChange=\"sel('beds',this.options[selectedIndex].value,this.selectedIndex);\"  class=\"quickSearchBox\" id=\"beds\">";}
   
  html+="<option value=\"all\" "+isThisBed(0)+">All</option>";
	html+="<option value=\"0\" "+isThisBed(1)+">Studio</option>";
	html+="<option value=\"only_1\" "+isThisBed(2)+">Only 1</option>";
	html+="<option value=\"only_2\" "+isThisBed(3)+">Only 2</option>";
	html+="<option value=\"only_3\" "+isThisBed(4)+">Only 3</option>";
	html+="<option value=\"only_4\" "+isThisBed(5)+">Only 4</option>";
	html+="<option value=\"only_5\" "+isThisBed(6)+">Only 5</option>";
	html+="<option value=\"only_6\" "+isThisBed(7)+">Only 6</option>";
	html+="<option value=\"1\" "+isThisBed(8)+">At Least 1</option>";
	html+="<option value=\"2\" "+isThisBed(9)+">At Least 2</option>";
	html+="<option value=\"3\" "+isThisBed(10)+">At Least 3</option>";
	html+="<option value=\"4\" "+isThisBed(11)+">At Least 4</option>";
	html+="<option value=\"5\" "+isThisBed(12)+">At Least 5</option>";
  html+="<option value=\"6\" "+isThisBed(13)+">At Least 6</option>";
	html+="<option value=\"7\" "+isThisBed(14)+">At Least 7</option>";
	html+="<option value=\"8\" "+isThisBed(15)+">At Least 8</option>";
	html+="<option value=\"9\" "+isThisBed(16)+">At Least 9</option>";
	html+="<option value=\"10\" "+isThisBed(17)+">At Least 10</option>";
	html+="</select></td><td id=\"Td2\">Sort by neighborhood:</td><td id=\"Td4\">";

    html+=_nghbdropdown;
   	html+="</td></tr><tr><td style=\"width:200px\"><a class=\"graylink\" style=\"cursor:pointer;\" onclick=\"ReviseSearch()\">Revise Search</a>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+s_nav+"</td><td id=\"Td5\">Sort by number of bathrooms:";
    html+="</td><td id=\"Td6\" style=\"width:100px\">";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<select name=\"select\" disabled class=\"quickSearchBox\" onChange=\"sel('baths',this.options[selectedIndex].value,this.selectedIndex);\"  id=\"baths\">";}else{html+="<select name=\"select\" class=\"quickSearchBox\" onChange=\"sel('baths',this.options[selectedIndex].value,this.selectedIndex);\"  id=\"baths\">";}
   
  html+="<option value=\"all\" "+isThisBath(0)+">All</option>";
	html+="<option value=\"only_1\" "+isThisBath(1)+">Only 1</option>";
	html+="<option value=\"only_2\" "+isThisBath(2)+">Only 2</option>";
	html+="<option value=\"only_3\" "+isThisBath(3)+">Only 3</option>";
	html+="<option value=\"only_4\" "+isThisBath(4)+">Only 4</option>";
	html+="<option value=\"only_5\" "+isThisBath(5)+">Only 5</option>";
	html+="<option value=\"only_6\" "+isThisBath(6)+">Only 6</option>";
	html+="<option value=\"1\" "+isThisBath(7)+">At Least 1</option>";
	html+="<option value=\"2\" "+isThisBath(8)+">At Least 2</option>";
	html+="<option value=\"3\" "+isThisBath(9)+">At Least 3</option>";
	html+="<option value=\"4\" "+isThisBath(10)+">At Least 4</option>";
	html+="<option value=\"5\" "+isThisBath(11)+">At Least 5</option>";
	html+="<option value=\"6\" "+isThisBath(12)+">At Least 6</option>";
	html+="<option value=\"7\" "+isThisBath(13)+">At Least 7</option>";
	html+="<option value=\"8\" "+isThisBath(14)+" >At Least 8</option>";
	html+="<option value=\"9\" "+isThisBath(15)+">At Least 9</option>";
    html+="</select>";
	html+="</td><td id=\"Td7\">Sort by price:</td><td id=\"Td8\">";
    if(document.URL.toLowerCase().match("mysubscriptions")){html+="<select name=\"select\" disabled class=\"quickSearchBox\" onChange=\"sel('price',this.options[selectedIndex].value,this.selectedIndex);\" id=\"price\">";}else{html+="<select name=\"select\" class=\"quickSearchBox\" onChange=\"sel('price',this.options[selectedIndex].value,this.selectedIndex);\" id=\"price\">";}
    
  html+="<option value=\"100000\" "+isThisPrice(0)+">$100,000</option><option value=\"125000\" "+isThisPrice(1)+">$125,000</option><option value=\"150000\" "+isThisPrice(2)+">$150,000</option>";
	html+="<option value=\"175000\" "+isThisPrice(3)+">$175,000</option><option value=\"200000\" "+isThisPrice(4)+" >$200,000</option><option value=\"225000\" "+isThisPrice(5)+">$225,000</option>";
	html+="<option value=\"250000\" "+isThisPrice(6)+" >$250,000</option><option value=\"275000\" "+isThisPrice(7)+">$275,000</option><option value=\"300000\" "+isThisPrice(8)+">$300,000</option>";
	html+="<option value=\"325000\" "+isThisPrice(9)+">$325,000</option><option value=\"350000\" "+isThisPrice(10)+">$350,000</option><option value=\"400000\" "+isThisPrice(11)+">$400,000</option>";
	html+="<option value=\"450000\" "+isThisPrice(12)+">$450,000</option><option value=\"500000\" "+isThisPrice(13)+">$500,000</option><option value=\"550000\" "+isThisPrice(14)+">$550,000</option>";
	html+="<option value=\"600000\" "+isThisPrice(15)+">$600,000</option><option value=\"650000\" "+isThisPrice(16)+" >$650,000</option><option value=\"700000\" "+isThisPrice(17)+">$700,000</option>";
	html+="<option value=\"750000\" "+isThisPrice(18)+">$750,000</option><option value=\"800000\" "+isThisPrice(19)+">$800,000</option><option value=\"850000\" "+isThisPrice(20)+">$850,000</option>";
	html+="<option value=\"900000\" "+isThisPrice(21)+">$900,000</option><option value=\"1000000\" "+isThisPrice(22)+">$1,000,000</option><option value=\"1100000\" "+isThisPrice(23)+">$1,100,000</option>";
	html+="<option value=\"1200000\" "+isThisPrice(24)+" >$1,200,000</option><option value=\"1300000\" "+isThisPrice(25)+">$1,300,000</option><option value=\"1400000\" "+isThisPrice(26)+">$1,400,000</option>";
	html+="<option value=\"1500000\" "+isThisPrice(27)+">$1,500,000</option><option value=\"1600000\" "+isThisPrice(28)+">$1,600,000</option><option value=\"1750000\" "+isThisPrice(29)+">$1,750,000</option>";
	html+="<option value=\"2000000\" "+isThisPrice(30)+">$2,000,000</option><option value=\"2500000\" "+isThisPrice(31)+">$2,500,000</option><option value=\"3000000\" "+isThisPrice(32)+">$3,000,000</option>";
	html+="<option value=\"3500000\" "+isThisPrice(33)+" >$3,500,000</option><option value=\"4000000\" "+isThisPrice(34)+">$4,000,000</option><option value=\"4500000\" "+isThisPrice(35)+">$4,500,000</option>";
	html+="<option value=\"5000000\" "+isThisPrice(36)+">$5,000,000</option><option value=\"6000000\" "+isThisPrice(37)+">$6,000,000</option><option value=\"8000000\" "+isThisPrice(38)+">$8,000,000</option>";
	html+="<option value=\"90000000\" "+isThisPrice(39)+">no limit</option>";
  html+="</select></td></tr></table>";
					   
	return html;
}
