/*
	Snippet from:
	http://www.guyfromchennai.com/?p=26
*/
Array.prototype.findIndex = function(value){
	var ctr = "";
	for (var i=0; i < this.length; i++) {
		// use === to check for Matches. ie., identical (===), ;
		if (this[i] == value) {
			return i;
		}
	}
	return ctr;
};

Array.prototype.contains = function(value){
	for (var i=0; i < this.length; i++) {
		// use === to check for Matches. ie., identical (===), ;

		if (this[i] == value) {
			return true;
		}
	}
	return false;
};

Array.prototype.first = function(){
	return this[0];
}

Array.prototype.last = function(){
	return this[this.length - 1];
}


Array.prototype.numberOfGroups = function(groups){
	return parseInt(this.length / groups);
}

Array.prototype.dateIsWithinRange = function(dte){
	return this.datesAreWithinRange(new Array(dte));
}

Array.prototype.datesAreWithinRange = function(dates){
	var first = this.first().getTime();
	var last = this.last().getTime();
	for(var i = 0; i < dates.length; i++) {
		var compare = dates[i].getTime();
		if(compare < first || compare > last){
			return false;
		}
	}
	return true;
}