// Browser	
	var dom = document.getElementById ? true:false;
	var ns4 = document.layers ? true:false;
	var ie = document.all ? true:false;
	
	var opera = ie;
	var userAgent= window.navigator.userAgent.toLowerCase();
	if (userAgent.indexOf("opera") == -1) opera = false;
	
	var plattForm = window.navigator.platform.toLowerCase();
	var isWin = (plattForm.indexOf('win')!=-1)?true:false;

// Load

	var m_bLoaded = false;

function Check(sUrl, sQuery)
{	if (UseLayers())
	{	top.location.replace(sUrl+sQuery);		
	}	
}

function Load(sPos, sPosBlind)
{	if (!top.frames["Page"]) return;
	m_bLoaded = true;
	
	// An alle Frames senden, die die Funktion SetMenu haben
	for (var i = 0; i < top.frames.length; i++)
	{	if (top.frames[i].SetMenu)
		{	top.frames[i].SetMenu(sPos, sPosBlind);
		}
	}
}

function Goto(sUrl, sQuery, sAnker)
{	sUrl = "/ttphp"+sUrl;
	sUrl = sUrl.replace(/.htm/, ".php4");
	
	// Reinnehmen, falls das Menu VOR der Seite geändert werden soll
	//ChangeMenu(sUrl, sQuery, sKapAbs, sKapAbs);
	
	if (top.frames["Page"])
	{	top.frames["Page"].location.href = sUrl+sQuery+sAnker;
		return false;
	}
	return true;
}

function Popup(sUrl, sTitle, sKapPic, nWidth, nHeight, sPos, sDomain)
{	// Calc Position
	var nWinX = 0, nWinY = 0;

	if (sPos == "RB" || sPos == "") // RightBottom
	{	nWinX = screen.width - nWidth - 8;
		nWinY = screen.height - nHeight - 64;
	}
	else if (sPos == "RT")			// RightTop
	{	nWinX = screen.width - nWidth - 8;
		nWinY = 0;
	}
	else if (sPos == "RTV")			//RightTopVollesbild		
	{	nWinX = screen.width - nWidth - 8;
		nWinY = 0;
		nHeight = screen.height - 64;
	}
	else if (sPos == "RC")			//RightCenter
	{	nWinX = screen.width - nWidth - 8;
		nWinY = (screen.height - nHeight - 64)/2
	}
	
	// Open Popup
	var pop;	
	// pop = window.open(sDomain+"/layout/popup_frames.php4?Title="+sTitle+"&Pic="+sKapPic+"&Width="+nWidth+"&Url="+sUrl, sTitle, 'width='+nWidth+',height='+nHeight+',top='+nWinY+',left='+nWinX+'),toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	pop = window.open(sDomain+"/layout/popup_frames.htm?Title="+sTitle+"&Pic="+sKapPic+"&Width="+nWidth+"&Url="+sUrl, sTitle, 'width='+nWidth+',height='+nHeight+',top='+nWinY+',left='+nWinX+'),toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	pop.focus();
	return false;
}

function Printversion(sUrl)
{	var PrintWin = window.open(sUrl+'?g_bPrint=true','Drucken','scrollbars=yes,width=460,height=500');
	PrintWin.focus();
	return false;
}

function PrintPage()
{	if (window.print)
			window.print();
	else	alert("Ihr Browser unterstützt diese Funktion nicht. Bitte nutzen Sie den Print-Button des Browsers.");
}

function Rollover(pThis)
{	var sSrc = pThis.src;
	sSrc = sSrc.replace(/.gif/, "h.gif");
	sSrc = sSrc.replace(/.jpg/, "h.jpg");
	pThis.src = sSrc;
}

function Rollout(pThis)
{	var sSrc = pThis.src;
	sSrc = sSrc.replace(/h.gif/, ".gif");
	sSrc = sSrc.replace(/h.jpg/, ".jpg");
	pThis.src = sSrc;
}

function SetStartPage(sUrl, pThis)
{	pThis.style.behavior='url(#default#homepage)';
	pThis.setHomePage(sUrl);
	return false;
}

// Layers
function UseLayers()
{	if (dom) return true; // Alles auf dom optimiert
	return false;
}

function Abs(fNumber)
{	if (fNumber < 0) return -fNumber;
	return fNumber;
}

// Get + Set
function GetObjStyle(sObj)
{	return document.getElementById(sObj).style;
}

function GetObj(sObj)
{	return document.getElementById(sObj);
}

function GetDocObj(sObj, doc)
{	return doc.getElementById(sObj);					
}

function IsObj(sObj)
{	var pObj = null;
	if (document.getElementById(sObj))
		pObj = document.getElementById(sObj);
	return (pObj != null);
}

function Show(sObj)
{	obj = GetObjStyle(sObj);
	obj.visibility = "visible";
}

function Hide(sObj)
{	obj = GetObjStyle(sObj);
	obj.visibility = "hidden";
}

function IsVisible(sObj)
{   obj = GetObjStyle(sObj);
    if (obj.visibility.substring(0, 1) == "h") return false;
    return true;
}

function SetPos(sObj, x, y)
{	obj = GetObjStyle(sObj);
	obj.left = x + 'px';
	obj.top = y + 'px';
}

function SetX(sObj, x)
{	obj = GetObjStyle(sObj);
	obj.left = x + 'px';	
}

function SetY(sObj, y)
{	obj = GetObjStyle(sObj);
	obj.top = y + 'px';
}

function SetWidth(sObj, w)
{	obj = GetObjStyle(sObj);
	obj.width = w + 'px';
}

function SetHeight(sObj, h)
{	obj = GetObjStyle(sObj);
	obj.height = h + 'px';
}

function GetX(sObj)
{	obj = GetObjStyle(sObj);
	return parseInt(obj.left.replace(/px/, ""));
}

function GetY(sObj)
{	obj = GetObjStyle(sObj);
	return parseInt(obj.top.replace(/px/, ""));
}

function GetAbxX(sObj)
{	return GetAbsX(sObj, -1);
}

function GetAbsX(sObj, nMaxCount)
{	obj = GetObj(sObj);
	nX = 0;
	nCount = 0;
	while (obj)
	{	nX += obj.offsetLeft;
		obj = obj.offsetParent;
		nCount++;
		if (nCount == nMaxCount) break;
	}
	return nX;
}

function GetAbxY(sObj)
{	return GetAbsY(sObj, -1);
}

function GetAbsY(sObj, nMaxCount)
{	obj = GetObj(sObj);
	nY = 0;
	nCount = 0;
	while (obj)
	{	nY += obj.offsetTop;
		obj = obj.offsetParent;
		nCount++;
		if (nCount == nMaxCount) break;
	}
	return nY;
}

function GetWidth(sObj)
{	obj = GetObj(sObj);
	return obj.offsetWidth;	
}

function GetHeight(sObj)
{	obj = GetObj(sObj);
	return obj.offsetHeight;	
}

// Mouse-Functions
	var m_nMouseX = 0;
	var m_nMouseY = 0;

function GetMousePos(evt)
{	m_nMouseX = 0;
	m_nMouseY = 0;
	if (ie)
	{	m_nMouseY = event.clientY + document.body.scrollTop;
		m_nMouseX = event.clientX + document.body.scrollLeft;
	}
	else if(ns4 || dom)
		{	m_nMouseY = evt.pageY;
			m_nMouseX = evt.pageX;
		}
}

// Window-Functions
function GetWindowX()
{	if (typeof window.pageXOffset != 'undefined')
	{	return window.pageXOffset;
	}
	else if (document.body && typeof document.body.scrollLeft != 'undefined')
	{	return document.body.scrollLeft;
	}
	return 0;
}

function GetWindowY()
{	if (typeof window.pageYOffset != 'undefined')
	{	return window.pageYOffset;
	}
	else if (document.body && typeof document.body.scrollTop != 'undefined')
	{	return document.body.scrollTop;
	}
	return 0;
}

function GetWindowWidth()
{	width = 0;
	if(typeof window.innerWidth != 'undefined')
	{	width = window.innerWidth;
	} 
	else 
		if (document.body && typeof document.body.clientWidth != 'undefined')
		{	width = document.body.clientWidth;
		}
  return width;
}

function GetWindowHeight()
{	height = 0;
	if(typeof window.innerHeight != 'undefined')
	{	height = window.innerHeight;
	} 
	else 
		if (document.body && typeof document.body.clientHeight != 'undefined')
		{	height = document.body.clientHeight;
		}
	return height;
}

/* Forms */
function SubmitAndJump(nPage)
{	if (document.forms["TTForm"] != null)
	{	document.forms["TTForm"].elements["g_nSeiteNeu"].value = nPage;
		document.forms["TTForm"].submit();
	}
}

/* Toggle */
function ToogleVis(sId)
{	if (document.getElementById(sId).style.display == "none")
	{	document.getElementById(sId).style.display = "block";
	}
	else
	{	document.getElementById(sId).style.display = "none";
	}
}
 
