var detailsWindow = null;
function launchDetails(lth)
{
	//var url = _mdc.web_template_path+"/home_details.php?lth=" + lth;
	if (_mdc.currentHome.info.listing_type == '23') // developments
        {
            var url = "/site/development_details.php?development_id="+_mdc.currentHome.id;
	    launchWindow(url);
	    return;
        }

	/*bch36: use new property URLs*/
	var url = _mdc.currentHome.address.street + "_" +
		_mdc.currentHome.address.city + "_" +
		_mdc.currentHome.address.state + "_" +
		_mdc.currentHome.address.zip;
	url = url.replace(/[^a-zA-Z0-9]+/g, "_");
	url = "/properties/" + lth + "/" + url;

	/* bch36: EVERYONE should launch in a new window, according to Greg.
	We're going to get a lot of support calls off this, then I'll complain
	at the next meeting... 

	//Old:
	if (site_id == 1285) //1285 is blueroof.com
		launchWindow(url);
	else
		window.location.href = url;
	*/

	//New:
	launchWindow(url);
}

function launchDetails2(lth)
{
	var url = _mdc.web_template_path+"/home_details2.php?lth=" + lth;
	//launchWindow(url);
	window.location.href = url;
}
function makeOffer(lth, sameWindow)
{
	var url = _mdc.web_template_path+"/submit_offer.php?lth="+lth;
	if(false)//sameWindow == null || sameWindow == false)
	{
		launchWindow(url);
	}
	else
	{
		window.location.href = url;
	}
}

function mapIt(lth)
{
	if(false)//window.opener)
	{
		window.opener.location.href = _mdc.web_template_path+"/search.php?map_it=" + lth;
		window.opener.focus();
	}
	else
	{
		window.location.href = _mdc.web_template_path+"/search.php?map_it=" + lth;
	}
}

function sendToFriend(lth, sameWindow)
{
	var url = _mdc.web_template_path+"/send_to_friend.php?lth=" + lth;
	if(false)//sameWindow == null || sameWindow == false)
	{
		launchWindow(url);
	}
	else
	{
		window.location.href = url;
	}
}


function seeIt(lth, sameWindow)
{
	var url = _mdc.web_template_path+"/see_it.php?lth=" + lth;
	if(false)//sameWindow == null || sameWindow == false)
	{
		launchWindow(url);
	}
	else
	{
		window.location.href = url;
	}
}

function launchRateNeighborhood(county_id, city_name, sameWindow)
{
	
	var url = _mdc.web_template_path+"/area.php";
	if(county_id && county_id.length > 0)
	{
		url += "?county="+county_id+"&city="+city_name;
	}
	
	if(false)//sameWindow == null || sameWindow == false)
	{
		launchWindow(url);
	}
	else
	{
		window.location.href = url;
	}
}

function launchWindow(url)
{
	if(window.opener)
	{
		window.location.href = url;
		window.focus();
	}
	else
	{
		detailsWindow = window.open(url, "home_details", "toolbar=0,width=1100,height=500,top=100,left=100,scrollbars=1,resizable=1;");
		detailsWindow.focus();
	}
}

var tourWindow = null;
function launchTour(url)
{
	tourWindow = window.open(url, "tour", "menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no");
	tourWindow.focus();
}

var changeWindow = null;
function launchChangeRequest(lth)
{
	var url = _mdc.web_template_path+"/geo_change.php?lth=" + lth;
	changeWindow = window.open(url, "change_request", "menubar=no,status=no,resizable=yes,scrollbars=yes,toolbar=no,location=no");
	changeWindow.focus();
}
