// JavaScript Document
$(document).ready(function(){

// ##############################  MENU Squares #####################################


//$("#left_box_01 ."+square).css({backgroundColor: '#000000'});

//.delay (800);


/*
var square = 1;
var anfang = 0;
var ende = 4;

setInterval(function() {
					 
if ( anfang <= ende )	{
	$("#left_box_01 ." + square ).animate({"backgroundColor": "#c4415c"}, 500);
	$("#left_box_01 ." + square ).prev().animate({"backgroundColor": "#b51334"}, 500);	
	square = square+1;
	anfang = anfang+1;
}

else {	$("#left_box_01 .squares").css({backgroundColor: '#b51334'});	}}, 1500); // 1500 ms loop
*/

var sqInterval;
var a = 0;
//var z = 80;
var z = 12;

// var colorA = '#b51334';

// var colorB = '#c4415c';
// var colorB = '#cd5f75';

if ( firstpage == "1_0_0") { var z = 16; }



function change_squares() {
    var elements = $('#left_box_01 div.squares');
    var count = elements.length;
    var active = $('#left_box_01 div.squares.active');
    var next = (active.index() + 1) % count;
	
    active.removeClass('active').animate({"backgroundColor": "#b51334"}, 500);
    $(elements.get(next)).addClass('active').animate({"backgroundColor": "#a0a0a0"}, 500);
	
	a++;

	if ( a >= z )	{  
	clearInterval(sqInterval); // stopt Interval
	elements.removeClass('active').animate({"backgroundColor": "#b51334"}, 500);
	} 
	
}
sqInterval =  setInterval(change_squares, 900);



// ##############################  Thumb Scroller #####################################


// wenn IE Mist 

if ( !($.browser.msie && $.browser.version <= 7.0) ){ // IE Ausschluss bis 7.0


/* */
$("#referenzen_scroller.on.start").delay(2000) .animate({
    bottom: '0px',
	height: '20px',
	position: 'absolute'
	    
  }, 1000, function() {	  
  	//$('.status').replaceWith('<span class="status">Off</span>');	
	$('.status').css({backgroundPosition: '4px 0px'});
	$('#referenzen_scroller').removeClass('start');
	$('#referenzen_scroller').removeClass('on').addClass('off');
	
});// autom runterfahren


$("#referenzen_scroller").hover(function() {    
      $("#referenzen_scroller.off").animate({
	  bottom: '0px',
	  height: '150px',
	  position: 'absolute'
	  }, 100, function() {	  
	   //$('.status').replaceWith('<span class="status">On</span>');
	   $('.status').css({backgroundPosition: '4px -16px'});
	   $('#referenzen_scroller').removeClass('off').addClass('on');
	});// hochfahren
	
  }).mouseleave(function() {
      $("#referenzen_scroller.on").animate({  
	  bottom: '0px',
	  height: '20px',
	  position: 'absolute'
	  
	  }, 1000, function() {	  
	  //$('.status').replaceWith('<span class="status">Off</span>');
	  $('.status').css({backgroundPosition: '4px 0px'});
	  $('#referenzen_scroller').removeClass('on').addClass('off');
	  
	  });// runterfahren
  
  });

} // IE Ausschluss Ende



// # Scrolling Carousel ################ Reihenfolge wichtig!

$('div#ref_carousel').scrollingCarousel( {
	autoScroll: false,
	autoScrollDirection: 'left', 
	autoScrollSpeed: 1000,
	looped: false,
	scrollerAlignment : 'horizontal',
	ScrollerOffset: 0,	
	scrollSpeed: 'medium'

});


// BIG Show Bild

$("a.zoom_big").click(function() {

var bild = $(this).attr("id");
//alert("Bild Id: " +bild);

$(".bild_big").css({'display' : 'none'});								   
$(".bild_big."+bild).fadeIn(1000).css({'display' : 'block'});

});



// ### Scroll Pane ################################################
/*
	$('.scroll-pane').jScrollPane({
		//showArrows: true,
		arrowScrollOnHover: true,
		arrowButtonSpeed : 6
	});
*/

// ### MODULE #######################################################################


// ### Modul Sampler Icons ################################################	


setInterval(function() {
  //generiert random number 
  var randomnumberA=Math.floor(Math.random()*$(".sampler_ico").children().length);
  var randomnumberB=Math.floor(Math.random()*$(".sampler_ico").children().length);
   
  $(function() { 
	  //show all the images (if not already done) 
	  $(".sampler_ico > img").fadeIn('slow');  
	  	   
	  //set timeout for image to appear (set at 500ms) 
	  setTimeout(function(){ 
		 //fade in the random index of the image collection 
 
		 $(".sampler_ico > img:eq(" + randomnumberA + ")").fadeOut('slow');
		 $(".sampler_ico > img:eq(" + randomnumberB + ")").delay(1000).fadeOut('slow');
		 
		 $(".sampler_ico img:eq(" + randomnumberA + ")").delay(1500).fadeIn('slow');
		 
	  }, 500);    
  });
}, 3000); // Endlosschleife




// ### Modul Foto Ebene show ################################################	

$('a.zoom_ebene').click(function() {  
  //$('#foto_zoom').show('slow'); 
  
  $('#foto_zoom').toggle('slow'); 
  return false;

});

// ist ausgeblendet
$('a.zoom_ebene_close').click(function() {
$('#foto_zoom').hide('slow', function() {
    // Animation complete.
  });  
});

$('#foto_zoom img').click(function() {
$('#foto_zoom').hide('slow', function() {
    // Animation complete.
  });  
});

$('#foto_zoom img').hover(
  function() {
  $('h3.persons').show('fast');
  },
  function() {
  $('h3.persons').hide('slow');
  }
);


// ### Laufband ################################################	

$("#laufliste").simplyScroll({
	autoMode: 'loop',
	pauseOnHover: false,
	frameRate: 24,
	speed: 3
});

// ### 3D Visualisierung ################################################


// Colorbox ... iframe Visualisierung #############

$(".fotozoom").colorbox({ width:"600px", height:"600px"});

// z.B. 3D Visualisierungen
$(".iframe").colorbox({iframe:true, width:"1024px", height:"740px"});


$(".pdf_iframe").colorbox({iframe:true, width:"1024px", height:"740px"});	

//$(".iconzoom").colorbox({ width:"800px", height:"600px"});

$('a.iconzoom').colorbox({rel:'icons', width:"800px", height:"600px"});

// Trailer Verhaeltniss
$(".iframe_flash").colorbox({iframe:true,  width:"75%", height:"100%"});



// -- News ----- 

$(".iframe_news").colorbox({iframe:true, width:"800px", height:"650px"});





// Hauptscript in Module Leistungen Text Animation


$("img.text_b").delay(2000).fadeIn(5000);


// KARRIERE - Accordion

/*
$('#acc div').slideToggle(0);
$('#acc > h1').click(function(){
	$('#acc div:visible').slideToggle('slow');
	$('#acc h1.open').removeClass('open');
	
	$(this).next().slideToggle('slow');
	$(this).addClass("open");
	
	return false;
});
*/
	
	
$("#acc div").hide(); 
$("h1.toggle").click(function(){
	$(this).toggleClass("open").next().slideToggle(400, "easeOutExpo");
	return false; 
});



// ### Kundenstimmen - Faden ################################################

/**/





// SuchScript in Modul selber



// ### next Script ################################################	

// ### next Script ################################################	

// ### next Script ################################################	

// ### Quellen ################################################	
	// http://api.jquery.com/visual/
		
	// http://api.jquery.com/animate/
	// UI http://blarnee.com/wp/jquery-ui-animation-effects/
	
	
	
});				  
