jQuery.noConflict();

jQuery(document).ready(function ($)
{
  // Navigation 
  $('li.nav_li_level1').hover(function() {
    $(this).find('ul.nav_ul_level2').stop()
    .height('auto')
    .slideDown(300);
  } , function() {
     $(this).find('ul.nav_ul_level2').stop()
    .slideUp(150);
  });

	// rgTabs den rechtesten Border entfernen
  	jQuery('.sidebarBoxContent').each(function(){
		jQuery(this).find('.news-latest-item').last().css('border-right','none');
	});

	var hist = document.referrer;
	jQuery('.news-single-backlink').show('fast');
	jQuery('.lang-0 .news-single-backlink a').attr('href', hist).html('&laquo; Zurück');
	jQuery('.lang-1 .news-single-backlink a').attr('href', hist).html('&laquo; Back');

  // Keyvisual animation
	jQuery("#keyvisual").peKeyVisualSlider();
	
	
	// Startseite animation
	function toggleImgMapElements(element){
    $('#imgmap-placeholder img').each(function(index) {
      $(this).hide();
    });
    $('#imgmap-text-placeholder div').each(function(index) {
      $(this).hide();
    });
    $('#img-' + element).show();
    $('#imgmap-text-' + element).show();
	}
	
	// gelb
	$('#imgarea-gelb').hover(function () {
    toggleImgMapElements('gelb');
  });
  
  // blau
  $('#imgarea-blau').hover(function () {
    toggleImgMapElements('blau');
  });
  
  // orange
  $('#imgarea-orange').hover(function () {
    toggleImgMapElements('orange');
  });
    
  $('.imgmap-out').mouseenter(function(){
    toggleImgMapElements('default');
  });
  
  $('#imgmap-placeholder').mouseleave(function(){
    toggleImgMapElements('default');
  });
  
  
  // Dienstleistungen animation
  function toggleImgMapTextElements(arr)
  {
    jQuery.each(arr, function() {
      
      var element = this;

      $('#imgarea-' + element).hover(function(){
        $('#imgmap-text-' +element).show();
      }, function(){
        $('#imgmap-text-' + element).hide();
      });
   });
  }
  
  var arr = ['ead', 'apm', 'pm', 'sdp', 'dca', 'eai', 'bpm'];
  
  toggleImgMapTextElements(arr);

    
});
