
var scrollitems = '';
var scrollprev = '';
var scrollnext = '';
var firstposition = 0;
var endposition = 0;
var currentposition = 0;

function ScrollPrev() {
	getVars();
	var nextposition = parseInt(scrollitems.style.left) + 230;
	if (scrollprev.className == '') {if (currentposition < firstposition) {scrollitems.style.left = nextposition+'px';}}
	checkArrows(nextposition);
}

function ScrollNext() {
	getVars();
	var nextposition = parseInt(scrollitems.style.left) - 230;
	if (scrollnext.className == '') {if (nextposition >= endposition) {scrollitems.style.left = nextposition+'px';}}
	checkArrows(nextposition);
}

function moveToThumb() {
	getVars();
	var showthisthumb = document.getElementById('showthisthumb');
	var thisthumbposition = showthisthumb.offsetLeft;
//	if (thisthumbposition >= 920) {
//		nextposition = -1 * (thisthumbposition - 690);
		nextposition = -1 * (thisthumbposition);
		if (parseInt(scrollitems.offsetWidth) <= 920) {nextposition = 0;} else {
			if (nextposition < endposition) {nextposition = endposition;}
		}
		scrollitems.style.left = nextposition+'px';
		checkArrows(nextposition);
//	}
}

function getVars() {
	scrollitems = document.getElementById('scrollitems');
	scrollprev = document.getElementById('scrollprev');
	scrollnext = document.getElementById('scrollnext');
	firstposition = 0;
	endposition = -1 * (parseInt(scrollitems.offsetWidth) - 920);
	currentposition = parseInt(scrollitems.style.left);
}

function checkArrows(newposition) {
//	alert(newposition);
//	alert(endposition);
	if (newposition < firstposition) {scrollprev.className='';} else {scrollprev.className='gray';}
	if (newposition > endposition) {scrollnext.className='';} else {scrollnext.className='gray';}
}
