(function($){
	$(document).ready(function() {
		$.sendAjaxRequest = function(url, callback_function, post_values) {
			if(post_values) {
				post_values.push({name: 'mode', value : 'ajax'});
				post_values.mode = 'ajax';
			}
			else {
				post_values = {'mode' : 'ajax'};
			}
			
			$.post(url, post_values, function(data) {
				if(data && data.login == 'false') {
					alert('Время сессии истекло, необходимо перелогинится в админку.');
					return false;
				}
				else {
					if(typeof(callback_function) == 'function') {
						callback_function(data);
					}
				}
			}, 'json');
		}
		
	});
})(jQuery);
