(function(c){var h=[];c.loadImages=function(a,d){a instanceof Array||(a=[a]);for(var e=a.length,f=0,g=e;g--;){var b=document.createElement("img");b.onload=function(){f++;f>=e&&c.isFunction(d)&&d()};b.src=a[g];h.push(b)}}})(jQuery);

jQuery(document).ready(function(){
 
  var preload = new Array();
  jQuery('span.preload').each(function(){
    preload.push(jQuery(this).html());
  });
  jQuery.loadImages(preload,function(){
    var i = 0;
    jQuery.each(preload, function(index, img){
      if(i > 0)
      {
        var image = '<img src="'+img+'" alt="" class="slide" style="display:none" />';
        jQuery('div#icontainer').append(image);
      }      
      i++;
    });
    window.setInterval(updateSlideShow, 7000);
  });
  
 });

/* SLIDESHOW */
function updateSlideShow()
{
  var active = jQuery('.activei');
  active.removeClass('activei');
  
  var next = active.next().length ? active.next() : jQuery('#icontainer').children('.slide:first');
  next.addClass('activei');
  
  active.fadeOut('slow', function(){
      next.fadeIn('slow');
  });
}


