jQuery(
  function()
  {
    for (val in static) {
      $('#' + val).focus(
        function()
        {
          if (this.value == static[val])
            this.value = '';
        }
      ).blur(
        function()
        {
          if (this.value == '')
            this.value = static[val];
        }
      ).val(static[val]);
    }

    var s;
    if ($('.scrollable-items').size()) {
      $('.scrollable-items').css('position', 'absolute');
      if ($('.scrollable-items a').size() < 7)
        $('a.browse').hide();
      $('#thumbnail-box .scrollable').css('overflow', 'hidden').scrollable(
        {
          clickable:  false,
          item:       'a',
          size:       6,
          vertical:   true
        }
      ).find('a').click(
        function()
        {
          $(this).parent().find('a.selected').removeClass('selected');
          $(this).addClass('selected');

          $.get(
            this.href,
            {
              json: 1
            },
            function (data)
            {
              if (data.teaser != null)
                $('#teaser').replaceWith(data.teaser);
              if (data.content != null)
                $('#content').replaceWith(data.content);
              if (data.feature != null)
                $('#feature-links').replaceWith(data.feature);
              if (data.background != null)
                $('body').css('background-image', 'url(/media/img/' + data.background + ')');
            },
            'json'
          );
          return false;
        }
      );
    }
    $('a[href^=http]').attr('target', '_blank');
  }
);

