function layout() {

	if (window.innerWidth){
		var bodyw = window.innerWidth;
		var bodyh = window.innerHeight;
	}else{
		var bodyw = document.body.clientWidth;
		var bodyh = document.getElementsByTagName("body")[0].offsetHeight;
	}
	
	var abweichung = 0;
	browser = navigator.userAgent;
	if (browser.indexOf("Mozilla") != -1){
		abweichung = 125;
	}
	if (browser.indexOf("MSIE") != -1){
		abweichung = 110;
	}

	
	var kurz = (bodyw - abweichung);
	if(document.getElementById('links')) document.getElementById('links').style.width = kurz + "px";
	if(document.getElementById('sw_ueberschrift_1')) document.getElementById('sw_ueberschrift_1').style.width = kurz + "px";
	if(document.getElementById('mainlinks')) document.getElementById('mainlinks').style.width = (kurz + 10) + "px";
	
	
	//alert (bodyw + " ==== " + bodyh);
	
	breite = new Array(800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600);
	hoehe = new Array(600, 675, 750, 825, 900, 975, 1050, 1125, 1200);
	//bilder = new Array("bild1.jpg", "bild2.jpg", "bild3.jpg", "bild4.jpg", "bild5.jpg" );
	bilder = new Array("bild2.jpg", "bild3.jpg", "neu1.jpg", "neu2.jpg" );
	
	var bildb = breite[0];
	var bildh = hoehe[0];
	var idb = 0;
	var idh = 0;
	
	for (var i = 1; i < breite.length; ++i){
		if (bodyw > bildb){
			bildb = breite[i];
			idb = i;
		}		
	}
	for (var i = 1; i < hoehe.length; ++i){
		if (bodyh > bildh){
			bildh = hoehe[i];
			idh = i;
		}		
	}
	
	if (idh > idb){
		bildb = breite[idh];
		bildh = hoehe[idh];
	}else{
		bildb = breite[idb];
		bildh = hoehe[idb];
	}
	
	//alert(bildb + " ==== " + bildh);
	
	var zuf = Math.round(Math.random() * 3);

	
	var bildneu = "url(hgpix/" + bildb + "_" + bildh +"/" + bilder[zuf] + ")";
	//alert (zuf);
	document.getElementById('hgbild').style.backgroundImage = bildneu;
}


	
///////////////////////////////////////////////////////////////////////////////////////////////////////////


function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

///////////////////////////////////////////////////////////////////////////////////////////////////////////


function Tabellenfarbe(Reihe, Farbe)
{
if (Farbe == '' || typeof(Reihe.style) == 'undefined')
{
return false;
}
if (typeof(document.getElementsByTagName) != 'undefined')
{
var theCells = Reihe.getElementsByTagName('td');
}
else if (typeof(Reihe.cells) != 'undefined')
{
var theCells = Reihe.cells;
}
else
{
return false;
}
var rowCellsCnt  = theCells.length;
for (var c = 0; c < rowCellsCnt; c++)
{
theCells[c].style.backgroundColor = Farbe;
}
return true;
}

///////////////////////////////////////////////////////


function highlight(id, an){
	var neu = "pix/" + id + ".gif";
	if (an == 1){
		neu = "pix/" + id + "_hover.gif";
	}
	document.getElementById(id).src = neu;
}


///////////////////////////////////////////////////////

function sublinks(){
	var e=document.getElementsByTagName("*");
	alert(e.length);
	for(var i=0;i<e.length;i++){
	 if(e[i].title){
	 	alert(e[i].title);
		}
	}
}


///////////////////////////////////////////////////////

function textswitch(){
	if (document.getElementById('sw_txt_1')){
		var vis = document.getElementById('sw_txt_1').style.display;
		//alert(vis);
		if (vis != "none"){
			document.getElementById('sw_txt_1').style.display = "none";
		}else{
			document.getElementById('sw_txt_1').style.display = "block";
		}
	}
	if (document.getElementById('sw_ueberschrift_1')){
		var vis = document.getElementById('sw_ueberschrift_1').style.display;
		//alert(vis);
		if (vis != "none"){
			document.getElementById('sw_ueberschrift_1').style.display = "none";
		}else{
			document.getElementById('sw_ueberschrift_1').style.display = "block";
		}
	}
	if (document.getElementById('links')){
		var vis = document.getElementById('links').style.display;
		//alert(vis);
		if (vis != "none"){
			document.getElementById('links').style.display = "none";
		}else{
			document.getElementById('links').style.display = "block";
		}
	}
}
