<!--
/*
Copyright © 2011 L.E.T. Group, Inc.
The information on this page may not be reproduced or republished on another webpage or website without the written consent by L.E.T. Group, Inc.
www.letgroup.com
Author: Brenner Vasconcelos @ LET
Date: 03/01/2011
Objective: handle property search
*/
/* This code was created by Doug Vanderweide and modified by LET Group on 4/19/2011 */
function bindCity() {
     //disable child select list
     $("#browseCity").attr("disabled", true);
     //clear child select list's options
     $("#browseCity").html('');
 
     //querystring value is selected value of parent drop down list
     var qs = $("#browseState").val();
     //if user selected a separator, show error
     if(qs == '') {
          alert('You must select a state to continue the search.');
     }
     else {
          //show message indicating we're getting new values
          $("#browseCity").append(new Option('Retrieving cities...'));
          //declare options array and populate
          var cityOptions = new Array();
          $.get("inc-load-city-list.php?sc=" + qs, function(data) {
                    eval(data);
                    if(cityOptions.length > 0) {
                         addOptions(cityOptions);
                    }
               }
          );
     }
}

function addOptions(cl) {
     //enable child select and clear current child options
     $("#browseCity").removeAttr("disabled");
     $("#browseCity").html('');
     //re-populate child list with array from helper page
     var city = document.getElementById('browseCity');
     for(var i = 0; i < cl.length; i++) { 
          city.options[i] = new Option(cl[i].text, cl[i].value);
     }
}

// author: Brenner Vasconcelos
function doCheckFields() {
	var state = jQuery.trim($("#browseState").val());
	var isOK = false;
	
	if (state == "") {
		alert("You must select at least one state to make search.");
		$("select#browseState").focus();
	} else {
		isOK = true;
	}
	return isOK;
}
//-->
