
// display a list of developments in the town/county selected
function quickSearch(objThis, rootPath)
{
	var selectedValue = objThis.options[objThis.selectedIndex].value;
	var f = document.forms[0];

	// perform search if anything other than the the top 2 list items
	// are selected
	if( selectedValue != '(any)' )
	{
		/* The viewstate of this page will not match the viewstate of the destination page,
		so it must be disabled before a quick search is performed
		*/
		f.__VIEWSTATE.disabled = true;
		
		if( rootPath  )
		{
			if( typeof(strBaseHref) != 'undefined'  )
				f.action = strBaseHref + 'ResultsTown.aspx';
			else
				f.action = rootPath + 'ResultsTown.aspx';
		}
		else
		{
			if( typeof(strBaseHref) != 'undefined' )
				f.action = strBaseHref + 'ResultsTown.aspx';
			else
				f.action = 'ResultsTown.aspx';
		}
		
		f.submit();
	}
}
		
// if a development is selected on the quick search, go straight to the
// development page
function showDev(objThis, rootPath)
{
	var shortCode = objThis.options[objThis.selectedIndex].value;
	
	if( shortCode != '(any)' )
	{
		if( rootPath )
		{
			if( typeof(strBaseHref) != 'undefined'  )
				document.location.href = strBaseHref + 'SiteDetails.aspx?shortcode=' + shortCode;
			else
				document.location.href = rootPath + 'SiteDetails.aspx?shortcode=' + shortCode;
			
		}
		else
		{
			if( typeof(strBaseHref) != 'undefined'  )
				document.location.href = strBaseHref + 'SiteDetails.aspx?shortcode=' + shortCode;
			else
				document.location.href = 'SiteDetails.aspx?shortcode=' + shortCode;
		}
				
	}
}

// display a message if the user clicks the go button next to the town drop-down
function goTownSearch()
{
	alert ("Please select a Town from the list");
}

// display a message if the user clicks the go button next to the county drop-down
function goCountySearch2()
{
	alert ("Please select a County from the list");
}

// perform a search when the user selects something from the drop-down
function goCountySearch(fieldName)
{
	var f = document.forms[0];
	quickSearch(eval('f.' + fieldName + '.value'));
}

// display a message if the user clicks the go button next to the development drop-down
function goDevSearch()
{
	alert ("Please select a Development from the list");
}

// reset the quick search drop-downs (when the user click the back button on the browser)
function resetQuickSearch()
{
	var f = document.forms[0];
	var i = 0;
	
	for( i = 0; i < f.elements.length; i++ )
	{
		if( f.elements[i].id.indexOf('lstTown') > -1 )
			f.elements[i].selectedIndex = 0;
		else if( f.elements[i].id.indexOf('lstCounty') > -1 )
			f.elements[i].selectedIndex = 0;
		else if( f.elements[i].id.indexOf('lstDevelopment') > -1 )
			f.elements[i].selectedIndex = 0;
	}
}