﻿// JScript-Datei

	function getIntValue(v) 
	{
	    v=parseInt(v,10);
	    return isNaN(v)? 0:v;
    }

function getElement(id) 
{
	if (document.getElementById) 
	{
		return document.getElementById(id);
	}
	else if (document.all) 
	{
		return document.all[id];
	}
	else return null;
}

function getElementPosX(element) 
{
	var x=0;
	if (element.offsetParent) 
	{
		while (element.offsetParent) 
		{
			x += element.offsetLeft;
			element = element.offsetParent;
		}
	}
	else if (element.parentElement) 
	{
		while (obj.parentElement) 
		{
			x += element.offsetLeft;
			element = element.parentElement;
		}
	}
	else if (element.x) 
	{
		x=element.x;
	}
	return x;
}

function setClassName(obj, cn) 
{
	obj.className=cn;
}

function goChildHref(obj) 
{
	if ((obj.childNodes) && (obj.childNodes.length) && (obj.childNodes[0].href)) 
	{
		self.location.href=obj.childNodes[0].href;
	}
	else if ((obj.children) && (obj.children.length) && (obj.children[0].href)) 
	{
		self.location.href=obj.children[0].href;
	}
}

function tryPopup(url) 
{
	var popwin = window.open(
		url,
		'ImageWindow',
		'width=820,height=620,resizable=true,scrollbars=no,'+
		'toolbar=no,locationbar=no, status=no,menubar=no'
	);
	if (popwin) 
	{
		// we have a popup-window, return false
		if (window.focus) popwin.focus();
		return false;
	}
	else 
	{
		// window.open() returned null (popup blocked)
		// rely on link, so return true
		return true;
	}
}

	function showInfomail(Thema) 
	{
	var obj=getElement("infomail");
	if (!obj) return;
	if (window.isMSIElt7) {
		var x=Math.floor((getWindowWidth()-obj.offsetWidth)/2)+getScrollX();
		var y=100;
		//Math.min(50,Math.floor((getWindowHeight()-obj.offsetHeight)/2))+getScrollY();
	}
	else {
		var x=Math.floor((getWindowWidth()-obj.offsetWidth)/2);
		var y=Math.min(50,Math.floor((getWindowHeight()-obj.offsetHeight)/2));
	}
	
	obj.style.left=x+'px';
	obj.style.top=y+'px';
	obj.style.visibility='visible';
	
	var bitte=getElement("referenz");
	if (!bitte) return;
	bitte.value=Thema;
	
}

function closeInfomail() {
	var obj=getElement("infomail");
	if (obj) obj.style.visibility='hidden';
}

function getWindowHeight() {
	if (window.innerHeight) return window.innerHeight;
	else if (document.documentElement) return document.documentElement.clientHeight;
	else return document.body.clientHeight || 0;
}

function getWindowWidth() {
	if (window.innerWidth) return window.innerWidth
	else if (document.documentElement) return document.documentElement.clientWidth
	else return document.body.clientWidth || 0;
}
function getScrollX() {
	if (typeof window.pageXOffset != 'undefined') return window.pageXOffset
	else if (document.documentElement) return document.documentElement.scrollLeft
	else if (document.body) return document.body.scrollLeft
	else return 0;
}
function getScrollY() {
	if (typeof window.pageYOffset != 'undefined') return pageYOffset
	else if (document.documentElement) return document.documentElement.scrollHeight
	else if (document.body) return document.body.scrollTop
	else return 0;
}
