var counter = 0;	
var anfang = true;
var startposi = 0;

function slide_ini(startposition, time, start) {
	anzahl = document.getElementById("images").getElementsByTagName("img").length;
	counter = startposition;
	startposi = startposition;
	setTimeout("slide("+time+")", start);
}

function slide(time) {
	interval_slide = setInterval("change()", time);
}

function change() {
	i = counter;
	x = counter * 150;
	
	glideTo(-x,i);
	
	if (anfang == true) {
		counter++;
	} else {
		counter--;
	}
	
	if (counter == anzahl) {
		anfang = false;
		counter = anzahl - 2;
	}
	
	if (counter == 0) {
		anfang = true;
		counter = 0;
	}
}

function stop_slide() {
	clearInterval(interval_slide);
	counter = startposi - 1;
	anfang = true;
}
