function mrpAnimMarker( latlng,  map, imgURL, width, height, anchorX, anchorY ) {
	this.latlng_ = latlng;
	this.imgURL_ = imgURL;
	this.width_ = width;
	this.height_ = height;
	this.anchorX_ = anchorX || 0;
	this.anchorY_ = anchorY || 0;
	this.setMap(map);
}
 
mrpAnimMarker.prototype = new google.maps.OverlayView();
 
mrpAnimMarker.prototype.draw = function() {
	var me = this;
 
 	var point = this.getProjection().fromLatLngToDivPixel(this.latlng_);
 	
	var div = this.div_;
	if (!div) {
		div = this.div_ = document.createElement("div");
		if( navigator.userAgent.indexOf( "iPad" ) != -1 ) {
			div.className = "mrp-custom-marker mrp-custom-marker-anim";
		}
		else {
			div.className = "mrp-custom-marker";
		}
		if( this.width_ )
			div.style.width = this.width_ + "px";
		if( this.height_ )
			div.style.height = this.height_ + "px";
 	
		var img = document.createElement("img");
		img.src = this.imgURL_;
		img.width = this.width_;
		this.height = this.height_;
		div.appendChild(img);
		google.maps.event.addDomListener(div, "click", function(event) {
			google.maps.event.trigger(me, "click");
		});
		
		div.style.webkitTransitionProperty = "";
		div.style.top = ( point.y - window.innerHeight - 200 ) + "px";
 
		// Then add the overlay to the DOM
	}
	
	var panes = this.getPanes();
	panes.overlayImage.appendChild(div);
 
	// Position the overlay 
	
	if (point) {
		var self = this;
		if( div.className.indexOf( "mrp-custom-marker-anim" ) != -1 ) {
			setTimeout( function() {
				div.style.webkitTransitionProperty = "top";
				div.style.left = ( point.x - self.anchorX_  ) + 'px';
				div.style.top = ( point.y - self.anchorY_ ) + 'px';
			}, 100 );
		}
		else {
			div.style.left = ( point.x - self.anchorX_  ) + 'px';
			div.style.top = ( point.y - self.anchorY_ ) + 'px';
		}
	}
};
 
mrpAnimMarker.prototype.remove = function() {
	// Check if the overlay was on the map and needs to be removed.
	if (this.div_) {
		this.div_.parentNode.removeChild(this.div_);
		this.div_ = null;
	}
};

mrpAnimMarker.prototype.setIcon = function( imgURL, width, height, anchorX, anchorY )
{
	this.imgURL_ = imgURL;
	this.width_ = width;
	this.height_ = height;
	this.anchorX_ = anchorX || 0;
	this.anchorY_ = anchorY || 0;
	
	if( this.div_ ) {
		this.div_.parentNode.removeChild(this.div_);
	}
	//this.draw();
};

mrpAnimMarker.prototype.setPosition = function( latLng ) {
	this.latlng_ = latLng;
	this.draw();
};

mrpAnimMarker.prototype.getPosition = function() {
	return this.latlng_;
};
