$(document).ready(function () {

	/* --- IE 6 resizing tablecloth on scroll and resize --- */
	if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
		
		var widthonload = '';
		widthonload = $("#tablecloth").width();
		
		$(window).resize(function() {
			widthonload = $(window).width() + $(window).scrollLeft();
			$("#tablecloth").css({ width:widthonload});
			$(window).scrollLeft("0");
		});
	
		$(window).scroll(function() {
			var newscroll = widthonload + $(window).scrollLeft();
			$("#tablecloth").css({ width:newscroll});
		});
	}
	
	$(".farbe").hide();
	$(".switchonhover").each(function() {
		$(this).mouseenter(function() {	
			$(this).find(".bw").hide();
			$(this).find(".farbe").show();
		});
		$(this).mouseleave(function() {
			$(this).find(".bw").show();
			$(this).find(".farbe").hide();		
		});
	});
	
});

function toggleContent(id, picsmax) { /* Funktion tauscht Bilder und aktiven Button aus. picsmax: Anzahl der Bilder */
	
	id = "content" + id;
	var e;
	for (var i = 1; i <= picsmax; i++) {
		e = document.getElementById('content'+i);
		if (e) e.style.display = (id == 'content'+i) ? 'block' : 'none';
	}
	for (var i = 1; i <= picsmax; i++) {
		e = document.getElementById('content'+i+'_lnk');
		if (e) e.className = (id == 'content'+i) ? 'active' : '';
	}
	return false;
}

var lastImage = 1;

function nextContent(picsmax) {
	var nextImage = lastImage + 1;
	if (nextImage > picsmax) nextImage = 1;
	toggleContent(nextImage, picsmax);
	lastImage = nextImage;
}
