//http://randysimons.com/tijdelijk/kantoor.html

var fallbackDiv = document.getElementById('virttour');
if (fallbackDiv != null)
{
	dragStartX=0;
	dragStartY=0;
	
	deltaX=3.0;
	deltaY=0.0;
	
	backgroundPosX=0.0;
	backgroundPosY=0.0; // -70.0
	
	timeout=20;
	
	timerId=null;
	
	function dragStart(e) {
		if (!e) var e = window.event;
		fallbackDiv.onmousemove=drag;
		dragStartX=e.clientX;
		dragStartY=e.clientY;
		deltaX=0;
		deltaY=0;
		fallbackDiv.onmouseout=dragStop;
		if (timerId) {
			window.clearTimeout(timerId);
		}
		timerId=window.setTimeout('scroll()',timeout);
	}
	
	function drag(e) {
		if (!e) var e = window.event;
		deltaX=(e.clientX-dragStartX)/5;
		deltaY=(e.clientY-dragStartY)/5;
	}
	
	function dragStop() {
		fallbackDiv.onmousemove=null;
		fallbackDiv.onmouseout=null;
		if (timerId) {
			window.clearTimeout(timerId);
		}
	}
	
	function scroll() {
		backgroundPosX-=deltaX;
		backgroundPosY=Math.max(0,Math.min(-20,backgroundPosY-deltaY));
		fallbackDiv.style.backgroundPosition=Math.floor(backgroundPosX)+"px "+Math.floor(backgroundPosY)+"px";
		timerId=window.setTimeout('scroll()',timeout);
	}
	
	fallbackDiv.onmousedown=dragStart;
	fallbackDiv.onmouseup=dragStop;
	timerId=window.setTimeout('scroll()',50);
}
