var pos = 0;
var aktiv = null;
var preloadbilder = new Array('b1h.gif','b2h.gif','b3h.gif','b4h.gif','b5h.gif','b6h.gif','prac.gif','prahot.gif','praoff.gif','pruc.gif','pruhot.gif','pruoff.gif');
var imageSet = new Array(preloadbilder.length);

function scrollinit() {
	if (document.getElementById('scroller').offsetHeight > 222) {
		document.getElementById('pfeil_rauf').style.visibility = 'visible'; 
		document.getElementById('pfeil_runt').style.visibility = 'visible'; 
	}
}
function runt(sp) {
	hoehe = document.getElementById('scroller').offsetHeight;
	diffhoehe = hoehe - 222;
	negativhoehe = 0 - diffhoehe;
	if (pos < negativhoehe) {
		document.images['pf_runt'].src = 'images/pruoff.gif';
		stopscroll();
	}else{
		pos = pos - sp;
		aktiv = setTimeout("runt("+sp+")",1)
		document.getElementById('scroller').style.marginTop = pos +'px';
		document.images['pf_rauf'].src = 'images/prac.gif';
		document.images['pf_runt'].src = 'images/pruhot.gif';
	}
}
function rauf(sp) {
	if (pos >= 0) {
		document.images['pf_rauf'].src = 'images/praoff.gif';
		stopscroll();
	}else{
		pos = pos + sp;
		aktiv = setTimeout("rauf("+sp+")",1)
		document.getElementById('scroller').style.marginTop = pos +'px';
		document.images['pf_runt'].src = 'images/pruc.gif';
		document.images['pf_rauf'].src = 'images/prahot.gif';
	}
}
function stopscroll() {
	if (aktiv != null) {		
		clearTimeout(aktiv);
	}
	if (pos < 0) {
		document.images['pf_rauf'].src = 'images/prac.gif';		
	}
	if (pos > negativhoehe) {
		document.images['pf_runt'].src = 'images/pruc.gif';
	}
}
function swap(objekt) {
	document.images[objekt].src = 'images/'+objekt+'h.gif';
}
function swapback(objekt) {
	document.images[objekt].src = 'images/'+objekt+'.gif';
}
function preload() {
	for(x=0;x< preloadbilder.length; x++) {
		imageSet[x] = new Image(100,50);
		imageSet[x].src = "images/"+preloadbilder[x];
	}
}