    var pics = new Array("images/counterBackground.gif", "images/homeCornerBackground.gif", "images/homeBanner.gif", "images/homeIntro.gif", "images/mainBackground.jpg", "images/pageBackground.gif", "images/menuBackground.gif", "images/pollBackground.gif", "images/pollButton.gif", "menuImages/home.gif", "menuImages/contact.gif", "menuImages/guestBook.gif", "menuImages/rsvp.gif", "menuImages/registry.gif", "menuImages/maps.gif", "menuImages/moreInfo.gif", "menuImages/hotels.gif");
    
    var url = "index2.php";
    var doConfirm = true;
    var canSkip = false;
    
    var imgObjs = new Array(pics.length);
    var loaded = 0;
    var total = pics.length;
    var cPercent = 0;
    
    var barLayer = null;
    var percentLayer = null;
    var statLayer = null;
    var doneMsgLayer = null;
    
    
    function getLayer(layerID) {
        if (document.getElementById)
        	return document.getElementById(layerID);
        else if (document.all)
        	return document.all[layerID];
        else return null; 
    }
    
    
    function updateBar() {
        statLayer.innerHTML = "<font face=\"Arial\" color=\"#FFFFFF\"><B>" +loaded+ "/" +total+ "</B></font>";
        var percent = Math.round(loaded/total * 100);
        if (cPercent != percent) {
         	cPercent = percent;
        	barLayer.style.width = (cPercent*2) +"px";
        	percentLayer.innerHTML = "<font color=\"#FFFFFF\"><B>" +cPercent+ "%</B></font>"; 
        }
        if (loaded == total) {
        	doneMsgLayer.innerHTML = "<a href=\"javascript:done()\"><img src=\"images/splashEnter.gif\" width=\"230\" height=\"21\" border=\"0\" alt=\"You\'re invited to witness the union of Barbara Gunnels and Scott Doughty!  Come inside.\"></a>";
        	if (!doConfirm)
        		done(); 
        }
    }
    
    
    
    
    function startLoading() {
    if (document.getElementById || document.all) {
    	barLayer = getLayer("bar");
    	percentLayer = getLayer("percent");
    	statLayer = getLayer("stat");
    	doneMsgLayer = getLayer("doneMsg");
    	if (canSkip)
    		doneMsgLayer.innerHTML = "<a href=\"javascript:done()\"><font color=\"#FFCC00\" size=\"2\" face=\"Arial\">Skip Pre-Loading</font></a>";
    	for (i=0; i<pics.length; i++)
    		{
    		imgObjs[i] = new Image();
    		imgObjs[i].onload = imgLoaded;
    		imgObjs[i].onerror = imgFailed;
    		imgObjs[i].src = pics[i];
    		}
    	}
        else {
        	alert("You are likely running very old browser which is not compatible with preloading script.  Maybe it is time to update your browser.\n\nProgram is skipping preloading.");
        	window.location.replace(url);
    	}
    }
    
    
    
    
    function done() {
       window.location.replace(url);
    }
    
    function imgFailed() {
        alert("The following image failed to load, probably a broken link:\n" +this.src+ "\nPlease contact the webmaster of the site you are visiting about this.  The program will skip this file now.");
        loaded++;
        updateBar();
    }
    
    function imgLoaded() {
        loaded++;
        updateBar();
    }