var locationAfterPreload = "http://www.beavertoe.com/pulse/pulse.html";
var lengthOfPreloadBar = 150;
var heightOfPreloadBar = 15;
var yourImages = new Array("http://www.beavertoe.com/pulse/pieces/about_text.png","http://www.beavertoe.com/pulse/pieces/about.png","http://www.beavertoe.com/pulse/pieces/blue_ring.png","http://www.beavertoe.com/pulse/pieces/contact_text.png","http://www.beavertoe.com/pulse/pieces/contact.png","http://www.beavertoe.com/pulse/pieces/inner_ring.png","http://www.beavertoe.com/pulse/pieces/main_ring.png","http://www.beavertoe.com/pulse/pieces/media_arrows.png","http://www.beavertoe.com/pulse/pieces/media.png","http://www.beavertoe.com/pulse/pieces/outer_ring.png","http://www.beavertoe.com/pulse/pieces/pulse.png","http://www.beavertoe.com/pulse/pieces/purple_ring.png","http://www.beavertoe.com/pulse/pieces/red_ring.png","http://www.beavertoe.com/pulse/pieces/screen1.png","http://www.beavertoe.com/pulse/pieces/screen2.png","http://www.beavertoe.com/pulse/pieces/screen3.png","http://www.beavertoe.com/pulse/pieces/screen4.png","http://www.beavertoe.com/pulse/pieces/screen5.png","http://www.beavertoe.com/pulse/pieces/white_circle.png","http://www.beavertoe.com/pulse/pieces/animation_on.png","http://www.beavertoe.com/pulse/pieces/animation_off.png","http://www.beavertoe.com/pulse/pieces/purchase.png");

if (document.images) 
{
	var preImages = new Array();
	var currCount = 0; 
	var loaded = new Array()
	var i,timerID;
	var increment = yourImages.length / 12.0;
	var currInc = increment;
	var nextBar = 0;
}
//document.write('<p><small><a href="javascript:window.location=locationAfterPreload">Skip Preloading</a></small></p>')

function loadImages() 
{ 
	for (i = 0; i < yourImages.length; i++) 
	{ 
		preImages[i] = new Image();
		preImages[i].src = yourImages[i];
	}
	
	for (i = 0; i < preImages.length; i++) 
	{ 
		loaded[i] = false;
	}
	checkLoad();
}

function checkLoad() {
	if (currCount == preImages.length) { 
		if( nextBar < 12)
			document.getElementById("p"+nextBar).style.visibility = 'visible';
		location.replace(locationAfterPreload)
		return
	}
	for (i = 0; i <= preImages.length; i++) {
		if (loaded[i] == false && preImages[i].complete) 
		{
			loaded[i] = true;
			currCount++;
			
			if( currInc < currCount )
			{
				document.getElementById("p"+nextBar).style.visibility = 'visible';
				currInc += increment;
				nextBar++;
				
			}
		}
	}
	timerID = setTimeout("checkLoad()",1000);
}