function jSMAlbum() {

	var ID = '';
	var IMG = new Image();
	var OBJ_ENABLE = null;
	var OBJ_WAIT = null;
	var OBJ_IMAGE = null;
	var OBJ_IMAGE_TEXT = null;

	// ID setzen
	this.SetID = function(id) {
		ID = id;
	};

	// ID zurückgeben
	this.GetID = function() {
		return ID;
	};

	// Bilddatei anzeigen
	this.Show = function(src, text) {
		OBJ_ENABLE = document.getElementById('album_enable');
		OBJ_WAIT = document.getElementById('album_wait');
		OBJ_IMAGE = document.getElementById('album_image');
		OBJ_IMAGE_TEXT = document.getElementById('album_image_text');

		this.SetImageText(text);
		this.Enable(false);
		this.Resize();

		this.ShowWait();
		IMG = new Image();
		IMG.onload = this.ShowImage;
		IMG.src = src;
	};

	// Warte-Animation anzeigen
	this.ShowWait = function() {
		if (OBJ_WAIT != null) {
			OBJ_WAIT.style.display = 'block';
			OBJ_WAIT.style.top = (f_clientHeight()/2) - (parseInt(OBJ_WAIT.offsetHeight)/2) + f_scrollTop() + 'px';
			OBJ_WAIT.style.left = (f_clientWidth()/2) - (parseInt(OBJ_WAIT.offsetWidth)/2) + 'px';
		}
	};

	// Warte-Animation nicht anzeigen
	this.CLoseWait = function() {
		if (OBJ_WAIT != null) { OBJ_WAIT.style.display = 'none'; }
	};

	// Bilddatei anzeigen
	this.ShowImage = function() {
		document.images["album_image"].src = IMG.src;

		if (OBJ_WAIT != null) { OBJ_WAIT.style.display = 'none'; }
		if (OBJ_IMAGE != null) { OBJ_IMAGE.style.display = 'block'; }
		if (OBJ_IMAGE_TEXT != null) { OBJ_IMAGE_TEXT.style.display = 'block'; }

		if (OBJ_IMAGE != null && OBJ_IMAGE_TEXT != null) {
			OBJ_IMAGE.style.top = (f_clientHeight()/2) - 20 - (parseInt(IMG.height)/2) + f_scrollTop() + 'px';
			if (parseInt(OBJ_IMAGE.style.top) < 0) { OBJ_IMAGE.style.top = '0px'; }
			OBJ_IMAGE.style.left = (f_clientWidth()/2) - (parseInt(IMG.width)/2)  + f_scrollLeft() + 'px';
			OBJ_IMAGE_TEXT.style.width = IMG.width + 'px';
		}
	};

	// Bilddatei nicht anzeigen
	this.CloseImage = function() {
		if (OBJ_IMAGE != null) { OBJ_IMAGE.style.display = 'none'; }
	};

	// Bildtext setzen
	this.SetImageText = function(text) {
		if (OBJ_IMAGE_TEXT != null) { OBJ_IMAGE_TEXT.innerHTML = text; }
	};

	// Bildtext anzeigen
	this.ShowImageText = function(text) {
		if (OBJ_IMAGE_TEXT != null) { OBJ_IMAGE_TEXT.style.display = 'block'; }
	};

	// Bildtext nicht anzeigen
	this.CloseImageText = function(text) {
		if (OBJ_IMAGE_TEXT != null) { OBJ_IMAGE_TEXT.style.display = 'none'; }
	};

	// Fenster aktiv/ inaktiv
	this.Enable = function(b) {
		if (OBJ_ENABLE != null) {
			if (b) {
				OBJ_ENABLE.style.display = 'none';
				this.CLoseWait();
				this.CloseImage();
				this.CloseImageText();
			}
			else {
				OBJ_ENABLE.style.display = 'block';
			}
		}
	};

	// Initialisierung
	this.Ini = function(id) {
		this.SetID(id);
		document.write('<div id="album_enable" class="album_enable" onclick="' + this.GetID() + '.Enable(true);"></div>'
						+ '<div id="album_wait" class="album_wait" onclick="' + this.GetID() + '.Enable(true);"></div>'
						+ '<div id="album_image" class="album_image">'
						+ '<img src="" name="album_image" />'
						+ '<div id="album_image_text" class="album_image_text"></div>'
						+ '</div>');
	};

	// Fenstergröße
	this.Resize = function() {
		if (OBJ_ENABLE != null) {
			OBJ_ENABLE.style.height = GetBodyHeight() + 'px';
			OBJ_ENABLE.style.width = GetBodyWidth() + 'px';
		}
	};

	//
	function GetBodyHeight() {
		return document.getElementsByTagName('body')[0].scrollHeight;
	};

	function GetBodyWidth() {
		return document.getElementsByTagName('body')[0].clientWidth;
	};

	function f_clientWidth() {
		return f_filterResults (
			window.innerWidth ? window.innerWidth : 0,
			document.documentElement ? document.documentElement.clientWidth : 0,
			document.body ? document.body.clientWidth : 0
		);
	};

	function f_clientHeight() {
		return f_filterResults (
			window.innerHeight ? window.innerHeight : 0,
			document.documentElement ? document.documentElement.clientHeight : 0,
			document.body ? document.body.clientHeight : 0
		);
	};

	function f_scrollLeft() {
		return f_filterResults (
			window.pageXOffset ? window.pageXOffset : 0,
			document.documentElement ? document.documentElement.scrollLeft : 0,
			document.body ? document.body.scrollLeft : 0
		);
	};

	function f_scrollTop() {
		return f_filterResults (
			window.pageYOffset ? window.pageYOffset : 0,
			document.documentElement ? document.documentElement.scrollTop : 0,
			document.body ? document.body.scrollTop : 0
		);
	};

	function f_filterResults(n_win, n_docel, n_body) {
		var n_result = n_win ? n_win : 0;
		if (n_docel && (!n_result || (n_result > n_docel))) { n_result = n_docel; }
		return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
	};
};

var jSMA = new jSMAlbum();
jSMA.Ini('jSMA');