function setAndKeepDynamicStyles(){
	
/*alert(window.innerWidth);
alert(window.document.documentElement.clientWidth);
alert(window.document.body.clientWidth);
totalWidth = parseInt(window.document.documentElement.clientWidth || (window.document.body.clientWidth || window.innerWidth));

alert(parseInt(totalWidth-170)+"px");*/

	setWidthForTopNavigation();

	setDynamicStyles();
	//run the setDyamicStyles-Function every x ms
	setInterval(setDynamicStyles,100);
	
}

function setWidthForTopNavigation(){
	tds = $('main_container').select('[class="main_menu_text"]');

	tds.each(function(element, index) {
		links=element.select('a');
		links.each(function(a, index){
			a.style.width= (a.getWidth()+16)+"px";
		})
		//a.first.innerHTML='fsd';		
  		//element.innerHTML = element.innerHTML.length
	});
}

function setDynamicStyles(){
	//calculate the total width of the body - visible area
	//totalWidth= parseInt(document.body.clientWidth);

	totalWidth = parseInt(window.document.documentElement.clientWidth || (window.document.body.clientWidth || window.innerWidth));

	//alert(totalWidth);

 	deltaHeaderContainerWidth = 0;
	deltaLeftBodyWidth = 0;

 	if (Prototype.Browser.IE==true){
 		deltaHeaderContainerWidth = 0;
		deltaLeftBodyWidth = 0;
 	}


	//set the header container width
	$('header_container').style.width=parseInt(totalWidth-171)+"px";

// 	set the left_body container width
	$('left_body').style.width=parseInt(totalWidth-250)+"px";	

// 	set the middle_body container width
	$('middle_body').style.width=parseInt(totalWidth-520)+"px";	

// 	set the footer container width
	$('footer_container').style.width=parseInt(totalWidth-170)+"px";	
}

function addEvent(obj, evType, fn){ 
 	if (obj.addEventListener){ 
   		obj.addEventListener(evType, fn, false); 
   		return true; 
 	} else if (obj.attachEvent){ 
   		var r = obj.attachEvent("on"+evType, fn); 
   		return r; 
 	} else { 
   		return false; 
 	} 
}

addEvent(window, 'load', setAndKeepDynamicStyles);
//addEvent(window, 'load', setAndKeepDynamicStyles);

