$(window).load(function() {
	var box = $('#dogsForHoming'), width = 0, x, l = 0, direction = 0;
	$('.dog', box).each(function(index) {
		width += $(this).width() + 20;
	});
	x = width - box.innerWidth();
	var scrollTmr, scrollFn = function() {
		l = box.scrollLeft();
		scrollTmr = setInterval(function() {
			if (direction == 0) {
				l++;
				if (l > x) direction = 1;
			} else {
				l--;
				if (l < 0) direction = 0;
			}
			box.scrollLeft(l);
		}, 100);
	};
	box.mouseover(function() {
		clearInterval(scrollTmr);
	}).mouseout(scrollFn);
	scrollFn();
	
	var h = 0;
	$('div.dotmBox, div.introBlock').each(function() {
		if ($(this).height() > h) h = $(this).height();
	}).height(h);
});
