jQuery.noConflict();
jQuery(document).ready(function($){
  $('.tx_wxpagetaser').hover(function(){
    $(this).addClass('hover');
  },function(){
    $(this).removeClass('hover');
  });
  $('li.lvl1').hover(function(){
    $(this).addClass('show2');
  },function(){
    $(this).removeClass('show2');
  });
  $('li.lvl2').hover(function(){
    $(this).addClass('show3');
  },function(){
    $(this).removeClass('show3');
  });
  if($($('.id161 h4')).length > 1) {
    $('h4:not(:last)').addClass('noMargin');
  }
  $('.id161 h4').each(function(i){
    $(this).parent().find('>*:not(h4)').wrapAll('<div class="cToShow" />');
  });
  if($($('.id218 h4')).length > 1) {
    $('h4:not(:last)').addClass('noMargin');
  }
  $('.id218 h4').each(function(i){
    $(this).parent().find('>*:not(h4)').wrapAll('<div class="cToShow" />');
  });
  $('.cToShow').hide();
  
  $('h4').click(function(){
    $('h4').not($(this)).removeClass('active');
    $('.cToShow').not($(this).next()).slideUp(300);
    if ($($(this).next('.cToShow:visible')).length > 0) {
      $(this).next().slideUp(300);
      $(this).removeClass('active');
    }
    if ($($(this).next('.cToShow:visible')).length <= 0) {
      
      $(this).next().css('backgroundColor','#fcfcfc').slideDown(300, function(){
        $(this).css('backgroundColor','transparent');
      });
      $(this).addClass('active');
    }
  });
  $('span.important').parent().parent().addClass('border-bottom');
});


jQuery(document).ready(function($){
  $('#col1 #kontakt input.powermail_text').each(function(){
    $(this)
      .focus(function(){
        if($(this).hasClass('notset')) {
          $(this).attr('value','').removeClass('notset');
        }
      })
      .addClass('notset').attr('value', $(this).prev('label').text());
  });
  $('#col1 #kontakt textarea.powermail_textarea').each(function(){
    $(this)
      .focus(function(){
        if($(this).hasClass('notset')) {
          $(this).html('').removeClass('notset');
        }
      })
      .addClass('notset').html($(this).prev('label').html());
  });
}); 

jQuery(document).ready(function($){
  year = '';
  $('.id74 .news-list-item .date').each(function(i,d){
    y = $(d).text().split('.')[2];
    $(d).parent().addClass(y);
    if (year != y ) {
      $(d).parent().before('<h2>Presseaussendungen '+y+'</h2>');
      year = y;
    }
  });
});


/*Powermail validation
*/

jQuery(document).ready(function($){
  $('#uid38,#uid39,#uid22,#uid23,#uid40,#uid41,#uid43').attr('disabled','disabled').addClass('disabled');
  //$('#uid38').parent().prev().find('[type=checkbox]:checked').length > 0
  $('#check_uid35_0').click(function(){
    if ($(this).is(':checked')) {
      $('#uid38,#uid39').removeAttr('disabled').removeClass('disabled').attr('required','required');
    } else {
      $('#uid38,#uid39').attr('disabled','disabled').addClass('disabled').removeAttr('required');
    }
  });
  if ($('#check_uid35_0').is(':checked')) {
    $('#uid38,#uid39').removeAttr('disabled').removeClass('disabled').attr('required','required');
  } else {
    $('#uid38,#uid39').attr('disabled','disabled').addClass('disabled').removeAttr('required');
  }
  $('#check_uid34_0').click(function(){
    if ($(this).is(':checked')) {
      $('#uid22,#uid23').removeAttr('disabled').removeClass('disabled').attr('required','required');
    } else {
      $('#uid22,#uid23').attr('disabled','disabled').addClass('disabled').removeAttr('required');
    }
  });
  if ($('#check_uid34_0').is(':checked')) {
    $('#uid22,#uid23').removeAttr('disabled').removeClass('disabled').attr('required','required');
  } else {
    $('#uid22,#uid23').attr('disabled','disabled').addClass('disabled').removeAttr('required');
  }
  $('#check_uid36_0').click(function(){
    if ($(this).is(':checked')) {
      $('#uid40,#uid41').removeAttr('disabled').removeClass('disabled').attr('required','required');
    } else {
      $('#uid40,#uid41').attr('disabled','disabled').addClass('disabled').removeAttr('required');
    }
  });
  if ($('#check_uid36_0').is(':checked')) {
    $('#uid40,#uid41').removeAttr('disabled').removeClass('disabled').attr('required','required');
  } else {
    $('#uid40,#uid41').attr('disabled','disabled').addClass('disabled').removeAttr('required');
  }
  $('#check_uid42_0').click(function(){
    if ($(this).is(':checked')) {
      $('#uid43').removeAttr('disabled').removeClass('disabled').attr('required','required');
    } else {
      $('#uid43').attr('disabled','disabled').addClass('disabled').removeAttr('required');
    }
  });
  if ($('#check_uid42_0').is(':checked')) {
    $('#uid43').removeAttr('disabled').removeClass('disabled').attr('required','required');
  } else {
    $('#uid43').attr('disabled','disabled').addClass('disabled').removeAttr('required');
  }
  
});


