// allImagesLoaded()
// Checks if all the images are loaded in the document
// It Does this by looping through all the images and checks the attribute .complete
// If .complete is false then we set the return variable to 0
function allImagesLoaded ( ) {
// return variable
var imagesloaded = 1;
// All images are saved in an array called document.images. Very usefull
var images = document. images;
// Loop through all the images
for ( var i = 0;i<images. length;i++ )
{
// If the image isnt loaded we set the return varible to 0
if (images [i ]. complete == false ) {
imagesloaded = 0;
}
}
// This will return 0 if one or more images are not loaded and 1 if all images are loaded.
return imagesloaded;
}