/**
    * Written by Rob Schmitt, The Web Developer's Blog
    * http://webdeveloper.beforeseven.com/ 
    */

    /**
    * The following variables may be adjusted
    */
    $.extend({
        getUrlVars: function() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        },
        getUrlVar: function(name) {
            return $.getUrlVars()[name];
        }
    });

    var active_color = '#000'; // Colour of user provided text
    var inactive_color = '#336699'; // Colour of default text
    var byTerm = $.getUrlVar('q'); // Is there a query strring?

    /**
    * No need to modify anything below this line
    */

    $(document).ready(function() {
        if (String.IsNullOrEmpty(byTerm)) {
            $("input.default-value").css("color", inactive_color);
            var default_values = new Array();
            $("input.default-value").focus(function() {
                if (!default_values[this.id]) {
                    default_values[this.id] = this.value;
                }
                if (this.value == default_values[this.id]) {
                    this.value = '';
                    this.style.color = active_color;
                }
                $(this).blur(function() {
                    if (this.value == '') {
                        this.style.color = inactive_color;
                        this.value = default_values[this.id];
                    }
                });
            });
        }
    });
    String.IsNullOrEmpty = function(value) {
        var isNullOrEmpty = true;
        if (value) {
            if (typeof (value) == 'string') {
                if (value.length > 0)
                    isNullOrEmpty = false;
            }
        }
        return isNullOrEmpty;
    }
