<!--
var ajax = new sack();

function getSubdivisions(selArea, selSubdivision)
{
	var areaName = selArea.options[selArea.selectedIndex].value;
	document.getElementById(selSubdivision).options.length = 0;	// Empty item select box

	ajax.requestFile = '/agent_site/res/includes/agents/subdivisions_home.asp?area='+areaName;	// Specifying which file to get
	//ajax.onCompletion = createItems();	// Specify function that will be executed after file has been found
	ajax.onCompletion = function() {var obj = document.getElementById(selSubdivision); eval(ajax.response);}
	ajax.runAJAX();		// Execute AJAX function

}

function updateSearchAction(searchtype) {

	if (searchtype == 'map') {
		document.frmMainSearch.action = 'mls_maps.asp'
	}	else {
		document.frmMainSearch.action = 'mls.asp'
	}

}

function validateLPrice(){
		
	var lPrice = document.getElementById('lprice');
	var uPrice = document.getElementById('uprice');
	var minPrice = parseInt(lPrice.options[lPrice.selectedIndex].value);
	var maxPrice = parseInt(uPrice.options[uPrice.selectedIndex].value);
	var newSelected = false;
	var newMax = lPrice.options[lPrice.selectedIndex + 1].value;
	
	if(isNaN(maxPrice))
		maxPrice = 0;
		
	if(maxPrice > newMax)
		newMax = maxPrice;
	
	for (var i=1;i<lPrice.options.length; i++)
		if(parseInt(lPrice.options[i].value) <= newMax)
			lPrice.options[i].style.color='#000000';
		else
			break;

	for (var i=uPrice.options.length - 1;i>=0; i--) {
		if(parseInt(uPrice.options[i].value) < minPrice)
		{
			uPrice.options[i].style.color = '#CCCCCC';
			if(!newSelected && maxPrice < minPrice)
				if( (i + 2) < uPrice.options.length)
				{					
					if(uPrice.selectedIndex != 0)
						uPrice.options[i + 2].selected = true;
					newSelected = true;
				}
		}
		else
			uPrice.options[i].style.color='#000000';
	}

}

function validateUPrice(){	

	var lPrice = document.getElementById('lprice');
	var uPrice = document.getElementById('uprice');
	var minPrice = parseInt(lPrice.options[lPrice.selectedIndex].value);
	var maxPrice = parseInt(uPrice.options[uPrice.selectedIndex].value);
	
	if(isNaN(minPrice))
		minPrice = 0;
	
	uPrice.options[uPrice.selectedIndex].style.color = '#000000';
	
	for (var i=lPrice.options.length - 1;i>=0; i--) {
		if(parseInt(lPrice.options[i].value) >= maxPrice)
		{
			lPrice.options[i].style.color='#CCCCCC';
			if( minPrice > maxPrice)
			{
				lPrice.options[i - 1].selected = true;	
				lPrice.options[i - 1].style.color = '#000000';
			}
		}	
		else if(parseInt(lPrice.options[i].value) >= minPrice)
			lPrice.options[i].style.color='#000000';
	}
}
//-->