PM_NavProgress.prototype = new PM_WeightedEvents;

function PM_NavProgress(nav) {
	var N = nav.NumPages();
	var weights = new Array;
	for(var i = 0; i < N; i++) {
		weights[i] = 1/N;
	}
	PM_WeightedEvents.call(this, weights);
	this.TriggerEvent(0); // nav loads the first page automatically, before
	                      // this object can even obeserve it
	
	// Now the object hijacks nav to observe it
	nav._progress         = this;
	nav._originalGotoPage = nav.GotoPage;
	nav.GotoPage = function(n) {
		this._progress.TriggerEvent(n);
		this._originalGotoPage(n);
	}
}
