var dummy = function($) {
  
function fadeInHomePageLogo() {
//  $('.documentFirstHeading, .documentDescription').hide();
  $('.homePageLogo, #lang-select').hide();
  // $('.documentFirstHeading, .documentDescription').fadeIn(1000);
  $('#lang-select').fadeIn(1000);
  $('.homePageLogo').fadeIn(3000);
}

function attachThickboxesToBodyImages() {  
  // attach thickbox to every image in body text
  $('#content img[class!="noThickBox"]').each(function(idx, el) {
    var img = $(el);
    // attach thickbox only if image is wrapped in <a>
    // that have href ending with /image_view_fullscreen
    var a = img.parent('[href$=/image_view_fullscreen]');
    if (a.length > 0 || img.attr('src').match(/\image_/)) {
      // apply custom styling
      img.css('cursor', 'pointer');

      // create thickbox overlay for every image
      // calculate bigger image location
      var parts = img.attr('src').split('/');
      parts = parts.slice(0, parts.length-1);
      parts.push('image_large');
  
      // then prepare details text
      var deatils = '';
      var desc = $('#parent-fieldname-imageCaption', a.parent());
      if (desc.length == 1) {
        // set thickbox details to image caption
        details = desc.text();
      } else if (desc.length == 0) {
        // or image alt tag otherwise
        details = img.attr('alt');
      }
      var overlay = $('<div class="thickboxContainer"><a class="close"></a><img src="' + parts.join('/') + '" /><div class="details">' + details + '</div></div>');
      $('body').append(overlay);
      
      // attach thickbox
      img.overlay({
        'target': overlay,
        'mask': {
            'color': '#999999',
            'loadSpeed': 200,
            'opacity': 0.9
          },
        'closeOnClick': true,
        'fixed': false
      });
    }
  });
}

function fixSearchBox() {
  // tick "only in current section" checkbox by default
  var box = $('#searchbox_currentfolder_only');
  if (box.length == 1) {
    box.attr('checked', 'checked');
  }
}

function suppressLinkTitles() {
  // here we just remove titles from navigations
  $('#nav-1st-level a[title], #nav-2nd-level a[title]').removeAttr('title');
}

$(function() {
  fadeInHomePageLogo();
  attachThickboxesToBodyImages();
  fixSearchBox();
  suppressLinkTitles();
});

}(jQuery);

delete dummy;

