
var js_slide_show =
{
  load: function(gallery)
  {
    var config =
    {
      fx: gallery.fx,
      randomizeEffects: 0,
      speed: gallery.speed,
      timeout: gallery.timeout,
      cssAfter: {'z-index': 0},
      //after: js_slide_show.update_link,
      after: function (c, n, o, f){js_slide_show.update_link(gallery.id, o.currSlide);},
      autostop: gallery.autostop,
      autostopCount: $('#gallery_' + gallery.id + ' img').length + 1
    };

    var cycle = function(){$('#gallery_' + gallery.id).cycle(config);};
    $('#gallery_' + gallery.id + ' img:first').fadeIn(1000, cycle);
  },

  update_link: function(id, c)
  {
    for (var i = 0; i < js_slide_show.urls.length; i ++)
    {
      if (js_slide_show.urls[i].id == id)
      {
        var img = js_slide_show.urls[i].img[c];
        if (img.href.length)
        {
          $('#gallery_link_' + id).css('cursor', 'pointer');
          $('#gallery_link_' + id).attr('href', img.href);
          $('#gallery_link_' + id).attr('target', img.target);
        }
        else
        {
          $('#gallery_link_' + id).css('cursor', 'default');
          $('#gallery_link_' + id).attr('href', 'javascript: return false');
          $('#gallery_link_' + id).attr('target', '_self');
        }
      }
    }
  },

  urls: []
}

// uncover - up
$.fn.cycle.transitions.uncoverUp = function($cont, $slides, opts) {
  opts.direction = 'up';
  $.fn.cycle.transitions.uncover($cont, $slides, opts);
};

// uncover - right
$.fn.cycle.transitions.uncoverRight = function($cont, $slides, opts) {
  opts.direction = 'right';
  $.fn.cycle.transitions.uncover($cont, $slides, opts);
};

// uncover - down
$.fn.cycle.transitions.uncoverDown = function($cont, $slides, opts) {
  opts.direction = 'down';
  $.fn.cycle.transitions.uncover($cont, $slides, opts);
};

// uncover - left
$.fn.cycle.transitions.uncoverLeft = function($cont, $slides, opts) {
  opts.direction = 'left';
  $.fn.cycle.transitions.uncover($cont, $slides, opts);
};

