function resizeElements() {
//	$('.wrapper').css("background", "#ccc");


	if ($('.footer').length) {
		
		$('.wrapper').css("margin-bottom", 20);
		
		hWindow = $(window).height();
		yFooter = $('.footer').offset().top;
		hFooter = $('.footer').height();
		yContact = $('.contact').offset().top;
		hContact = $('.contact').height();
		
		if (hFooter != 0) { 
			$('.contact').css("top", yFooter);
			if (hWindow-yFooter > 110) { $('.contact').css("height", hWindow-yFooter); }
			hContactNew = $('.contact').height();
			if (hFooter < hContactNew) { $('.footer').css("height", hContactNew-20); }
		} else {
			$('.footer').css("background", "#fff"); 
			$('.contact').css("top", yFooter);
			if (hWindow-yFooter > 110) { $('.contact').css("height", hWindow-yFooter); }
		}
		
	}
}

$(function() { 
	resizeElements(); 
});
$(window).bind('resize', resizeElements);


/* V3
var yContact = 0;
var hWrapper = 0;
var hFooter = 0;
var hWindow = 0;
var hTop = 0;

function moveFooter() {
	yContact = $('.contact').offset().top;
	hWrapper = $('.wrapper').height();
	hTop = $('.top').height();
	hFooter = $('.footer').height();
	hWindow = $(window).height();
	h = hWrapper + hTop;
	deltaY = yContact - h - 15;
	
	paddingFooter = hWindow - h - hFooter - 35;
	
	$('.wrapper').css("padding-bottom", 10);	
	$('.footer').css("padding-bottom", paddingFooter);

	yFooter = $('.footer').offset().top;
	delta = yContact - yFooter;
	
	$('.contact').css("top", delta+75);
	
	hFooter = $('.footer').height();
	$('.contact').css("height", hFooter);
	$('.contact').css("padding-bottom", paddingFooter+10);
	
//	alert('h='+h+'   deltay='+deltaY);

}
$(function() { 
	moveFooter(); 
});
$(window).bind('resize', moveFooter);
*/

/*

///////////// V2

var yContact = 0;
var hWrapper = 0;
var hTop = 0;

function moveFooter() {
	yContact = $('.contact').offset().top;
	hWrapper = $('.wrapper').height();
	hTop = $('.top').height();
	h = hWrapper + hTop;
	deltaY = yContact - h - 15;
	
//	alert('h='+h+'   deltay='+deltaY);
	
	if (deltaY > 20) { 
		$('.wrapper').css("padding-bottom", deltaY);
	}
}
$(function() { 
	moveFooter(); 
});
$(window).bind('resize', moveFooter);
*/

/*

///////////// V1

var yContact = 0;
var yFooter = 0;

function moveFooter() {
	yContact = $('.contact').offset().top;
	deltaY = yContact - yFooter;
	
	if (deltaY > 20) { 
		$('.footer').css("margin-top", deltaY);
	}
}
$(function() { 
	yFooter = $('.footer').offset().top;
	moveFooter(); 
});

$(window).bind('resize', moveFooter);

*/
