function ChangeTopGFX(bildname) {
	if(!bildname) bildname="default";
	bildnameother = "";
}

function SubHeadline(txt) {
	if(document.all) document.all('editHL').innerHTML = document.all('editHL').innerHTML+' <h3>'+txt+'</h3>';
	else document.getElementById('editHL').innerHTML = document.getElementById('editHL').innerHTML+' <h3>'+txt+'</h3>';
}

var stage = null;
stage_div = false;
zoombild = false;
zoombildwidth = 0;
titlePos = "bottom";
titleAlign = "center";
var bildsrc = null;
var bildid = null;

function Stage(e) {
	initShowBild = 0;
	if (document.getElementById) {
		stage_div = document.getElementById('stage');
	}
	else if (document.all) {
		stage_div = document.all['stage'];
	}


	var pos_X = 20, pos_Y = 20;
	if ( !e ) e = window.event;
	if ( e ) {
		if ( typeof(e.pageX) == 'number' ) {
			pos_X = e.pageX; pos_Y = e.pageY;
		} else if ( typeof(e.clientX) == 'number' ) {
			pos_X = e.clientX; pos_Y = e.clientY;
			if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) {
				pos_X += document.body.scrollLeft; pos_Y += document.body.scrollTop;
			} else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.opera || window.debug || navigator.vendor == 'KDE' ) ) {
				pos_X += document.documentElement.scrollLeft; pos_Y += document.documentElement.scrollTop;
			}
		}
	}

	var scroll_X = 0, scroll_Y = 0;
	if ( document.body && ( document.body.scrollTop || document.body.scrollLeft ) && !( window.debug || navigator.vendor == 'KDE' ) ) {
		scroll_X = document.body.scrollLeft; scroll_Y = document.body.scrollTop;
	} else if ( document.documentElement && ( document.documentElement.scrollTop || document.documentElement.scrollLeft ) && !( window.debug || navigator.vendor == 'KDE' ) ) {
		scroll_X = document.documentElement.scrollLeft; scroll_Y = document.documentElement.scrollTop;
	}

	var win_size_X = 5, win_size_Y = 5;
	if (window.innerWidth && window.innerHeight) {
		win_size_X = window.innerWidth;
		win_size_Y = window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientHeight) {
		win_size_X = document.documentElement.clientWidth;
		win_size_Y = document.documentElement.clientHeight;
	}
	else if (document.body && document.body.clientWidth && document.body.clientHeight) {
		win_size_X = document.body.clientWidth;
		win_size_Y = document.body.clientHeight;
	}

	pos_X += 5; pos_Y += 5;
	if(document.all) zoombild = document.all('zoombild');
	else zoombild = document.getElementById('zoombild');

	if (stage_div.offsetWidth && stage_div.offsetHeight) {

		if (pos_X - scroll_X + stage_div.offsetWidth + 5 > win_size_X) {
			pos_X -= (stage_div.offsetWidth + 25);
			if(titleAlign != "right") initShowBild = 1;
		}
		else  {
			if(titleAlign != "left") initShowBild = 1;
		}

		// Wenn Bild unten überlappt (Darf NIE eintreten wegen FF Flash-Index Overlay Bug)
		if (pos_Y - scroll_Y + stage_div.offsetHeight + 5 > win_size_Y) {
			pos_Y -= (stage_div.offsetHeight + 20);
			if(titlePos != "bottom") initShowBild = 1;
			titlePos = "bottom";
		}
		else {
			if(titlePos != "top") initShowBild=1;
			titlePos = "top";
		}
	}
	//Bildgroesse lesen
	zoombildwidth = zoombild.width;
	if(zoombild.width > 0) {
		stage_div.style.width = zoombild.width+"px";
		stage_div.style.overflow = "visible";
	}

	//stage positionieren
	stage_div.style.left = pos_X + "px";
	stage_div.style.top = pos_Y + "px";

	if(bildsrc && initShowBild != 0) ShowBild(bildsrc,bildid);
}

function ShowBild(bb,b) {
	innerTitle = "";
	if(bb.title) {
		innerTitle = '<div class="title" style="text-align:'+titleAlign+'">'+bb.title+'</div>';
	}
	if(b && bb.src.indexOf(b) == -1) {
		bdisp = 'block';
		bild = '<img src="'+b+'" border="0" id="zoombild" />';
		bcname = 'opacity100';
		bildsrc = bb;
		bildid = b;
	}
	else {
		bdisp = 'none';
		bild = '<img src="/images/system/top.gif" border="0" width="0" height="0" id="zoombild" />';
		bcname = 'opacity80';
		bildsrc = null;
		bildid = null;
	}

	if(document.all) {
		stage = document.all('stage');
		zoombild = document.all('zoombild');
	}
	else {
		stage = document.getElementById('stage');
		zoombild = document.getElementById('zoombild');
	}


	innerContent = bild + innerTitle;
	if(titlePos == "top") innerContent = innerTitle + bild;
	stage.style.display = bdisp;
	stage.innerHTML = innerContent;

	Stage;
}

document.onmousemove = Stage;