jQuery.fn.extend({
    getSelect: function(url, callback)
    {
        var nocache = new Date();
        var obj = this;
        url += (/\?/i.test(url) ? '&' : '?') + 'nocache=' + nocache.getTime();
        JsHttpRequest.query(url, {}, function(result, text) { obj.fillSelect(result); if (callback) { callback(); } });
    },

    fillSelect: function(fill)
    {
        $(this).empty();
        for (i = 0; i < fill.length; i++) {
            $(this).append($('<option value="' + fill[i].val + '"' + (fill[i].sel ? ' selected="selected"' : '') + '>' + fill[i].text + '</option>'));
        }
    }
});

jQuery(function($) {
    $('.hintbox').each(function() {
        if ($(this).val()) {
            $(this).removeClass('hintbox');
        } else {
            $(this).val(this.title);
        }
    }).focus(function() {
        if ($(this).hasClass('hintbox')) {
            $(this).removeClass('hintbox');
            $(this).val('');
        }
    }).blur(function() {
        if (!$(this).val()) {
            $(this).addClass('hintbox');
            $(this).val(this.title);
        }
    });
    $('.hintbox').closest('form').submit(function() {
        $('.hintbox', this).each(function() {
            if ($(this).hasClass('hintbox')) {
                $(this).val('');
            }
        });
    });
})
