$(document).ready(
  function()
  {
    $.metadata.setType("attr", "validate");
    $("#formNewReference").validate();
    $("#formNewNewsletter").validate();
    
    
    /* focusEmpty Elemente
    -  bei focus Feld leeren, sofern noch der Standardwert enthalten ist
    --------------------------------------------------------------------- */
    aFocusEmpty = Array();
    
    $('input.focusEmpty').each(
      function()
      {
        aFocusEmpty[$(this).attr('name')] = $(this).val();
      }
    );
    
    
    $('input.focusEmpty').focus(
      function()
      {
        if ($(this).val() == aFocusEmpty[$(this).attr('name')]) {
          $(this).val('');
        }
      }
    ).blur(
      function()
      {
        if ($(this).val() == '') {
          $(this).val(aFocusEmpty[$(this).attr('name')]);
        }
      }
    );
    
    /* Fancybox */
    $("a.fancybox").fancybox({
      'transitionIn'  :  'elastic',
      'transitionOut'  :  'elastic',
      'speedIn'    :  600, 
      'speedOut'    :  200, 
      'overlayShow'  :  true
    });
    
    /* (simpel) Akkordion */
    $('.accordionIndex').hide();
    $('.accordionContent').hide();
    $('.accordionLink').click(
      function()
      {
        $(this).nextAll('.accordionContent').fadeToggle();
      }
    );
    
    /* 
    $("article h1").wrapInner("<span />");
    $("article h2").wrapInner("<span />");
    $("article h3").wrapInner("<span />");
    */
    
    
    initializeMap();
    
    $('table.zebra1').each(
      function()
      {
        $(this).find('tr:nth-child(2n+1)').addClass('odd');
        $(this).find('tr:nth-child(2n)').addClass('even');
        $(this).find('tr:first-child').addClass('first');
        $(this).find('tr > td:first-child').addClass('first');
        $(this).find('tr > td:nth-child(2)').addClass('second');
      }
    );
    
    $('table.zebra2').each(
      function()
      {
        $(this).find('tr:nth-child(2n+2)').addClass('odd');
        $(this).find('tr:nth-child(2n+3)').addClass('odd');
        $(this).find('tr:nth-child(2n)').addClass('even');
        $(this).find('tr:nth-child(2n+1)').addClass('even');
        $(this).find('tr:first-child').addClass('first');
        $(this).find('tr > td:first-child').addClass('first');
        $(this).find('tr > td:nth-child(2)').addClass('second');
      }
    );
    
    $('video,audio').mediaelementplayer({
      // if the <video width> is not specified, this is the default
      defaultVideoWidth: 480,
      // if the <video height> is not specified, this is the default
      defaultVideoHeight: 270,
      // if set, overrides <video width>
      videoWidth: -1,
      // if set, overrides <video height>
      videoHeight: -1,
      // width of audio player
      audioWidth: 400,
      // height of audio player
      audioHeight: 30,
      // initial volume when the player starts
      startVolume: 0.8,
      // useful for <audio> player loops
      loop: false,
      // enables Flash and Silverlight to resize to content size
      enableAutosize: true,
      // the order of controls you want on the control bar (and other plugins below)
      features: ['playpause','progress','current','duration','tracks','volume','fullscreen'],
      
      // automatically selects a <track> element
      startLanguage: '',
      // a list of languages to auto-translate via Google
      translations: [],
      // a dropdownlist of automatic translations
      translationSelector: false,
      // key for tranlsations
      googleApiKey: ''
    });
    
    /*$('.tagReferenceLetter h2 span').css('cursor', 'pointer').click(
    function()
    {
    $(this).parent().parent().children('ul').slideToggle();
    return false;
  }
    );
    
    $('.tagReferenceLetters a').click(
    function()
    {
    sTarget = $(this).attr('href');
    if ($('.tagReferenceLetter'+sTarget+' ul').is(':hidden'))
    {
    $('.tagReferenceLetter'+sTarget+' h2 span').trigger('click');
  }
  }
    );
    
    $('.tagReferenceLetter .toTop a').click(
    function()
    {
    sTarget = $(this).parent().parent().attr('id');
    if ($('#'+sTarget+' ul').is(':visible'))
    {
    $('#'+sTarget+' h2 span').trigger('click');
  }
    return true;
  }
    );
    $('.tagReferenceLetter:not(#tags_A) h2 span').trigger('click');*/
  }
  
);

