function startSlideShow(slideshowID, options, slides)
{
   var totalSlideCount = slides.length;
   if (totalSlideCount == 0) return;
   document.getElementById(slideshowID).innerHTML = '<li><img class="f_l" src="' + slides[0] + '" /></li><li><img class="f_l" src="' + slides[1] + '" /></li>';
   options = options || {};
   options.before = onBefore;
   $('#' + slideshowID).cycle(options);
   function onBefore(curr, next, opts, fwd)
   {
      // on Before arguments:
      //  curr == DOM element for the slide that is currently being displayed
      //  next == DOM element for the slide that is about to be displayed
      //  opts == slideshow options
      //  fwd  == true if cycling forward, false if cycling backward
      // on the first pass, addSlide is undefined (plugin hasn't yet created the fn yet)
      if (!opts.addSlide) return;
      // have we added all our slides?
      if (opts.slideCount == totalSlideCount) return;
      // shift or pop from our slide array
      var nextSlideSrc = slides[opts.slideCount];
      // add our next slide
      opts.addSlide('<li><img class="f_l" src="' + nextSlideSrc + '" /></li>', fwd == false);
   };
}

function hideBadElements()
{
   $('*[badelement="1"]').css('visibility', 'hidden');
}

function showBadElements()
{
   $('*[badelement="1"]').css('visibility', 'visible');
}

function checkUploadedImage(cids, mode)
{
   return (typeof(document.getElementById(cids[0]).src) != 'undefined');
}

function showLoader()
{
   if (!controls.$('fade')) return;
   controls.fade('fade', true, 0.8);
}

function hideLoader()
{
   if (!controls.$('fade')) return;
   controls.display('fade', 'none');
}
