function onBefore() {
    $('#focus_pic_title').html(this.alt);
};

// When document is ready
$(document).ready(function()
{
    if ($('#focus_pic_fade')) {
        $('#focus_pic_fade').cycle({
            delay:  2000,
            speed:  500,
            before: onBefore
        });
    }

  $('.focus_pic').click(function()
  {
      window.location = manufactureSlugUrl;
  });

  $(".external").click(function () {

      // If we don't have the manufacture id then we don't do anything.
      if (focusProjectId == '') {
          return true;
      }

      // Send an jax request to log the click.
      $.ajax({
          type : "POST",
         async : false,
          url  : statslogUrl,
          data : 'data[ExternalLinkStatistic][link]=' + this.href + '&data[ExternalLinkStatistic][model_id]=' + focusProjectId + '&data[ExternalLinkStatistic][model_name]=FocusProject'
      });

      return true;
  });
});

