var do_ajax = function(all_arguments) {
	var the_link		= (all_arguments['url'] === undefined ? '' : all_arguments['url']);
	var the_data		= (all_arguments['data'] === undefined ? {} : all_arguments['data']);
	var the_context		= (all_arguments['context'] === undefined ? '' : all_arguments['context']);
	var the_default_callback = (all_arguments['default_func'] === undefined ? function(){} : all_arguments['default_func']);
	var the_success_callback = (all_arguments['success'] === undefined ? function(){} : all_arguments['success']);
	var the_type = (all_arguments['type'] === undefined ? 'GET' : (((all_arguments['type'].toUpperCase() == 'POST') || (all_arguments['type'].toUpperCase() == 'GET')) ? all_arguments['type'].toUpperCase() : 'GET'));
	var the_returnVal = 'json';

	/* Chiamata */
	$.ajax({
		type: the_type,
		url: the_link,
		data: the_data,
		dataType: the_returnVal,
		context: the_context,
		
		success: function(resVal){
			the_success_callback.call(this, resVal);
		},
		
		error: function(){
			$(this).html('Si è verificato un errore imprevisto, si prega di riprovare più tardi. Grazie.');
			the_default_callback.call();
		},
		
		statusCode: {
			404: function(){
				$(this).html('Si è verificato un errore imprevisto, si prega di riprovare più tardi. Grazie.');
				the_default_callback.call();
			}
		}
	})
}


$(document).ready(function(){
	var scrollingDiv = $('.scrolling_banner');

	$(window).scroll(function(){
		scrollingDiv
			.stop()
			.animate({'top': ($(window).scrollTop() + 2) + "px"}, 400, 'easeInExpo');
	})
})


$(window).load(function(){
	$('.twitter-share-button').css('margin-bottom', '-3px');
	
	setInterval(function(){
		$.get('/', {'checks':1});
	}, 120000);
})
