/*
 * fdp-wahlkampf.js
 * 
 * (c) 2004 eg.media
 * 
 * written by Christof Donat
 */

if(!document.all) {
	var mttg_adaptor = function() {
		this.width = 0;
	
		this.adapt = function (w) {
			divAll          = document.getElementById('divAll');
			divBGlinks      = document.getElementById('divBGlinks');
			divBlauLinksBG  = document.getElementById('divBlauLinksBG');
			divBlauRechtsBG = document.getElementById('divBlauRechtsBG');
			divContentBG = document.getElementById('divContentBG');
		
			if( divAll && this.width != w ) 
				divAll.style.left           = Math.max((w-780)/2,0);
			if( divBGlinks && this.width != w ) 
				divBGlinks.style.width      = Math.max((w-390)/2,0);
			if( divBlauLinksBG && this.width != w ) 
				divBlauLinksBG.style.width  = Math.max((w-780)/2,0);
			if( divBlauRechtsBG && this.width != w ) 
				divBlauRechtsBG.style.width = Math.max((w-720)/2,0);
			if( divContentBG && this.width != w ) {
				divContentBG.style.width    = Math.max((w+780)/2,0);
				divContentBG.style.left     = Math.max((w-780)/2,0);
			}
	
			if( divAll && divBGlinks && divBlauLinksBG && divBlauRechtsBG && divContentBG )
				this.width = w;
		}
	}

	
	mttg_adaptPositions = new mttg_adaptor()
	
	window.onresize = function() { mttg_adaptPositions.adapt(window.innerWidth); }
	
	tmp = function() { 
		divAll          = document.getElementById('divAll');
		divBGlinks      = document.getElementById('divBGlinks');
		divBlauLinksBG  = document.getElementById('divBlauLinksBG');
		divBlauRechtsBG = document.getElementById('divBlauRechtsBG');
		divContentBG    = document.getElementById('divContentBG');
		
		mttg_adaptPositions.adapt(window.innerWidth); 

		if( !(divAll && divBGlinks && divBlauLinksBG && divBlauRechtsBG && divContentBG) )
			setTimeout(tmp,10);
			
	};
	tmp();
}


