function ImageChanger(){
	
	var current_image = 0;
	var images = new Array();
	var image_sources = new Array();

    this.init = function(){
    	(function($) {
			if ($('#imageChanger')) {
				images = $('#imageChanger > img');
				imageChanger.preload();
				
				if(images.length > 1)
				window.setTimeout("imageChanger.showNext()", 6000);
			}
    	})(jQuery);
    }
	
    
	this.showNext = function(){
		(function($) {
			imageChanger.preload();
			
			if ($.browser.msie) 
			$(images[current_image]).css('display', "none");
			else 
			$(images[current_image]).fadeOut('slow');
			
			
			if(current_image < images.length - 1)
			current_image++;
			else 
			current_image = 0;
			
			if ($.browser.msie) 
			$(images[current_image]).css('display', "block");
			else 
			$(images[current_image]).fadeIn('slow');
			
				
			
			
			window.setTimeout("imageChanger.showNext()", 6000);
			
		})(jQuery);
	}

	
	this.preload = function(){
		if(current_image < images.length - 2)
		images[current_image + 2].src = image_sources[current_image + 2];
		
		if(current_image < images.length - 1)
		images[current_image + 1].src = image_sources[current_image + 1];
	} 
	
	this.setImageSources = function(is){
		image_sources = is;
	}

    var self = this;
}

var imageChanger = new ImageChanger();

(function($) {
	$(document).ready(function(){
		imageChanger.init();
	});

})(jQuery);
