function load_ext(self, url, type, params, completeCallback, callback, onerror) {

    return jQuery.ajax({
        url: url,
        type: type,
        dataType: "html",
        //contentType: "application/xml; charset=windows-1251",
        data: params,
        error: function(res, textStatus, errorThrown) {
            if (onerror)
                self.each(onerror, [res, textStatus, errorThrown]);
        },
        complete: function(res, status) {
            if(completeCallback)
                self.each(completeCallback, [res.responseText, status, res]);
            // If successful, inject the HTML into all the matched elements
            if (status == "success" || status == "notmodified")
                self.html(res.responseText);

            if (!jQuery.support.scriptEval) {
                jQuery("script", self).each(function() {
                    eval(this.innerText);
                });
            }

            if(callback)
                self.each(callback, [res.responseText, status, res]);
        }
    });
    return self;
}

jQuery.fn.load_post = function(url, params, callback, onerror, completeCallback) {
    var self = this;

    return load_ext(this, url, "POST", params, completeCallback, callback, function(res, textStatus, errorThrown) {
        if (onerror) {
            onerror(res, textStatus, errorThrown);
        }
        else {
            self.html(res.responseText);
        }
    });
};

jQuery.fn.load_get = function(url, params, callback, onerror, completeCallback) {
    var self = this;

    return load_ext(this, url, "GET", params, completeCallback, callback, function(res, textStatus, errorThrown) {
        if (onerror) {
            onerror(res, textStatus, errorThrown);
        }
        else {
            self.html(res.responseText);
        }
    });
};


$(function() {
    $.extend($.fn.disableTextSelect = function() {
        return this.each(function() {
            if ($.browser.mozilla) {//Firefox
                $(this).css('MozUserSelect', 'none');
            } else if ($.browser.msie) {//IE
                $(this).bind('selectstart', function() {
                    return false;
                });
            } else {//Opera, etc.
                $(this).mousedown(function() {
                    return false;
                });
            }
        });
    });
    $.extend($.fn.enableTextSelect = function() {
        return this.each(function() {
            if ($.browser.mozilla) {//Firefox
                $(this).css('MozUserSelect', 'text');
            } else if ($.browser.msie) {//IE
                $(this).unbind('selectstart');
            } else {//Opera, etc.
                $(this).mousedown(function() {
                    return true;
                });
            }
        });
    });

    $('.noSelect').disableTextSelect(); //No text selection on elements with a class of 'noSelect'
});
