
$(document).ready(function(){
// when the DOM is ready
	var imagePath = "/Portals/0/Immagini/Home/banner";
	var imageExt = ".png";
	var imageAlt = new Array("L'analisi territoriale per aumentare l'efficacia dei sistemi di Business Intelligence","Oltre 15 anni di esperienza nei Sistemi Informativi Geografici e nella Business Intelligence","Prodotti avanzati, intuitivi e semplici da usare frutto dell'esperienza decennale nella geo business intelligence");

	//depend of number of images: 3 (0 1 2)
	var randomnumber=Math.floor(Math.random()*3);

	var img = new Image();

	// wrap our new image in jQuery, then:
	$(img)
		// once the image has loaded, execute this code
		.load(function () {
			// set the image hidden by default
			$(this).hide();

			// with the holding div #loader, apply:
			$('#sitebanner')
				// then insert our image 
				.append(this);

			// fade our image in to create a nice effect
			$(this).fadeIn();
		})

		// if there was an error loading the image, react accordingly
		.error(function () {
			// notify the user that the image could not be loaded
		})

		// *finally*, set the src attribute of the new image to our image
		.attr({
			src: imagePath+randomnumber+imageExt,
			alt: imageAlt[randomnumber]
		});

});
