// JavaScript Document
<!--


var theImages = new Array();

	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover2.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover3.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover4.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover5.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover6.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover7.jpg");
	theImages.push("http://www.madendz.com/assets/madendzintro/open/websitecover8.jpg");
	//theImages.push("assets/madendzintro/websitecover9.jpg");
	//theImages.push("assets/madendzintro/websitecover10.jpg");

	
var j = 0
var p = theImages.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}

var whichImage = Math.round(Math.random()*(p-1));
// function showImage(){
// document.write('<img src="'+theImages[whichImage]+'">');
// }

$(function () {
  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:
      $('#loader')
        // remove the loading class (so no background spinner), 
        .removeClass('loading')
        // 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', theImages[whichImage]);
});

//-->

