var imgNumber = 0

var notWhitespace = /\S/;
function cleanWhitespace(node) {
	for (var x = 0; x < node.childNodes.length; x++) {
		var childNode = node.childNodes[x]
		if ((childNode.nodeType == 3)&&(!notWhitespace.test(childNode.nodeValue))) {
// that is, if it's a whitespace text node
			node.removeChild(node.childNodes[x])
			x--
		}
		if (childNode.nodeType == 1) {
// elements can have text child nodes of their own
			cleanWhitespace(childNode)
		}
	}
}

//cleans the withe spaces on the whole document onload
//but you may also clean on target nodes only

//window.onload = function(){
	//cleanWhitespace(document);
	//clickDot(0);
//	alert("geladen");
//}
	
function NextImage() {

	
	if (imgNumber == (images.length-1)) {
		imgNumber = -1;
	}
	imgNumber++
	document.images["slideshow"].src = images[imgNumber]['image'];
	document.images["slideshow"].width = images[imgNumber]['width'];
	document.images["slideshow"].height = images[imgNumber]['height'];
		

	clickDot(imgNumber);
}

// function clickDot(j){
function clickDot(j,k){
	var dot;
	var list=document.getElementById('navimg');
	for (var i=0; i<list.childNodes.length; i++){
		dot=list.childNodes[i];
		dot.style.backgroundPosition='0px 0px';
		
	}
	dot=document.getElementById('dot_'+j);
	//dot.style.backgroundPosition='0px -40px';
	dot.style.backgroundPosition='0px '+k+'px';
}
