$.fn.wait = function(time, type) {
    time = time || 1000;
    type = type || "fx";
    return this.queue(type, function() {
        var self = this;
        setTimeout(function() {
            $(self).dequeue();
        }, time);
    });
};

$.ajaxSetup({
	error: function(xhob, errMsg, extraOb){
		extraOb = extraOb || "";
		var sExtra = "";
		if (errMsg!="error") sExtra = sExtra + errMsg;
		if (extraOb!="") sExtra = sExtra + ': ' + extraOb;
		if (sExtra!="") sExtra = sExtra + '. ';
		$.jGrowl('Errore comunicando con il server. '+sExtra+'Riprovare, se il problema persiste contattare il supporto.',{theme: 'jgrowlError', sticky: true});
	}
});
