var ls_search_location_type;
var la_search_loc_txt = {us: "Enter zipcode or city name",
                         ca: "Enter postalcode or city name",
                         intl: "Enter city name"};
function change_country() {
    var country_select = document.getElementById('country');
    var country_code = country_select.options[country_select.selectedIndex].value;

    if (country_code == 'US' || country_code == 'CA') {
        if (country_code == 'US') {
            ls_search_location_type = 'us';
        } else if(country_code == 'CA') {
            ls_search_location_type = 'ca';
        }
    } else {
        ls_search_location_type = 'intl';
    }
    update_location_box_txt();
}
function do_search() {
    if ($("#location_id").attr("value") == la_search_loc_txt[ls_search_location_type]) {
        $("#location_id").attr("value", "");
    }
    $("#search_form").submit();
}
function update_location_box_txt() {
    $("#location_id").attr("value", la_search_loc_txt[ls_search_location_type]);
}
function update_near_box(b_focus) {
    var e_box = $("#location_id");
    if (b_focus && e_box.attr("value") == la_search_loc_txt[ls_search_location_type]) {
        e_box.attr("value", "");
    } else {
        if (e_box.attr("value") == "") {
            update_location_box_txt();
        }
    }
}

