function getHeight()
{
	if(window.innerHeight) return window.innerHeight - 25;
	else if(document.body && document.body.offsetHeight) return document.body.offsetHeight - 25;
	else return 0;
}

function getWidth()
{
	if(window.innerWidth) return window.innerWidth - 25;
	else if(document.body && document.body.offsetWidth) return document.body.offsetWidth - 25;
	else return 0;
}

function getObjectWidth(ID)
{
	if(NS) return 100;
	var obj = getElem("id", ID, null);
	return obj.offsetWidth;
}

function getObjectHeight(ID)
{
	if(NS) return 100;
	var obj = getElem("id", ID, null);
	return obj.offsetHeight;
}

function realignText(ID, alignment)
{
	if(MS && navigator.appVersion.indexOf("MSIE 4.") != -1) return;
	
	var obj = getElem("id", ID, null);
	var styles = obj.style;
	if(NS) styles = obj;
	if(alignment == 'center')
		styles.left = (getWidth() - getObjectWidth(ID)) / 2;
	else if(alignment == 'left')
		styles.left = 0;
	else if(alignment == 'right')
		styles.left = getWidth() - getObjectWidth(ID);
}

function realignTextRange(ID, alignment, x, width)
{
	if(NS) return;
	var obj = getElem("id", ID, null);
	if(alignment == 'center')
		obj.style.left = (width - getObjectWidth(ID)) / 2 + x;
	else if(alignment == 'left')
		obj.style.left = x;
	else if(alignment == 'right')
		obj.style.left = width - getObjectWidth(ID) + x;
}
		
function nothing()
{
	self.location = "constr.html";
}

var assoc = new Array();
function addPicture(ID, pic, x, y, w, h, eventmap)
{
	if(NS) 
	{
		assoc[assoc.length] = document.layers.length;
		assoc[assoc.length] = ID;
	}
	
	var tag = '<div border="0" id=' + ID + ' style="visibility:hidden; position:absolute; left:' + x + 'px; top:' + y + 'px;" ><img id="IMG' + ID + '" border="0" src="' + pic + '" width=' + w + ' height=' + h;
	if(eventmap && eventmap != '') tag = tag + ' usemap="#' + eventmap;
	document.write(tag + '"></div>');
}

function searchPicture(ID)
{
	if(!NS)
		return getElem("id", ID, null);
	else
	{
		var i = 0;
		for(n = 0; n<assoc.length; n++)
		{
			if(assoc[n + 1] == ID)
				i = assoc[n];
		}
		return getElem("index", i, null);
	}		
}

function showPicture(ID, show)
{
	var pic = searchPicture(ID);
	if(NS)
		pic.visibility = (show) ? "visible" : "hide";
	else
		pic.style.visibility = (show) ? "visible" : "hidden";
}

function replacePicture(ID, src)
{
	var img = getElem("id", 'IMG' + ID, 0);
	if(img) img.src = src;
}

function showElement(ID, show)
{
	var elem = getElem("id", ID, null);
	
	if(NS)
		elem.visibility = (show) ? "visible" : "hide";
	else
		elem.style.visibility = (show) ? "visible" : "hidden";
}

function addText(ID, Text, style, color, x, y, w, h)
{
	var tag;
	if(NS) 
		tag = '<layer id=' + ID + ' left=' + x + ' top=' + y + ' width=' + w + ' height=' + h + ' bgcolor="#' + color + '" visibility="hidden"><div style="';
	else	
		tag = '<div id="' + ID + '" style="visibility:hidden;';
	
	if(!NS && color != '') tag = tag + 'background-color:#'+ color + ';';
	tag = tag + 'alignment:center; position:absolute; ' + style + ';' + 'left:' + x + 'px; top:' + y + 'px; ">' + Text + '</div>';
	
	if(NS) tag = tag + '</layer>';
	document.write(tag);
}

function getLanguage()
{
	var language = "";
	if(navigator.language) language = navigator.language;
	if(navigator.systemLanguage) language = navigator.systemLanguage;
	
	//if(language.indexOf("de") == 0) return "de";
	//return "en";
	return "de";
}