function resizeImages() {
	
	var imageMaxWidth = 300;
	var imageMaxHeight = 300;
	
	for (var i = 0; i < document.images.length ;i++){
		if (document.images[i].className == 'resizeImage') {
			var imageWidth = document.images[i].width;
			var imageHeight = document.images[i].height;
			
			if ((imageMaxWidth != 0 && imageWidth > imageMaxWidth) || (imageMaxHeight != 0 && imageHeight > imageMaxHeight)) {
				if (imageMaxWidth != 0) var div1 = imageMaxWidth / imageWidth;
				else var div1 = 1;
				if (imageMaxHeight != 0) var div2 = imageMaxHeight / imageHeight;
				else var div2 = 1;
							
				if (div1 < div2) {
					document.images[i].width = imageMaxWidth;
					document.images[i].height = Math.round(imageHeight * div1);
				}
				else {
					document.images[i].height = imageMaxHeight;
					document.images[i].width = Math.round(imageWidth * div2);
				}
				
				if (!isLinked(document.images[i])) {
					
			///////////////////////////// ALTE VERSION START ///////////////////////////////////////////////
				//	var popupLink = document.createElement("a");
				//	popupLink.setAttribute('href', document.images[i].src);
				//	popupLink.setAttribute('target', '_blank');
				//	popupLink.appendChild(document.images[i].cloneNode(true));
				//  document.images[i].parentNode.replaceChild(popupLink, document.images[i]);
			////////////////////////////// ALTE VERSION ENDE ///////////////////////////////////////////////
			
			//////////////////////////// NEUE VERSION START ////////////////////////////////////////////////
					image = new Image();
               		image = document.images[i];
					image.origWidth = imageWidth;
					image.origHeight = imageHeight;
					image.alt = "Verkleinerte Darstellung: Zum Vergrössern bitte klicken";
					image.title = "Verkleinerte Darstellung: Zum Vergrössern bitte klicken";
					
					image.onclick = function () {
							var altHeight;
							var altWidth;
						// Verkleinerte Grösse sichern
							altHeight = this.height;
							altWidth = this.width;
						// Setze Originalgrösse
							this.width = this.origWidth;
							this.height = this.origHeight; 
						// Setze Alternativgrösse
							this.origWidth = altWidth;
							this.origHeight = altHeight;
					};
			///////////////////////////// NEUE VERSION ENDE ///////////////////////////////////////////////					
				}
			}
		}
	}
}

function isLinked(node) {
	do {
		node = node.parentNode;
		if (node.nodeName == 'A') return true;
	}
	while (node.nodeName != 'TD' && node.nodeName != 'BODY');
		
	return false;
}