var Photos = new Array();
var current = 0;
function addPhoto (image, label, text, width, height)
{
	Photos[Photos.length] = new Object();
	// URL des Bildes
	Photos[Photos.length - 1]["image"] = image;
	// Titel
	Photos[Photos.length - 1]["label"] = replaceEntities(label);
	// Text der angezeigt werden soll, wenn das Bild unter der angegebenen URL nicht gefunden wurde
	Photos[Photos.length - 1]["text"] = replaceEntities(text);
	// Breite
	Photos[Photos.length - 1]["width"] = width;
	// Höhe
	Photos[Photos.length - 1]["height"] = height;
}

function replaceEntities(text) {
		if (text != null) {
			text2 = text.replace("/&auml;/g", "ä");
			text2 = text.replace("/&Auml;/g", "Ä");
			text2 = text.replace("/&ouml;/g", "ö");
			text2 = text.replace("/&Ouml;/g", "Ö");		
			text2 = text.replace("/&uuml;/g", "ü");
			text2 = text.replace("/&Uuml;/g", "Ü");				
			text2 = text.replace("/&szlig;/g", "ß");
			return text2;
		}

		return text;

}

function show() {
	elem = document.getElementById("current");
	elem.src = Photos[current]["image"];
	elem.width=Photos[current]["width"]*2;
	elem.height=Photos[current]["height"]*2;	
	
	currLink = document.getElementById("currentLink");
	currLink.href = Photos[current]["image"];
	
	comment = document.getElementById("galleryComment");
	//alert("..."+Photos[current]["text"]);
	comment.firstChild.data=Photos[current]["label"];

}

function next() {
	//alert(current+"/"+Photos.length);
	if(current == Photos.length) {
		return; 
	}
	current++;
	show();
}

function previous() {
	if(current == 0)
		return;
		
	current--;
	show();	
}

