$(document).ready(function() {
  
  // Footer
  $('.top a').before('<img src="fileadmin/html/images/ico_print.png" alt="" /> <a id="print" href=\"javascript:window.print();\">Seite drucken</a> <img src="fileadmin/html/images/ico_totop.png" alt="" /> ');
  
  // Suche
  $('html[lang=de] input#f_suche[@value=]').attr('value','Suche');
  $('html[lang=de] input#f_suche').blur( function() { if(this.value=='') { this.value='Suche'; } } ).focus( function () { if(this.value=='Suche') { this.value=''; } } );
  
  // externe Links
  $('#col1_content a[href^=http] img, #col2_content a[href^=http] img').parent('a').addClass('imageinside');
  $('#col1_content a[href^=http][class!=imageinside], #col2_content a[href^=http][class!=imageinside]').prepend('<img class="jsico" src=\"fileadmin/html/images/ico_ext.png\" alt=\"\" />');
  
  /* Tabs Startseite
  $('.jstabs').accessibleTabs({
      wrapperClass: 'jstabs-content',
      currentClass: 'current',
      tabhead: 'h3',
      tabbody: '.jstabs-body',
      fx: 'fadeIn',
      fxspeed: 'normal',
      currentInfoText: 'Aktueller Tab: ',
      currentInfoPosition: 'prepend',
      currentInfoClass: 'jstabs-current-info'
  });
  */
  
  // Slideshow Startseite
  $('.slideshow').cycle({ fx: 'fade', speed: 800, timeout: 6000, next: '.slideshow' });
  
  // Bilder Startseite
  $('#start a.audi, #start a.vw').hover(
    function() { $(this).children('img').stop().animate({opacity: 0}, 1000); },
    function() { $(this).children('img').stop().animate({opacity: 1}, 1000); }
  );
  
  // Bildvergrößerungen
  $('a.fancybox').fancybox();
  
  /* Reifenformular */
  $('#reifenformular #submit').after('<p class="boxlink"><a class="iframe" href="http://www.reifen-info-system.de/tyre.php?id=48779&encpasswd=c36a281c3c6baae1382a2768f611cc68">Reifen anzeigen</a></p>').css('display','none');
  $('#reifenformular a.iframe').fancybox({
      'callbackOnStart': function() {
          var url = 'http://www.reifen-info-system.de/tyre.php?action=s_new&g=new&shop_id=48779&t=' + $('#f_type').val() + '&w=' + $('#f_width').val() + '&h=' + $('#f_height').val() + '&inch=' + $('#f_inch').val() + '&s=' + $('#f_speed').val() + '&m=' + $('#f_manufacturer').val();
          $('a.iframe').attr('href',url);
      },
      'frameHeight': 600,
      'frameWidth': 960
  });
  
  // Tooltip
  $('#marken a').hover(function () { $('#tooltip').addClass('toppos')}, function () { $('#tooltip').removeClass('toppos')}).tooltip({ track: true, delay: 0, showURL: false, left: -120 });
  
  /* Datumsfeld */
  $.dpText = {
    TEXT_PREV_YEAR   : 'vorhergehendes Jahr',
    TEXT_PREV_MONTH  : 'vorhergehender Monat',
    TEXT_NEXT_YEAR   : 'nächstes Jahr',
    TEXT_NEXT_MONTH  : 'nächster Monat',
    TEXT_CLOSE       : 'Schließen',
    TEXT_CHOOSE_DATE : 'Datum wählen'
  }
  $('#f_date').datePicker();
  
  $('#adminpanel #ap-content').css('display','none');
  $('#adminpanel').append('<a href="#"><img src="fileadmin/html/images/btn_adminpanel.png" alt="" /></a>').hover( function() { $(this).children('#ap-content').show('fast'); }, function() { $(this).children('#ap-content').hide('fast'); });
  /*
  $('td.typo3-editPanel-controls a img[src$=history2.gif]').parent('a').attr('title','Bearbeitungsverlauf anzeigen');
  $('td.typo3-editPanel-controls a img[src$=move_page.gif]').parent('a').attr('title','Seite verschieben');
  $('td.typo3-editPanel-controls a img[src$=new_page.gif]').parent('a').attr('title','Neue Seite anlegen');
  $('td.typo3-editPanel-controls a img[src$=edit2.gif]').parent('a').attr('title','Datensatz bearbeiten');
  $('td.typo3-editPanel-controls a img[src$=button_up.gif]').parent('a').attr('title','Datensatz nach oben schieben');
  $('td.typo3-editPanel-controls a img[src$=button_down.gif]').parent('a').attr('title','Datensatz nach unten schieben');
  $('td.typo3-editPanel-controls a img[src$=button_hide.gif]').parent('a').attr('title','Datensatz ausblenden');
  $('td.typo3-editPanel-controls a img[src$=new_record.gif]').parent('a').attr('title','Datensatz einfügen');
  $('td.typo3-editPanel-controls a img[src$=delete_record.gif]').parent('a').attr('title','Datensatz löschen');
  $('td.typo3-editPanel-controls a').tooltip({ extraClass: "editPanel", delay: 0, showURL: false });
  */
});
