// JavaScript Document
var path='http://www.foreclosurelistings.com/';
function change_state()
{
	if($("#state_sg").val() != '')
		window.location.href = path + 'list/'+$("#state_sg").val()+'/';
	else
		window.location.href = path + 'list-state/';
}
function change_county()
{
	if($("#county_name").val() != '')
		window.location.href = path + 'list/'+$("#state_sg").val()+'/'+$("#county_name").val()+'/';
	else
		window.location.href = path + 'list/'+$("#state_sg").val()+'/';
}
function change_city()
{
	if($("#city").val() != '')
		window.location.href = path + 'list/'+$("#state_sg").val()+'/'+$("#county_name").val()+'/'+$("#city").val()+'/';
	else
		window.location.href = path + 'list/'+$("#state_sg").val()+'/'+$("#county_name").val()+'/';
}
function change_zipcode()
{
	if($("#zipcode").val() != '')
	{
		window.location.href = path + 'list/zipcode/'+$("#zipcode").val()+'/';
	}	
}
/*function goToJoin(property_id, property_type)
{
	var join_property_id = document.getElementById('join_property_id');
	var join_property_type = document.getElementById('join_property_type');
	var form = document.getElementById('form_join');
	join_property_id.value = property_id;
	join_property_type.value = property_type;
	form.submit();
}*/
function openPreview()
{
//	pageTracker._trackEvent('Property Preview', 'Hits', 'Lview');
	openModal('http://www.foreclosurelistings.com/sample_join.html',740,500,'yes');
}
function scrollToProperty(state, county, city, pid)
{
	regs_per_page = 10;
	url = path + 'list/'+state+'/'+county+'/'+city+'/#property_id='+pid;
	window.location.href = url;
}
function scrollToLaws()
{
	var target = $('#state-laws');
	if (target.length)
	{
		var top = target.offset().top;
		$('html,body').animate({scrollTop: top}, 500);
		window.location.hash = 'laws';
		return false;
	}
}

