
// jquery
$("document").ready(function() {
  
  // Bookmark
  if (window.external || window.sidebar)
  {
    $("#bookmark-cb").css("display", "inline").children(":checkbox").attr("checked", "checked");
  }
  // homepage
  if (window.external && !window.sidebar)
  {
    $("#homepage-cb").css("display", "inline").children(":checkbox").attr("checked", "checked");
  }
  
  // AJAX Search
  $("#search :input").each(function () {
    $(this).change(function () {
      $("#results_preview_link").click();
    });
  });
  
  // show password
  try
  {
    if (document.URL.match('/fr/'))
    {
      var str = 'Afficher en clair';
    }
    
    $("#user_profile_password").showPassword('.checker', {
      text: str,
    });
  }
  catch (err) {}
  
  try
  {
    // fancybox
    $("a.fancybox").fancybox();
    
    $("a.ajax_fancybox").fancybox({
      'zoomSpeedIn':        300,
      'zoomSpeedOut':       300,
      'hideOnContentClick': false
    });
  }
  catch (err) {}
  
  try
  {
    // tooltips
    $(".tooltip").qtip({
      prerender: true,
      position: { 
        target: 'mouse',
        corner: 'bottomLeft',
        adjust: { x: 0, y: -10 }
      },
      style: {
        'padding': '10px 20px',
        border: { width: 1 },
        tip: 'bottomLeft',
        name: 'light',
      }
    });
  }
  catch (err) {}
});

