jQuery.extend({
  gallery: function(imageArray, galleryDiv, switchDelay) {
  		theImages = eval(imageArray);
  		count = 0;
  		setInterval('count = $.updateGallery(theImages, "' + galleryDiv + '")', switchDelay);
  },
  updateGallery: function(imageArray, galleryDiv){
  		theImages = eval(imageArray);
  		
  		if(theImages[count] != undefined)
  		{
  			imageSrc = theImages[count].src;
  			$(galleryDiv).html('<img src="' + imageSrc + '">' + count + '"');
  			count++;
  		}
  		else
  		{
  			count = 0;
  			imageSrc = theImages[count].src;
  			$(galleryDiv).html('<img src="' + imageSrc + '">' + count + '"');
  		}
  		
  		return count;
  }  
});
