var timer = "";

function doScroll(drct) {
	var divScroller = document.getElementById('ccasecontain');
	if (drct=='up') {
		divScroller.scrollTop -= 5;
		if (divScroller.scrollTop == document.getElementById('scroll1').scrollHeight ) {
			scrollStop('u');
		}		
	}
	if (drct=='down') {
		divScroller.scrollTop += 5;
		if (divScroller.scrollTop == 0) {
			scrollStop('d');
		}
	}

	timer = setTimeout("doScroll('"+drct+"')",25);
}

function doScrollLoop(drct) {
	var divScroller = document.getElementById('ccasecontain');
	if (drct=='up') {
		divScroller.scrollTop -= 5;
		if (divScroller.scrollTop <= 0 ) {
			divScroller.scrollTop = document.getElementById('scroll1').scrollHeight+10;
		}		
	}
	if (drct=='down') {
		divScroller.scrollTop += 5;
		if (divScroller.scrollTop >= document.getElementById('scroll1').scrollHeight+10) {
			divScroller.scrollTop = 0;
		}
	}

	timer = setTimeout("doScrollLoop('"+drct+"')",25);
}

function scrollStop(scrollDirection) {
	switch (scrollDirection) {
		case 'u':
			break;
		case 'd':
			break;
	}

	clearTimeout(timer);
}


window.onload=function() {
 	// SCROLLERS
 	var direction="right";

	if (document.getElementById('prodsel')) {
		
		curTop = document.getElementById('prodsel').offsetTop;
		document.getElementById('ccasecontain').scrollTop = curTop - 120;
		
	}



 	if (document.getElementById('ccasecontain')) { 
 		//doScroll(direction);
 	}
 	
 	if (document.getElementById('ccasecontain')) { 
		document.getElementById('ccasecontain').onmouseover = function() {
			//scrollStop('r');
		}
	}
 	if (document.getElementById('ccasecontain')) { 
		document.getElementById('ccasecontain').onmouseout = function() {
			//doScroll(direction);
		}
	}	
		

 	if (document.getElementById('scrup')) { 	
		document.getElementById('scrup').onmouseover = function() {
			scrollStop('d');
			direction = "up";
			doScroll('up');
		}
		document.getElementById('scrup').onmouseout = function() {
			scrollStop('u');
		}
	}
	
 	if (document.getElementById('scrdown')) { 	
		document.getElementById('scrdown').onmouseover = function() {
			scrollStop('u');
			direction = "down";
			doScroll('down');
		}
		document.getElementById('scrdown').onmouseout = function() {
			scrollStop('d');
		}
	}

	
	
};

