var isIE6 = false;

function getComputed( o,what ) {
	var value = "0px";
	if( document.defaultView && document.defaultView.getComputedStyle ) {
		// internet-kompatible Browser
		value = document.defaultView.getComputedStyle(o,'').getPropertyValue(what);
	} else {
		if (what == 'height')
			value = o.offsetHeight;
		else if (what=='width')
			value = o.offsetWidth;
		else
			value = o.offsetLeft;
	}
	return parseInt(value);
}

function myOnresize() {
	var Cont = document.getElementById("cont");
	var H0 = getComputed(Cont,'height');
	var W0 = getComputed(Cont,'width');
	var Fotos = document.getElementById("fotos");
	var LX = getComputed(Fotos,'left');
	var WX = getComputed(Fotos,'width');
	var Y  = getComputed(Fotos,'height');
	var Body = document.getElementsByTagName("body")[0];
	var H = getComputed(Body,'height');
	var W = getComputed(Body,'width');
	if (document.body) {
		if (document.body.parentNode.scrollHeight -10 > H) {
			H = document.body.parentNode.scrollHeight-10;
		}
		if (document.body.clientHeight > H) {
			H = document.body.clientHeight;
		}
	}
	var X = LX + WX;
	// alert("W="+W + " X="+LX+"+"+WX + " H="+H);
	var T = 0, L = 0;
	if (H >= H0) {
		T = Math.round((H-H0)/2);
	} else if (H >= Y) {
		T = H-H0;
	} else {
		T = Y-H0;
	}
	if (W >= 2*X && W >= 2*(W0-X)) {
		L = Math.round(W/2-X);
	} else if (W >= W0) {
		L = W-W0;
	} else {
		L = 0;
	}
	if (T<0) T=0;
	// alert(T + "px / " + L + "px");
	Cont.style.top = T + "px";
	Cont.style.left = L + "px";
}

var derhinweis = false;
var derwahrehinweis = false;
var kopiehinweis = false;

var HinwW1, HinwW2, HinwJump, HinwL;

function Marquee() {
	HinwL -= 3;
	if (HinwL+HinwW1 < 0) HinwL += HinwJump;
	derwahrehinweis.style.left = HinwL+'px';
	kopiehinweis.style.left = (HinwL + HinwJump - HinwW1)+'px';
}

function myOnload() {
	window.onresize = myOnresize;
	if (isIE6) {
		ie6onload();
	} else {
		var RAdiv = document.getElementById('RA');
		if (RAdiv) {
			var txt = RAdiv.getElementsByTagName('span')[0];
			if (txt) {
				var img = document.createElement('img');
				img.alt = txt.firstChild.nodeValue;
				img.src = "/rsdw_bilder/RA.png";
				RAdiv.removeChild(txt);
				RAdiv.appendChild(img);
			}
		}
	}
	myOnresize();
        derhinweis = document.getElementById('hinweis');
	if (derhinweis) {
		derwahrehinweis = derhinweis.getElementsByTagName('div')[0];
		if (derwahrehinweis) {
			HinwW1 = getComputed(derwahrehinweis,'width');
			derhinweis.style.width = getComputed(document.getElementById('logoimg'),'width')+'px';
			HinwW2 = getComputed(derhinweis,'width');
			HinwL = 2*getComputed(derwahrehinweis,'height');
			HinwJump = HinwW1 + HinwL;

			derwahrehinweis.style.display = 'inline';	
			kopiehinweis = derwahrehinweis.cloneNode(true);
			derhinweis.appendChild(kopiehinweis);

			if (HinwJump < HinwW2/2) { HinwJump = HinwW2/2; }
			setInterval("Marquee()",60);
		}
	}
}

window.onload = myOnload;

