What you might try is to use the 'complete' callback: http://api.jquery.com/animate/
complete Type: Function() A function to call once the animation is complete.
So instead of having 2 instances of $(document).ready(...) you'd have only one, and your first bit of code would look like this:
$(document).ready(function() {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top}, 2000, function(){
$(window).scroll(function () {
var $win = $(window).scrollTop();
if ($win < $("#portfolio").offset().top - 50 || $win >= $("#referencje").offset().top - 50) {
window.menuup = '#404040';
window.menuover = '#FFFFFF';
window.socialup = '#00577F';
window.socialover = '#80D7FF';
$(".colleft, .boxemptyDesk, .boxcontainerleft").stop().animate({backgroundColor: "#000000"}, 1000);
$(".colright, .boxcontainerright").stop().animate({backgroundColor: "#1A1A1A"}, 1000);
$(".menu p").stop().animate({"color": "#202020"}, 1000);
$(".menu p a").stop().animate({"color": "#404040"}, 1000);
$(".social p, .social p a").stop().animate({"color": "#00577F"}, 1000);
$(".flydark").stop().animate({"opacity": "1"}, 1000);
$(".boxbiggray, .boxgray, .pboxbiggray").stop().animate({backgroundColor: "#262626"}, 1000);
$(".subtitle").stop().animate({"color": "#FFFFFF"}, 1000);
}
else if ($win >= $("#portfolio").offset().top - 50 && $win < $("#referencje").offset().top - 50) {
window.menuup = '#BFBFBF';
window.menuover = '#000000';
window.socialup = '#80D7FF';
window.socialover = '#00577F';
$(".colleft, .boxemptyDesk, .boxcontainerleft").stop().animate({backgroundColor: "#FFFFFF"}, 1000);
$(".colright, .boxcontainerright").stop().animate({backgroundColor: "#F2F2F2"}, 1000);
$(".menu p").stop().animate({"color": "#DEDEDE"}, 1000);
$(".menu p a").stop().animate({"color": "#BFBFBF"}, 1000);
$(".social p, .social p a").stop().animate({"color": "#80D7FF"}, 1000);
$(".flydark").stop().animate({"opacity": "0"}, 1000);
$(".boxbiggray, .boxgray, .pboxbiggray").stop().animate({backgroundColor: "#D9D9D9"}, 1000);
$(".subtitle").stop().animate({"color": "#000000"}, 1000);
}
});
});
return false;
});
});