doInit=0;
doInit2=0;
trInit=0;
as_adressbuch_used=0;
function check_init() {
	if(doInit==1) {
		init();
	}
	if(doInit2==1) {
		init2();
	}
	if(trInit==1) {
		tr_check_form(e('tr_form').value)
	}
}

function e(attrobjname) {
	return document.getElementById(attrobjname);
}

function gotourl(myurl,mydelay) {
	if(!mydelay) { mydelay=10; }
	var befehl="document.location.href='"+myurl+"'"
	window.setTimeout(befehl,mydelay);
}

function get_top(o) {
	//if(!o.offsetTop) { return; }
	var top = 0;
	while (o) {
		top += parseInt(o.offsetTop);
		o = o.offsetParent;
	}
	return top;
}
function get_left(o) {
	//if(!o.offsetLeft) { return; }
	var left = 0;
	while (o) {
		left += parseInt(o.offsetLeft);
		o = o.offsetParent;
	}
	return left;
}

function centerdiv(divid,opt) {
	var Xwidth = e(divid).offsetWidth
	Xwidth*=1;
	var Yheight = e(divid).offsetHeight
	Yheight*=1;

	// First, determine how much the visitor has scrolled
	
	var scrolledX, scrolledY; 
	if( self.pageYoffset ) { 
		scrolledX = self.pageXoffset; 
		scrolledY = self.pageYoffset; 
	} else if( document.documentElement && document.documentElement.scrollTop ) { 
		scrolledX = document.documentElement.scrollLeft; 
		scrolledY = document.documentElement.scrollTop; 
	} else if( document.body ) { 
		scrolledX = document.body.scrollLeft; 
		scrolledY = document.body.scrollTop; 
	}
	
	// Next, determine the coordinates of the center of browser's window
	
	var centerX, centerY; 
	if( self.innerHeight ) { 
		centerX = self.innerWidth; 
		centerY = self.innerHeight; 
	} else if( document.documentElement && document.documentElement.clientHeight ) { 
		centerX = document.documentElement.clientWidth; 
		centerY = document.documentElement.clientHeight; 
	} else if( document.body ) { 
		centerX = document.body.clientWidth; 
		centerY = document.body.clientHeight; 
	}
	
	// Xwidth is the width of the div, Yheight is the height of the 
	// div passed as arguments to the function: 
	var leftoffset = scrolledX + (centerX - Xwidth) / 2; 
	var topoffset = scrolledY + (centerY - Yheight) / 2; 
	// The initial width and height of the div can be set in the 
	// style sheet with display:none; divid is passed as an argument to // the function 
	var o=document.getElementById(divid); 
	var r=o.style; 
	r.position='absolute'; 
	if(opt=='h') {
		r.left = leftoffset + 'px'; 
	} else if(opt=='v') {
		r.top = topoffset + 'px'; 
	} else {
		r.top = topoffset + 'px'; 
		r.left = leftoffset + 'px'; 
	}
	r.display = "block"; 
}

function fa(zahl, k, fix) {
    if(!k) k = 0;
    var neu = '';
 
	var dec_point = ',';
	var thousands_sep = '.';
 
    // Runden
    var f = Math.pow(10, k);
    zahl = '' + parseInt(zahl * f + (.5 * (zahl > 0 ? 1 : -1)) ) / f ;
 
    // Komma ermittlen
    var idx = zahl.indexOf('.');
 
    // fehlende Nullen einfügen
    if(fix)    {
         zahl += (idx == -1 ? '.' : '' )
         + f.toString().substring(1);
    }
	var sign = zahl < 0;
	if(sign) zahl = zahl.substring(1);
    idx = zahl.indexOf('.');
 
	// Nachkommastellen ermittlen
    if( idx == -1) idx = zahl.length;
    else neu = dec_point + zahl.substr(idx + 1, k);
 
 
    while(idx > 0)    {
        if(idx - 3 > 0)
        neu = thousands_sep + zahl.substring( idx - 3, idx) + neu;
        else
        neu = zahl.substring(0, idx) + neu;
        idx -= 3;
    }
    return (sign ? '-' : '') + neu;
}

