
var timeractive = false;

function dogScroll(dir) {
	if (timeractive) {
	$('scrollerbody').parentNode.scrollLeft += (dir*72);
	
	//if ( (dir == 1 && $('scrollerbody').parentNode.scrollLeft < $('scrollerbody').parentNode.offsetWidth ) )
		
	setTimeout(function() { dogScroll(dir); }, 100);	
	document.onmouseup = function() { timeractive = false; document.onmouseup = null; }
	}
}



window.onload = initScroller;


function initScroller() {
	$('scrollerbody').style.width = (72 * ($('scrollerbody').getElementsByTagName('div').length/2)) + 'px';
	$('scrollerbody').parentNode.scrollLeft = 0;
}

function loadDog(id, breed, days,  cost) {
	$('dogname').firstChild.nodeValue = breed;
	
	
	$('days').firstChild.nodeValue = days;
	$('cost').firstChild.nodeValue = parseInt(parseFloat(cost)*100);


	$('dogimage').style.backgroundImage = 'url(/img/dogselector/' + id + '.jpg)';
}