
		// Constructor for Priority Queue
		// Accepts one argument which is a comparison function to use when determining priorities
		// if this argument is provided it is assigned to the _compare property. If not, the function uses its default compare 
		// function. There is also an _items array which holds the Array object of item to compare
		function PriorityQueue(fnCompare) {
		
			this._items = new Array();
			if (typeof fnCompare == 'function') {
				this._compare = fnCompare;
			}
		
		} // function
		
		// Comparison Function
		// Returns a neative number if the first number is less than the second (first should come before the second)
		// Returns a positive number is the first number is greater than the second (first shoudl come after the second)
		// Returns 0 if the two number are equal and should not change position in the array
		function compare(oValue1, oValue2) {
			return oValue1 - oValue2;
		} // function
		
		
		PriorityQueue.prototype = {
		
			_compare : function (oValue1, oValue2) {
				return oValue1 - oValue2;
			},
			
			get : function () {
				return this._items.shift();
			},
			
			item : function (iPos) {
				return this._items[iPos];
			},
			
			peek : function () {
				return this._items[0];
			},
			
			prioritize : function () {
				this._items.sort(this._compare);
			},
			
			put : function (oValue) {
				this._items.push(oValue);
				this.prioritize();
			},
		
			remove : function (oValue) {
				
				for (var i=0; i<this._items.length; i++) {
					if (this._items[i] === oValue) {
						this._items.splice(i, 1);
						return true;
					}
				}
				
			},
			
			size : function () {
				return this._items.length;
			}
		
		};