/***************************************************************
  * General UI-manager
  ***************************************************************/


    var Ui = {


       /**
        * Start building the user interface
        */
        build:function()
        {
            this.buildSearchForm();
        },


       /**
        * Build additional functionality for search form
        */
        buildSearchForm:function()
        {
            // Get reference to fields
            var legend   = document.getElementById('search').getElementsByTagName('LEGEND').item(0);
            var field    = document.getElementById('search').getElementsByTagName('INPUT').item(0);

            // Set default value
            field.defaultValue = legend.innerHTML;

            // When fields receives focus
            field.onfocus = function()
            {
                if (this.value == this.defaultValue)
                    this.value = '';

                this.className = '';
            };

            // When field loses focus
            field.onblur = function()
            {
                if (!this.value.split(' ').join('').length || this.value == this.defaultValue)
                {
                    this.className = 'default';
                    this.value = this.defaultValue;
                }
            };

            // Set initial state
            field.onblur();
        }
    };

    // Initiate when page has loaded
    window.onload = function()
    {
        Ui.build();
    };


