/**
 * VariableTauschen
 */

function VariableTauschen( WasGenau )	{
		$("#News").attr("href", "index.php?id1=" + WasGenau );
		$("#Uns").attr("href", "ueber_uns.php?id1=" + WasGenau );
		$("#Verleih").attr("href", "verleih.php?id1=" + WasGenau );
		$("#Referenz").attr("href", "referenz.php?id1=" + WasGenau );
		$("#Kontakt").attr("href", "kontakt.php?id1=" + WasGenau );
		$("#Karriere").attr("href", "karriere.php?id1=" + WasGenau );
		$("#Impressum").attr("href", "impressum.php?id1=" + WasGenau );
		$("#Agb").attr("href", "agb.php?id1=" + WasGenau );
		//alert (WasGenau);
	}
	

$(document).ready(function() {
	 $('#insideParent').draggable(	{
				zIndex: 	1000,
				axis: 'x', 
				cursor: 'pointer', 
				delay: 1, 
				containment : 'parent',
				refreshPositions: true,
				drag: function(event, ui) {
    				var pos = $(this).position();
					if ( pos.left > 1 && pos.left < 60 )	 {
						    $('#News').addClass('navNews_a').removeClass('navNews');
					}						
					else {
						    $('#News').addClass('navNews').removeClass('navNews_a');
					}	
					
					if ( pos.left > 60 && pos.left < 142  )	 {
						    $('#Uns').addClass('navUns_a').removeClass('navUns');
					}	
					else {
						    $('#Uns').addClass('navUns').removeClass('navUns_a');
					}	
					
					if ( pos.left > 142 && pos.left < 298  )	 {
						    $('#Verleih').addClass('navVerleih_a').removeClass('navVerleih');
					}	
					else {
						    $('#Verleih').addClass('navVerleih').removeClass('navVerleih_a');
					}	
					
					if ( pos.left > 298 && pos.left < 386  )	 {
						    $('#Referenz').addClass('navReferenz_a').removeClass('navReferenz');
					}	
					else {
						    $('#Referenz').addClass('navReferenz').removeClass('navReferenz_a');
					}
					
					if ( pos.left > 386 && pos.left < 466  )	 {
						    $('#Kontakt').addClass('navKontakt_a').removeClass('navKontakt');
					}	
					else {
						    $('#Kontakt').addClass('navKontakt').removeClass('navKontakt_a');
					}	
  				},
				stop: function(event, ui) {
    				var pos = $(this).position();
					if ( pos.left > 1 && pos.left < 62 )	 {
						    document.location.href = "index.php?id1="+ende ;
					}
					
					if ( pos.left > 62 && pos.left < 142  )	 {
						    document.location.href = "ueber_uns.php?id1="+ende ;
					}	
					
					if ( pos.left > 142 && pos.left < 298  )	 {
						    document.location.href = "verleih.php?id1="+ende ;
					}	
					
					if ( pos.left > 298 && pos.left < 386  )	 {
						    document.location.href = "referenz.php?id1="+ende ;
					}
					
					if ( pos.left > 386 && pos.left < 466  )	 {
						    document.location.href = "kontakt.php?id1="+ende ;
					}											
					if ( pos.left > 466 && pos.left < 546  )	 {
						    document.location.href = "karriere.php?id1="+ende ;
					}	
  				}

			}
		);
});


	
var gesamtbilder = picutre.length;
$(document).ready(function(){
	for (z = 0; z< gesamtbilder; z++) {
		$("#bild_0"+z).attr({ 
	    src:  'imgs/' + picutre[z] 
	   	});
	}
});


$(document).ready(function(){
		if (anfang == "oben")	{
	   		$('#schalter').rotateAnimation(90);	
			ende = "oben";	
			VariableTauschen( ende );
			$("body").animate({ backgroundColor: "#e5e5e5" }, "slow");
			$("#inhalt").animate({ color: "#84888d" }, "slow");
		}
		if (anfang == "links")	{
	   		$('#schalter').rotateAnimation(0);	
			ende = "links";	
			VariableTauschen( ende );
			$("body").animate({ backgroundColor: "#333333" }, "slow");
			$("#inhalt").animate({ color: "#a3a7ac" }, "slow");
		}
		if (anfang == "rechts")	{
	   		$('#schalter').rotateAnimation(180);	
			ende = "rechts";	
			VariableTauschen( ende );
			$("body").animate({ backgroundColor: "#ffffff" }, "slow");
			$("#inhalt").animate({ color: "#a3a7ac" }, "slow");
		}
});
	

	
$(document).ready(function(){
	$('#left').click(
	    function () {
			if ( anfang == "links" )	{
				$('#schalter').rotateAnimation(0);	
				ende = "links";	
			}
			if ( anfang == "oben" )	{
				$('#schalter').rotateAnimation(0);	
				ende = "links";	
			}
			if ( anfang == "rechts" )	{
				$('#schalter').rotateAnimation(360);	
				ende = "links";	
			}
			VariableTauschen( ende );
			anfang = ende;
			$("body").animate({ backgroundColor: "#333333" }, "slow");
			$("#inhalt").animate({ color: "#a3a7ac" }, "slow");
			}
			
	);
	$('#top').click(
	    function () {
			if ( anfang == "links" )	{
				$('#schalter').rotateAnimation(90);
				ende = "oben";	
			}
			if ( anfang == "oben" )	{
				$('#schalter').rotateAnimation(90);	
				ende = "oben";	
			}
			if ( anfang == "rechts" )	{
				$('#schalter').rotateAnimation(90);
				ende = "oben";	
			}
			 /*$("body").animate( { backgroundColor: 'hellgrau' }, 1000); //#e5e5e5
			 $("#inhalt").animate( { color: 'weissaufgrau' }, 1000); //#84888d	*/
			anfang = ende;
			//$('.verweis').attr('href', window.location+"?id1=oben");

  			
			VariableTauschen( ende );
			$("body").animate({ backgroundColor: "#e5e5e5" }, "slow");
			$("#inhalt").animate({ color: "#84888d" }, "slow");
		}
	);
	$('#right').click(
	    function () {
			if ( anfang == "rechts" )	{
				$('#schalter').rotateAnimation(180);	
				ende = "rechts";	
			}
			if ( anfang == "oben" )	{
				$('#schalter').rotateAnimation(180);	
				ende = "rechts";	
			}
			if ( anfang == "links" )	{
				$('#schalter').rotateAnimation(180);	
				ende = "rechts";	
			}
			
			anfang = ende;

			VariableTauschen( ende );
			$("body").animate({ backgroundColor: "#ffffff" }, "slow");
			$("#inhalt").animate({ color: "#a3a7ac" }, "slow");
	    }
	);
					

});


