moveBarTimeout = setTimeout('void(0)',1);

function changePage(fileName, id, title, pagenum){
	if(moveBarTimeout) clearTimeout(moveBarTimeout);
	pictureHeight = 35+28;
	//document.getElementById('newspage').style.display = 'none';
	moveBar(-pictureHeight*(pagenum-1)+180-pictureHeight);
	//alert(document.getElementById('scrollingBar').style.leftMargin);
	document.getElementById('photo').src = '/files/photos/' + fileName;
	document.getElementById('photo_a').href = '/files/photos/' + fileName;
	document.getElementById('photo_a').title = title;
	//document.getElementById('newspage').style.display = 'block';
}

function loading(active){
	if(active) {
		document.getElementById('galleryDisplayLoading').style.display='block';
	}else{
		document.getElementById('galleryDisplayLoading').style.display='none';
	}
}
function moveBar(position){
	currentPosition = parseInt(document.getElementById('scrollingBar1').style.top);
	
	
	diff = Math.round((currentPosition+position)/(2));
	document.getElementById('scrollingBar1').style.top = diff + 'px';
	//alert(currentPosition);
	if(Math.abs(currentPosition - position) > 1 ){
		
		moveBarTimeout = setTimeout('moveBar('+position+')',70);
		
	}else{
		document.getElementById('scrollingBar1').style.top = position + 'px';
	}
}

function label(id, show, offsetTop, offsetLeft, offsetParent){
//alert(offsetParent.offsetTop);
	document.getElementById(id).style.top = offsetTop + offsetParent.offsetTop + 75 + 'px';
	document.getElementById(id).style.left = offsetLeft + offsetParent.offsetLeft - 400 + 'px';
	document.getElementById(id).style.display = show;
}
function labelHideAll(){
	i = 1;
	while(document.getElementById('l_'+i)){
		document.getElementById('l_'+i).style.display = 'none';
		i++;
	}
}