var jq = jQuery;

myFunction = function(){

	var obj = jq('.slide');
    //var arr = jq.makeArray(obj);
	var arr = [jq('#slide1'),jq('#slide2'),jq('#slide3'),jq('#slide4'),jq('#slide5'),jq('#slide6')];
	
	//var arrLength = arr.length;
	var arrLength = 6;

	var act = 0; //ArrayObjekt welches Aktiv ist
			
	//clearInterval(theInt);
			
	theInt = setInterval(function(){ 
		switch(act) {
			case 0:
				arr[5].hide();
				arr[0].show();
				act++;
			break;
  			
  			case 1:
				arr[0].hide();
				arr[1].show();
				act++;
			break;			
			
			case 2:
				arr[1].hide();
				arr[2].show();
				act++;
			break;
			
			case 3:
				arr[2].hide();
				arr[3].show();
				act++;
			break;
			
			case 4:
				arr[3].hide();
				arr[4].show();
				act++;
			break;
			
			case 5:
				arr[4].hide();
				arr[5].show();
				act++;
			break;			
			
			default:
				act = 0;
		}
	},3750);
	
	//	console.log("funktion");
	//	jq('.active').css('border','1px solid red');
	

	
	/*
// GING
/*		if(act <= arrLength) && (act != 0) { */
/*		if(act < arrLength) {		
			arr[act].hide();
			act++;
			arr[act].show();
		}
		else {
			act = 0;
		}
*/

/*
	//test fŸr ausnahme:
	if(act == 0){
		arr[4].hide();
		arr[0].show();
		act++;
	}		
	
	//idee:
	clearInterval(theInt);
	
	theInt = setInterval(function(){
		//var act = jq('.active');
		//var next = jq('.active').next();
		
		//console.log(next);
		
		//jq(act).removeClass('active'):
		//jq(next).addClass('active').show();
		
		
	},750);	
	*/
};

jq(document ).ready(function() {
	console.log("Seite geladen(2)");	//Konsolen Ausgabe!
      		
	    // Start Reiter
	    //Default Action
	        jq(".slide").hide();
	        jq("ul.simple-nav li:first").addClass("active").show();
	        jq(".slide:first").show();
	    //On Click Event
	    jq("ul.simple-nav li").click(function() {
	        jq("ul.simple-nav li").removeClass("active");
	        jq(this).addClass("active");
	        jq(".slide").hide();		        
		     	
	        var activeTab = jq(this).find("a").attr("href");
	        jq(activeTab).fadeIn(); 
	        return false;
	    });
		    	
		// Start Reiter
		//Default Action
		jq(".slide").hide();
		jq("ul.thumb-nav li:first").addClass("active").show();
		jq(".slide:first").show();
		//On Click Event
		jq("ul.thumb-nav li").click(function() {
			jq("ul.thumb-nav li").removeClass("active");
			jq(this).addClass("active");
			jq(".slide").hide();     	
			var activeTab = jq(this).find("a").attr("href");
			jq(activeTab).fadeIn();
			return false;
	    });

	myFunction();

});
