Array.prototype.isIn = function ( what ) {
  if ( ! what ) return false;
  for ( var i = 0; i < this.length; i++ ) {
    if ( this[i] == what ) return true;
  }
  return false;
}

/**
== FILTER CLASS ==
*/
function Filter()
{
	this.displayType = "venue";
	this.categories = [];
	this.listingTypeId = "";
	this.groupName = "venue_featured";
}

/**
== MARKERS Container CLASS ==
*/
function Markers()
{
	this.markers = [];
}
Markers.prototype.addMarker = function(marker, category)
{
	if (!this.markers[category])
	{
		this.markers[category] = [];
	}
	this.markers[category].push(marker);
}

Markers.prototype.getMarkers = function(category)
{
	if (!this.markers[category])
	{
		return [];
	}
	return this.markers[category];
}
Markers.prototype.removeCategory = function(category)
{
	this.markers[category] = [];
}

/* Extending GMarker so they can have classes */
GMarker.prototype.initClasses = function(){
	if (typeof(this.mm_class_arr) == "undefined")
	{
		this.mm_class_arr = [];
	}
}

GMarker.prototype.hasClass = function(classname){
	this.initClasses();
	if (this.mm_class_arr.isIn(classname))
	{
		return true;
	}
	return false;
}
GMarker.prototype.addClass = function(classname){
	this.initClasses();
	if (!this.hasClass(classname) && classname !== undefined)
	{
		this.mm_class_arr.push(classname);
	}
}
GMarker.prototype.removeClass = function(classname){
	this.initClasses();
	var ind = this.mm_class_arr.isIn(classname);
	if (ind != -1)
	{
		delete this.mm_class_arr[ind];
	}
}
GMarker.prototype.getClasses = function(){
	this.initClasses();
	return this.mm_class_arr;
}
