// This script provides the effects on the search bar when you switch between city search and miles search.

// Variable Declarations
var miles;
var zip_code;
var city;
var state_province;

// Reset Flashing Form Element's Colors
function resetFormElementColors() {

    "use strict";

    miles.style.backgroundColor = '#FFFFFF';
    zip_code.style.backgroundColor = '#FFFFFF';
    city.style.backgroundColor = '#FFFFFF';
    state_province.style.backgroundColor = '#FFFFFF';
    miles.style.color = '#666666';
    zip_code.style.color = '#666666';
    city.style.color = '#666666';
    state_province.style.color = '#666666';
}

// Make City Search Form Appear
function presentCitySearchInterface() {

    "use strict";

    // Hide Miles Search Elements
    miles = document.getElementById('miles');
    miles.style.display = 'none';
    zip_code = document.getElementById('zip_code');
    zip_code.style.display = 'none';

    // Show City Search Elements
    city = document.getElementById('city');
    city.style.display = 'inline';
    state_province = document.getElementById('state_province');
    state_province.style.display = 'inline';

    // Make Changed Form Elements Flash
    city.style.backgroundColor = '#de6811';
    state_province.style.backgroundColor = '#de6811';
    city.style.color = '#FFFFFF';
    state_province.style.color = '#FFFFFF';
    window.setTimeout("resetFormElementColors()", 250);
}

// Make Miles Search Form Appear
function presentMilesSearchInterface() {

    "use strict";

    // Hide City Search Elements
    city = document.getElementById('city');
    city.style.display = 'none';
    state_province = document.getElementById('state_province');
    state_province.style.display = 'none';
    
    // Show Miles Search Elements
    miles = document.getElementById('miles');
    miles.style.display = 'inline';
    zip_code = document.getElementById('zip_code');
    zip_code.style.display = 'inline';

    // Make Changed Form Elements Flash
    miles.style.backgroundColor = '#de6811';
    zip_code.style.backgroundColor = '#de6811';
    miles.style.color = '#FFFFFF';
    zip_code.style.color = '#FFFFFF';
    window.setTimeout("resetFormElementColors()", 250);
}
