function scroll(sDirection) {
	if(sDirection == 'left') {
		$('#topleft, #topright, #bottomleft, #bottomright').animate({left: -500}, 1500, function(){
			$('#topleft, #topright, #bottomleft, #bottomright').each(function(){
				$(this).remove();
			});
		});

		iSource -= 2;
		$.get('/ajax/mainpage.json', {'output' : 'html', 'action' : 'refresh', 'source' : iSource}, function(data) {
			$('#backblock').html(data);

			$('#topleft-tmp, #topright-tmp, #bottomleft-tmp, #bottomright-tmp').css('left', '500px');
			$('#containertl').html($('#containertl-tmp').html());
			$('#containertr').html($('#containertr-tmp').html());
			$('#containerbl').html($('#containerbl-tmp').html());
			$('#containerbr').html($('#containerbr-tmp').html());

			$('#topleft-tmp, #topright-tmp, #bottomleft-tmp, #bottomright-tmp').animate({left: 0}, 1500, function(){
				$('#topleft-tmp').attr('id', 'topleft');
				$('#topright-tmp').attr('id', 'topright');
				$('#bottomleft-tmp').attr('id', 'bottomleft');
				$('#bottomright-tmp').attr('id', 'bottomright');
			});
		});
	} else if(sDirection == 'right') {
		$('#topleft, #topright, #bottomleft, #bottomright').animate({left: 500}, 1500, function(){
			$('#topleft, #topright, #bottomleft, #bottomright').each(function(){
				$(this).remove();
			});
		});

		iSource += 2;
		$.get('/ajax/mainpage.json', {'output' : 'html', 'action' : 'refresh', 'source' : iSource}, function(data) {
			$('#backblock').html(data);

			$('#topleft-tmp, #topright-tmp, #bottomleft-tmp, #bottomright-tmp').css('left', '-500px');
			$('#containertl').html($('#containertl-tmp').html());
                        $('#containertr').html($('#containertr-tmp').html());
                        $('#containerbl').html($('#containerbl-tmp').html());
                        $('#containerbr').html($('#containerbr-tmp').html());

			$('#topleft-tmp, #topright-tmp, #bottomleft-tmp, #bottomright-tmp').animate({left: 0}, 1500, function(){
                                $('#topleft-tmp').attr('id', 'topleft');
                                $('#topright-tmp').attr('id', 'topright');
                                $('#bottomleft-tmp').attr('id', 'bottomleft');
                                $('#bottomright-tmp').attr('id', 'bottomright');
                        });
		});
	}
}

