cIconoRuta.prototype = new google.maps.OverlayView();		
function cIconoRuta(latlon, image, map, number, sInfo)
{
	this.latlon_ = latlon;
	this.image_ = image;
	this.map_ = map;
	//numero del paso
	this.number_ = number;
	this.sInfo_= sInfo;
	this.div_ = null; 
	this.setMap(map);
	this.info_ = new parent.pv.google.maps.InfoWindow({content: "",  maxWidth: 200,  position: latlon});
}
cIconoRuta.prototype.onAdd = function() {
    // Note: an overlay's receipt of onAdd() indicates that
    // the map's panes are now available for attaching
    // the overlay to the map via the DOM.
	var divOv = document.createElement('DIV');
    divOv.style.borderStyle = "none";
    divOv.style.borderWidth = "0px";
    divOv.style.position = "absolute";
    divOv.style.cursor = "pointer";
	if (this.image_) divOv.style.backgroundImage='url(' + this.image_ + ')';
	else {
		divOv.innerHTML = '<div id="RESULTADO"><input type="hidden"><span class="numeracion_routing">' + this.number_ + '</span></div>';
	}
	divOv.style.backgroundRepeat = 'no-repeat';	
	var myOverLay = this;
	if (divOv.addEventListener){
		divOv.addEventListener('mouseover', function(event){ addPOIInfoRuta(event,myOverLay);}, false);
	} else if (divOv.attachEvent){
		divOv.attachEvent('onmouseover', function(event){ addPOIInfoRuta(event,myOverLay);});  
	}
	if (divOv.addEventListener){
		divOv.addEventListener('mouseout', function(event){ cierra_tooltip("tooltip_normal");}, false);
	} else if (divOv.attachEvent){
		divOv.attachEvent('onmouseout', function(event){ cierra_tooltip("tooltip_normal");});  
	}

	//divOv.onMouseOver= function () {addPOIInfoRuta(myOverLay);};  
	//divOv.onmouseout= function () {cIconoRuta.closeInfo(myOverLay);};
    // Set the overlay's div_ property to this DIV
    this.div_ = divOv;
    // We add an overlay to a map via one of the map's panes.
    // We'll add this overlay to the overlayImage pane.
    var panes = this.getPanes();
    panes.overlayImage.appendChild(divOv);
}
 
cIconoRuta.prototype.draw = function() {
	//cogemos la proyeccion para sacar las coordenadas x e y dentro del mapa dado un objeto lat/lon
	var overlayProjection = this.getProjection();
	//transformamos el latlon a (x,y) para situar
	var pt = overlayProjection.fromLatLngToDivPixel(this.latlon_);
	var div = this.div_;
	div.style.left = (pt.x-9)+ 'px';
	div.style.top = (pt.y-9) + 'px';
	div.style.width = '18px';
	div.style.height = '18px';
}
 
cIconoRuta.prototype.onRemove = function() {
	this.div_.parentNode.removeChild(this.div_);
	this.div_ = null;
}

cIconoRuta.showInfo = function (iconoRuta) {
	iconoRuta.info_.setOptions({
		//disableAutoPan: true, 
		content: iconoRuta.sInfo_
	});	
	iconoRuta.info_.open(iconoRuta.map_);
} 

cIconoRuta.closeInfo = function (iconoRuta) {
	iconoRuta.info_.close();
} 
	
