
// Script Copyright of 540 Web Solutions
// To use any scripts contact info@540web.net

var button1 = document.getElementById('button1');
var button2 = document.getElementById('button2');

button1.onmousedown = function() {
	scrollPic (1);
}

button2.onmousedown = function() {
	scrollPic (-1);
}

var pic = $('panorama');
var picSize = pic.getStyle('width').toInt();
var panWindow = $('panWindow');
var windowSize = panWindow.getStyle('width').toInt();
var scrollLength = -(picSize - windowSize);

var position = scrollLength / 2;
pic.style.left = position;


function scrollPic (direction) {
	position = position + (15 * direction);
	if (position > 0) {
		position = 0;
	} else {
		if (position < scrollLength) {
			position = scrollLength;
		} else {
			pic.style.left = position;
			var newTimeout = setTimeout('scrollPic('+direction+')',20);
		} 
	}
	button1.onmouseup = function() {
		clearTimeout(newTimeout);
	}
	button1.onmouseout = function() {
		clearTimeout(newTimeout);
	}
	button2.onmouseup = function() {
		clearTimeout(newTimeout);
	}
	button2.onmouseout = function() {
		clearTimeout(newTimeout);
	}
}

	