function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
    }

jQuery.noConflict();
jQuery(document).ready(function($) {
	$(document).ready(function(){
		//JQuery ready is quicker than onload
		$(".contenttable tr").mouseover(function() {$(this).addClass("over");}).mouseout(function() {$(this).removeClass("over");});
		$(".contenttable tr:nth-child(odd)").addClass("alt");

		
	});


/*
* Author:      Marvin Reichert
*/

$(document).ready(function() {
		
	$("#showpicture1").click(function() {
		showpicture(1);
	});
	$("#showpicture2").click(function() {
		showpicture(2);
	});
	$("#showpicture3").click(function() {
		showpicture(3);
	});
	$("#showpicture4").click(function() {
		showpicture(4);
	});
	$("#showpicture5").click(function() {
		showpicture(5);
	});
	$("#showpicture6").click(function() {
		showpicture(6);
	});
	$("#showpicture7").click(function() {
		showpicture(7);
	});
	
	var interval;
	var aktiveImage;
	
	var slideshowSpeed = 8000;
	var fadeinOutSpeed = 1000;
	var maxImages = 7;
	//var activeContainer = 1;
	
	var showpicture = function(image) {		
		var oldImage = aktiveImage;
		aktiveImage = image;
		showImage(image, oldImage);
	};
	
	var currentZindex = -1;
	var showImage = function(image, oldImage) {
		
		clearInterval(interval);
		
		if(oldImage == undefined || image == oldImage){
			$("#headerimg" + image).stop(true, true).fadeIn(0,1);	
			$("#showpicture"+image).addClass('act');
		}else{
			$("#headerimg" + image).stop(true, true).fadeIn(fadeinOutSpeed);
			$("#headerimg" + oldImage).stop(true, true).fadeOut(fadeinOutSpeed);
			$("#showpicture"+image).addClass('act');
			$("#showpicture"+oldImage).removeClass('act');
		}
		
		var randomPic = randomFX(maxImages,image);
		
		interval = setInterval(function() {
			showpicture(randomPic);
		}, slideshowSpeed);
	};
	
	
	var randomFX = function(X,Y) {
		var newNumber;
		if(Y == undefined){
			newNumber = Math.floor(X * (Math.random() % 1));
		}else{
			
			for(i=0; i<X; i++){
				newNumber = Math.floor(X * (Math.random() % 1));
				if(newNumber+1 != Y){
					i = X;
				}else{
					i = 0;	
				}
			}
		}
		return newNumber + 1;
	};
	
	
	$("#headerimg1").fadeOut(0,0);
	$("#headerimg2").fadeOut(0,0);
	$("#headerimg3").fadeOut(0,0);
	$("#headerimg4").fadeOut(0,0);
	$("#headerimg5").fadeOut(0,0);
	$("#headerimg6").fadeOut(0,0);
	$("#headerimg7").fadeOut(0,0);
	
	var randomPic = randomFX(maxImages);
	showpicture(randomPic);	
	
   });

});
