////
// Inner width, the inner dimensions of the window or frame.
// jb: x information will be not hand over at this time...
function fGetInnerX()
{
	var ret;

	// ret[0] --> y, ret[1] --> x
	if (self.innerHeight) // all except Explorer
	{
		ret = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		ret = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		ret = document.body.clientHeight;
	}
	return ret;
}
function fGetInnerY()
{
	var ret;

	// ret[0] --> y, ret[1] --> x
	if (self.innerHeight) // all except Explorer
	{
		ret = self.innerWidth;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
	// Explorer 6 Strict Mode
	{
		ret = document.documentElement.clientWidth;
	}
	else if (document.body) // other Explorers
	{
		ret = document.body.clientWidth;
	}
	return ret;
}
////
// Scrolling offset, how much the page has scrolled.
// jb: x information will be not hand over at this time...
function fGetScrollY()
{
	var x,y;
	if (self.pageYOffset) // all except Explorer
	{
		x = self.pageXOffset;
		y = self.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	// Explorer 6 Strict
	{
		x = document.documentElement.scrollLeft;
		y = document.documentElement.scrollTop;
	}
	else if (document.body) // all other Explorers
	{
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}
	else
	{
		x = 0;
		y = 0;
	}
	return y;
}

////
// Page height
/*
The height of the total page (usually the body element).

This is a tricky one, some browsers require scrollHeight, others offsetHeight, but all browsers support both properties. Therefore I see which property has the larger value. This means the page height the script below gives is never smaller than the window height.
*/
// jb: x information will be not hand over at this time...
function fGetTotalY()
{
	var x,y;
	var test1 = document.body.scrollHeight;
	var test2 = document.body.offsetHeight
	if (test1 > test2) // all but Explorer Mac
	{
		x = document.body.scrollWidth;
		y = document.body.scrollHeight;
	}
	else // Explorer Mac;
	//would also work in Explorer 6 Strict, Mozilla and Safari
	{
		x = document.body.offsetWidth;
		y = document.body.offsetHeight;
	}
	return y;
}

////
//
function fGetDivPos(_x)
{	// x wird auf bildschirmmitte berechnet
	// y zeit ist oberer sichtbaren bildschirmrand (auch wenn der user nach unten scrollt)

	// übergabeparameter: wird die breite die angezeigt werden soll
	// ausgabe: array x und y, [0]=xpos, [1]=ypos

	var ret = new Array(2);

	// abmasse einholen
	var xyInner = fGetInnerXY(); // sichtbare breite und höhe, xy[0]=breite, xy[1]=höhe
	var yScroll = fGetScrollY(); // gibt die gescrollte höhe an
	var yTotal = fGetTotalY(); // gibt die gesamte höhe an

	var calc_x = 0;
	var calc_y = yScroll;

	if(xyInner[0] > _x) // ermitteln der horizontalen position
	{	calc_x = (xyInner[0] / 2) - (_x / 2);
	}
	// retrun values...
	ret[0] = calc_x;
	ret[1] = calc_y;

	return ret;
}

////
//

function getAbsoluteX (elm) {
	var x = 0;
	if (elm && typeof elm.offsetParent != "undefined") {
		while (elm && typeof elm.offsetLeft == "number") {
			x += elm.offsetLeft;
			elm = elm.offsetParent;
		}
	}
	return x;
}

function getAbsoluteY(elm){
	var y = 0;
	if (elm && typeof elm.offsetParent != "undefined") {
		while (elm && typeof elm.offsetTop == "number") {
			y += elm.offsetTop;
			elm = elm.offsetParent;
		}
	}
	return y;
}

function getx(id)
{
	var elm = 0;

	elm = document.getElementById(id);

	return getAbsoluteX(elm);
}

function gety(id)
{
	var elm = 0;

	elm = document.getElementById(id);

	return getAbsoluteY(elm);
}

////////////////////////////////////////////////////////////////////////
function fResetWait()
{
	document.getElementById("float_background").innerHTML = '';
	document.getElementById("float_background").style.cssText = 'position:absolute;left:0;top:0;';
}
function fSetWait()
{	// funktion setzt hintergrund transparent verdunkelt

	var xInner = fGetInnerX();
	var yInner = fGetInnerY();
	var yScroll = fGetScrollY(); // gibt die gescrollte höhe an
	var yTotal = fGetTotalY() + 50; // gibt die gesamte höhe an

	var ypos = yScroll + (xInner / 2) - 50;

	document.getElementById("float_background").style.cssText = 'position:absolute;left:0;top:0;color: #edfffe;background-image: url(../../../../template/temp.start/img/glob.back.png); width:' + yInner + 'px; height:' + yTotal + 'px;filter:Alpha(opacity=80, finishopacity=10, style=0)";visibility:visible;';

	document.getElementById("float_background").innerHTML = '<table width="100%" style="margin-top:' + ypos + 'px;" border="0" align="center"><tr><td align="center"><img src="../../../../template/temp.start/img/glob.wait.gif"><br><br><div class="bittewarten">bitte warten</div></td></tr></table>';
}

