window.onload = initPic;
var blPosition = 1;
var blAmount = 0;

function initPic() {
	for (i = 0; i < 20; i++) {
		if ($("bl_thumb_inner_" + i)) {
			blAmount++;
		}
	}

	showPic(0);
	showBar();
	showArrows();
//alert(blAmount);

	reposElements();
}

function showBar() {
	for (i = 1; i < 6; i++) {
		if ($("bl_thumb_inner_" + ((i * blPosition) - 1))) {
			$("bl_thumb_" + (i - 1)).innerHTML = $("bl_thumb_inner_" + (i * blPosition - 1)).innerHTML;
		}
		else {
			$("bl_thumb_" + (i - 1)).innerHTML = "&nbsp;";
		}
	}
//alert(blPosition);
}

function showArrows() {
//alert(Math.ceil(blAmount / 5) + " "  + blPosition);
	if (blAmount > 5 && Math.ceil(blAmount / 5) > blPosition) {
		$("bl_arrow_right").style.display = "block";
	}
	else {
		$("bl_arrow_right").style.display = "none";
	}

	if (blPosition > 1) {
		$("bl_arrow_left").style.display = "block";
	}
	else {
		$("bl_arrow_left").style.display = "none";
	}
}

function showPic(selectedId) {
	$("big_bild").innerHTML = '<img src="img/' + $("IS_bigImage_" + selectedId).innerHTML + '" alt="" border="0" />';
}

function blPageF() {
	blPosition++;
	showBar();
	showArrows();
}

function blPageB() {
	blPosition--;
	showBar();
	showArrows();
}

