i have a progress bar at the top of my page, i want the bar to show the progress of the loading of the web page. when the entire page is loaded for i want the bar to display 100%. i'm quite certain i need to list a variable of '$(window).load();' or '$(document).ready()' but i'm not sure where.

my code:

<!doctype html>
<meta charset="utf-8">
progress {
width: 100%;
height: 5px;
top: 0;
left: 0;
position: absolute;
color: #1990c8;
appearance: none;
-webkit-appearance: none;
-o-appearance: none;
progress::-moz-progress-bar {
background: #1990c8;
progress::-webkit-progress-value {
background: #1990c8;
progress::-webkit-progress-bar {
background: #e1e1e1;
<progress id="progressbar" value="0" max="100"></progress>
<span id="status"></span>
<script type="text/javascript" language="javascript">
function progressbaranimation(a) {
var bar = document.getElementById('progressbar');
bar.value = a;
var sim = setTimeout("progressbaranimation("+a+")");
var amount = 0;
<img src="http://media.npr.org/images/picture-show-flickr-promo.jpg">
<img src="http://dd508hmafkqws.cloudfront.net/sites/default/files/mediaimages/gallery/2012/Dec/AA-502716%20(1).jpg">