$(document).ready(function(){

	contentboxes = $('.home_concerts').length;
	maxbox = contentboxes;
	currentbox = 0;

	rotateContent(currentbox);
	var gesie = setInterval("rotatePartners()",3000);
	
	currentPartner=1;
	
	sliderwidth = 1013;
	
	$('.slide-inside .slide-1 .textbox').animate({"margin-top":"-140px"},1000,function() {
	
		headerRotate(1);
		
	});
	

});

function rotateContent(currentbox) {

	$('.home-item-'+currentbox).delay(4000).fadeOut(1000, function() {
	
		currentbox++;
	
		if(currentbox==maxbox) {
			$('.home-item-0').fadeIn(1000, function() {
			
				currentbox=0;
				rotateContent(currentbox);
			
			});
		} else {
			$('.home-item-'+currentbox).fadeIn(1000,function() {
			
				rotateContent(currentbox);
				
			});
		}
	
	});

}


function rotatePartners() {

	
	if(currentPartner==4) {
		$('#footerleft .box-1').animate({"margin-top":"0"},500);
		currentPartner=1;
	} else {
		$('#footerleft .box-1').animate({"margin-top":"-=120"},500);
		currentPartner++;
	}

}

function headerRotate(counting) {

	if(counting==0) {
		
		$('.slide-inside .slide-3 .textbox').delay(4000).animate({"margin-top":"0px"},500, function() {
		
			$('.slide-inside').animate({"margin-left":"0px"},1000,function () {
			
				$('.slide-inside .slide-1 .textbox').animate({"margin-top":"-140px"},500,function() {
				
					counting++;
					
					headerRotate(counting);
				
				});
			
			});
			
		});
	
	} else {
	
	
		$('.slide-inside .slide-'+counting+' .textbox').delay(4000).animate({"margin-top":"0px"},500,function() {
	
			sliderpos = sliderwidth * counting;
			
			counting++;
	
			$('.slide-inside').animate({"margin-left":"-"+sliderpos+"px"},1000, function() {
		
				$('.slide-inside .slide-'+counting+' .textbox').animate({"margin-top":"-140px"},500,function () {
			
					if(counting==3) {
					
						headerRotate(0);
					
					} else {
					
						headerRotate(counting);
					
					}
					
				});
		
			});
	
	
		});
		
	}
	
}


