$(document).ready(function(){

	/* ========== */
	/* = SLIDES = */
	/* ========== */
	$('.header_slide').innerfade({			
		speed: 'slow',
		timeout: 10000,
		type: 'sequence',
		containerheight: '250px',
		runningclass: 'slide'
	});
	
	$('.image_fade .csc-textpic-imagecolumn ul').innerfade({			
		speed: 'slow',
		timeout: 10000,
		type: 'sequence',
		runningclass: 'slide'
	});
	
	
	/* ================ */	
	/* = KONTAKT TABS = */
	/* ================ */	
    var tabs = [];
    var tabContainers = [];
    $('ul.kontakt h3 > a').each(function () {
		tabs.push(this);
		tabContainers.push($(this.hash).get(0));
    });
    
    $(tabs).click(function () {
    	if($(tabContainers).filter(this.hash).is(":hidden")){
			$(tabContainers).slideUp('slow').filter(this.hash).slideDown('slow');
			$(tabs).removeClass('selected');
			$(this).addClass('selected');
        }
        return false;
    });  

	/* =========== */	
	/* = H2 TABS = */
	/* =========== */	
    $('.accordion-h2 h2').click(function () {
        if ( !$(this).parents('.accordion-h2').hasClass('selected') ) {
            $('.jobs-list-container').css('display','none');
            $('.accordion-h2').removeClass('selected');
        };
        $(this).parents('.accordion-h2').addClass('selected');
        $(this).parents('.accordion-h2').find('.jobs-list-container').slideToggle();
    });
    	
	/* ============= */
	/* = STANDORTE = */
	/* ============= */
	var standorte = [];
	$('#standorte ul > li div.standort_box').each(function () {
        standorte.push(this);
    });	
	var standorte_icons = [];
	$('#standort_icons .logo_small').each(function () {
        standorte_icons.push(this);
    });
	
    $(standorte).mouseover(function() {
		$(standorte).removeClass('active');
		$(standorte).addClass('inactive');
		$(this).removeClass('inactive');
		$(this).addClass('active');
		$(this).find('.bridge').css('display','block');
		$(this).find('.detail').css('display','block');		
		$('#standort_icons').hide();
	}).mouseout(function(){
		$(standorte).removeClass('inactive');
		$(standorte).removeClass('active');
		$('.bridge').css('display','none');
		$('.detail').css('display','none');		
		$('#standort_icons').show();
	}); 
	
	$(standorte_icons).mouseover(function() {
		$(this).css('cursor','pointer');	
		$(standorte).removeClass('active');
		$(standorte).addClass('inactive');
		var standort_id = $(this).attr('id');
		$('#standorte ul > li.'+ standort_id + ' div.standort_box').removeClass('inactive');
		$('#standorte ul > li.'+ standort_id + ' div.standort_box').addClass('active');
	}).mouseout(function(){
		$(standorte).removeClass('active');
		$(standorte).removeClass('inactive');		
	});	
	
	
	
	function click (e) {
	  if (!e)
		e = window.event;
	  if ((e.type && e.type == "contextmenu") || (e.button && e.button == 2) || (e.which && e.which == 3)) {
		if (window.opera)
		  window.alert("Sorry: Diese Funktion ist deaktiviert.");
		return false;
	  }
	}
	if (document.layers)
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = click;
	document.oncontextmenu = click;
     
});
