//<![CDATA[
$(function() {
	$('nav ul').each(function(index) {
	var ulclass = $(this).attr('class');
	if (ulclass == ""){
		$(this).each(function(index) {
		$(this).attr({'class' : 'second'});
		});
	}
	});
	var navifirstwidth = $('header nav ul.first').width();
	var navisecondwidth = $('header nav ul.second').width();
	var naviwidth = navifirstwidth + navisecondwidth; // $('header nav').width();
	$('header .naviwidth').css('width', naviwidth);
	var centrierer = (1020 - (naviwidth + 400)) / 2;
	$('.tdwhite').css('width', centrierer);
	var metanaviwidth = 315;
	var metawidth = metanaviwidth;
	$('.metanavi').css('width', metawidth);
	$('.header-slider ul li').each(function(index) {
	$('.header-slider-paginator').append('<li><a href="#"></a></li>');
  });

var copyrightwidth = $('.nosun').width();
var ballonwidth = $('.header-slider-paginator').width();

if (copyrightwidth >= ballonwidth) {
	var ballonwidthplus = (copyrightwidth - ballonwidth);
	$('.header-slider-paginator').css('padding-left', ballonwidthplus); 
	$('.copyright').css('width', copyrightwidth);
}
else {
	$('.copyright').css('width', ballonwidth);
}

/*Infoboxen Startseite*/
var y = 0;
$('.startpage .infobox').each(function(index) {
	if (y == 0) {
		$(this).attr({'class' : 'infobox first'});
		y = 1;
	}
	else if (y == 1) {
		$(this).attr({'class' : 'infobox second'});
		y = 0;
	}
	else {
		alert('da geht was nicht');
	}
});

	browser = navigator.userAgent;
	browser_ie_6 = browser.indexOf("MSIE 6");
	browser_ie_7 = browser.indexOf("MSIE 7");
	browser_ie_8 = browser.indexOf("MSIE 8");
	if (browser_ie_6 > -1 || browser_ie_7 > -1 || browser_ie_8 > -1)
	{
		var replaceStr1 = '<DIV class="infobox first"';
		var replaceStr2 = '</TBODY></TABLE></DIV><DIV class="infobox second">';
		var replaceStr3 = '</DIV></DIV>';
	}
	else
	{
		var replaceStr1 = '<div class="infobox first"';
		var replaceStr2 = '</tbody></table></div><div class="infobox second">';
		var replaceStr3 = '</div></div>';
	}
$('.startpage').each(function(index) {
	var rep = $(this).html();
	//rep0 = rep.replace(/\n/g,'');
	rep0 = rep.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g,'');
	rep1 = rep0.replace(replaceStr1,'<table><tr><td width="490" style="border-bottom:1px solid #dedede;"><div class="infobox first"');
	rep2 = rep1.replace(replaceStr2,'</tbody></table></div></td><td width="20"></td><td width="490" style="border-bottom:1px solid #dedede;"><div class="infobox second">');
	rep3 = rep2.replace(replaceStr3,'</div></td></tr></table></div>');
	$('.startpage').html(rep3);
	
});

});
function footerresize() {
	var copyrightwidth = $('.nosun').width();
	$('.copyright').css('width', copyrightwidth);
}
//]]>
