/**
 * centerIt
 * 
 * created: 2009-02 by winzigweich GbR
 * 
 * @version 1.1
 * @copyright 2009 by winzigweich GbR
 * @author MiMo - winzigweich
 * @description	"Don't use it without permission
 *				 onresize='javascript:centerIt(divID);' onload='javascript:centerIt(divID);'"
 */
function getInnerWindowSizeY() {
	var y;
	if (self.innerHeight)
	{
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	{
		y = document.documentElement.clientHeight;
	}
	else if (document.body)
	{
		y = document.body.clientHeight;
	}

	return(y);
}

function getInnerWindowSizeX() {
	var x;
	if (self.innerWidth)
	{
		x = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientWidth)
	{
		x = document.documentElement.clientWidth;
	}
	else if (document.body)
	{
		x = document.body.clientWidth;
	}

	return(x);
}

function centerIt (divID) {

	var h;
	var b;
	var fensterH;
	var fensterB;
	var oben;
	var links;
	var Weite;
	var Hoehe;

	//Folgende Variable sind Größen des gesamten Fenstercontainers
	h = getInnerWindowSizeY();
	b = getInnerWindowSizeX();

	//Folgende Variable sind Größen des DIV
	//console.log(divID);
	fensterH = document.getElementById(divID).clientHeight;
	fensterB = document.getElementById(divID).clientWidth;


	//Berechnet Position links und oben, verhindert negativ- und kommazahlen.
	if (h >= fensterH)
	{
		oben = Math.round((h - fensterH) / 2);
	} else {
		oben = 0;
	}

	if (b >= fensterB)
	{
		links = Math.round((b - fensterB) / 2);
	} 
	else {
		links = 0;
	}

	document.getElementById(divID).style.left = links + "px";
	/*document.getElementById(divID).style.top = oben + "px";*/
	document.getElementById(divID).style.position = "absolute";
}

//centerIt("container");