/**
 * Sets the hidden expanded search form variable based on value provided.
 * @author    James Swanson <james@aiminstitute.org>
 * @param     {String} value a string value from a search form field
 * @version   2009-10-29
 */
function setExpanded() // ------------------------------------------ setExpanded
{
    /*global $, $F */
    $('expanded').value = ($F('employer').empty()) ? 'N' : 'Y';
} // setExpanded

/**
 * Initializes the page after load.
 * @author    James Swanson <james@aiminstitute.org>
 * @see       #setExpanded
 * @version   2009-11-05
 */
function initPage() // ------------------------------------------------ initPage
{
    /*global Ajax, Event, setExpanded */
    Event.observe( 'employer', 'keypress', setExpanded );
    Event.observe( 'keywords', 'focus', function( e ) {
        e.target.select();
    } );
    Event.observe( 'location', 'focus', function( e ) {
        e.target.select();
    } );
    Event.observe( 'employer', 'focus', function( e ) {
        e.target.select();
    } );
    (new Ajax.Autocompleter( 'location', 'location-menu', '/locate/update_locations', { minChars: 2, frequency: 0.25 } ));
    (new Ajax.Autocompleter( 'employer', 'employer-menu', '/locate/update_employers', { minChars: 2, frequency: 0.25 } ));
} // initPage
