function bannerFade(){
	
	if ($('.last_image').is(':visible')){
		$(".current_image").delay(5000).fadeOut(400, function() {
			$(".first_image").addClass("current_image");
			$(this).removeClass("current_image");
			$(".first_image").fadeIn(400, function() {
				//Fixes IE's clear-type issue on animated fonts
				if(jQuery.browser.msie) this.style.removeAttribute('filter');
				bannerFade();
			});
		});
	} else {
		$(".current_image").delay(5000).fadeOut(400, function() {
			$(this).next().addClass("current_image");
			$(this).removeClass("current_image").next().fadeIn(400, function() {
				//Fixes IE's clear-type issue on animated fonts
				if(jQuery.browser.msie) this.style.removeAttribute('filter');
				bannerFade();
			});
		});
	};
};

$(document).ready(function(){
	
	$("#banner img").first().addClass("current_image first_image");
	$("#banner img").last().addClass("last_image");
	
	bannerFade();
	
});

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)

jQuery.preLoadImages('images/banner_image1.jpg','images/banner_image2.jpg','images/banner_image3.jpg','images/banner_image4.jpg','images/banner_image5.jpg','images/banner_image6.jpg','images/banner_image7.jpg');
