// JavaScript Document

var d3mlsSearch = 
{
	selectedState : function(state)
	{
		$("#d3mls_search .stateSelected > select").attr("disabled",true).parent().hide();
		if (typeof state != "undefined" && state != null && state!="")
		{
			$("#d3mls_search ."+state+"DropDown > select").removeAttr("disabled").parent().show();
		}
		else
		{
			$("#d3mls_search .ALLDropDown").removeAttr("disabled").show();
		}
	},
	
	showHideRefineOptions : function(showHideLink)
	{
		if (document.getElementById("refineOptionsDiv").style.display =="none"){
			document.getElementById("refineOptionsDiv").style.display ="block";
			showHideLink.innerHTML = "Hide Options";
		}
		else {
			document.getElementById("refineOptionsDiv").style.display ="none";
			showHideLink.innerHTML = "More Options";
		}

		return false;
	},
	
	applySameSelects : function(name, selectedIndex)
	{
		$("#d3mls_search select[name="+name+"]").each(function(){ $(this).get(0).selectedIndex = selectedIndex; });
	},
	
	applySameInputs : function(name, value)
	{
		$("#d3mls_search input[name="+name+"]").val(value);
	},

	selectAreaCounty : function(townCheckBox, county, area)
	{
		/*if ($(townCheckBox).is(':checked'))
			$(townCheckBox).parents(".row > .area").attr("checked",true).parents(".county").attr("checked",true);
		else 
			$(townCheckBox).parents(".area").attr("checked",false).parents(".county").attr("checked",false);
		console.log($(townCheckBox).parents(".row").find('.county').val());
		console.log($(townCheckBox).parents(".row").find('.county').find(townCheckBox).parents(".area").val());*/
	}

};
