function MostrarTexto(elm,texto){
	var elemento=document.getElementById(elm);
	elemento.innerHTML="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Descripcion:&nbsp;</strong>"+texto+"</font>";
}
/*******************/
/*Clase NovaqGMap*/
var map;
var globalMarker;
var cambiar=true;
var Padre;
var PuntosRef;
var Locales;
var cantidadLocales=0;
var cantidadPuntosRef=0;
var ovcontrolCurrentMap=1;
var ovcontrol;
var conOvermap=1;
function SetearZoom(){
	var overleaymap=ovcontrol.getOverviewMap();
	if(overleaymap.getZoom()!=map.getZoom()){
		overleaymap.setZoom(map.getZoom());
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
}
function ChangeMap(){
	var ovmap=ovcontrol.getOverviewMap();
	if(ovcontrolCurrentMap==0){
		map.setMapType(map.getMapTypes()[0]);
		ovmap.setMapType(ovmap.getMapTypes()[1]);
		ovcontrolCurrentMap=1;
	}
	else if(ovcontrolCurrentMap==1){
		map.setMapType(map.getMapTypes()[1]);
		ovmap.setMapType(ovmap.getMapTypes()[0]);
		ovcontrolCurrentMap=0;
	}
}
function NovaqGMap(){
	this.Zoom;
	this.Xinit;
	this.Yinit;
	this.ImagenMarker;
	this.conOvermap;
	/*carga el mapa
	padre= (parent) o (opener);
	x=centro coordenada x del mapa;
	y=centro coordenada y del mapa
	zoom: valor del zoom;
	contenido= div donde esta el mapa ("map")
	*/
	this.Load=function Load(x,y,zoom,contenido,GetTileurlFunctionHibrid,GetTileurlFunctionNovaq,Tsate,Thib,TNovaq){
		if (GBrowserIsCompatible()) {
			this.Zoom=zoom;
			this.Xinit=x;
			this.Yinit=y;
			conOvermap=1;
			map = new GMap2(document.getElementById(contenido));
			/*Hibrid*/
			var tilelayers = [new GTileLayer(new GCopyrightCollection(),8,18),new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayers[0].getTileUrl = function(a,b){
				return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
			}
			tilelayers[0].isPng= function() {return true;} 
			tilelayers[1].getTileUrl = GetTileurlFunctionHibrid;
			tilelayers[1].isPng= function() {return true;} 
			var custommap = new GMapType(tilelayers, G_SATELLITE_MAP.getProjection(), Thib,{errorMessage:_mMapError});
			map.addMapType(custommap);
			
			/*Novaq*/
			var tilelayersM = [new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayersM[0].getTileUrl = GetTileurlFunctionNovaq;
			tilelayersM[0].isPng= function() {return true;} 
			var custommap2 = new GMapType(tilelayersM, G_SATELLITE_MAP.getProjection(), TNovaq,{errorMessage:_mMapError});
			map.addMapType(custommap2);
			
			map.removeMapType(G_NORMAL_MAP);
			map.removeMapType(G_HYBRID_MAP);
			map.removeMapType(G_SATELLITE_MAP);
			map.setCenter(new GLatLng(x,y), zoom,custommap);
			map.addControl(new GSmallMapControl());
			map.addControl(new GScaleControl());
			//map.enableScrollWheelZoom();
			ovcontrol = new GOverviewMapControl(new GSize(150,150));
			GEvent.clearInstanceListeners(ovcontrol);
      		map.addControl(ovcontrol);
			var funLoadAllPR=this.loadAllPuntosRef;
			var remoAllPRT=this.removeAllPuntosRefTemp;
			var funPriorityPR=this.loadPriorityPuntosRef;
			this.LoadOverviewMap(custommap,custommap2);
			GEvent.addListener(map, 'zoomend', function(oldLevel, newLevel) {
				var loadAllPuntosRef=funLoadAllPR;
				var removeAllPuntosRefTemp=remoAllPRT;
				var loadPriorityPuntosRef=funPriorityPR;
				if(newLevel>=17 && newLevel<=18){
					loadAllPuntosRef();
				}
				if(newLevel>=15 && newLevel<=16){
					loadPriorityPuntosRef();
				}
				if(newLevel<15){
					removeAllPuntosRefTemp();
				}
				setTimeout("SetearZoom();",500);
			});
			GEvent.addListener(map, 'movestart', function() {
				setTimeout("SetearZoom();",500);
			});
    	}
	}
	this.LoadSinOverview=function LoadSinOverview(x,y,zoom,contenido,GetTileurlFunctionHibrid,GetTileurlFunctionNovaq,Tsate,Thib,TNovaq){
		if (GBrowserIsCompatible()) {
			this.Zoom=zoom;
			this.Xinit=x;
			this.Yinit=y;
			conOvermap=0;
			map = new GMap2(document.getElementById(contenido));
			/*Hibrid*/
			var tilelayers = [new GTileLayer(new GCopyrightCollection(),8,18),new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayers[0].getTileUrl = function(a,b){
				return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
			}
			tilelayers[0].isPng= function() {return true;} 
			tilelayers[1].getTileUrl = GetTileurlFunctionHibrid;
			tilelayers[1].isPng= function() {return true;} 
			var custommap = new GMapType(tilelayers, G_SATELLITE_MAP.getProjection(), Thib,{errorMessage:_mMapError});
			map.addMapType(custommap);
			
			/*Novaq*/
			var tilelayersM = [new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayersM[0].getTileUrl = GetTileurlFunctionNovaq;
			tilelayersM[0].isPng= function() {return true;} 
			var custommap2 = new GMapType(tilelayersM, G_SATELLITE_MAP.getProjection(), TNovaq,{errorMessage:_mMapError});
			map.addMapType(custommap2);
			
			map.removeMapType(G_NORMAL_MAP);
			map.removeMapType(G_HYBRID_MAP);
			map.removeMapType(G_SATELLITE_MAP);
			map.setCenter(new GLatLng(x,y), zoom,custommap);
			map.addControl(new GMapTypeControl());
			//map.addControl(new GSmallMapControl());
			//map.enableScrollWheelZoom();
			var funLoadAllPR=this.loadAllPuntosRef;
			var remoAllPRT=this.removeAllPuntosRefTemp;
			var funPriorityPR=this.loadPriorityPuntosRef;
			GEvent.addListener(map, 'zoomend', function(oldLevel, newLevel) {
				var loadAllPuntosRef=funLoadAllPR;
				var removeAllPuntosRefTemp=remoAllPRT;
				var loadPriorityPuntosRef=funPriorityPR;
				if(newLevel>=17 && newLevel<=18){
					loadAllPuntosRef();
				}
				if(newLevel>=15 && newLevel<=16){
					loadPriorityPuntosRef();
				}
				if(newLevel<15){
					removeAllPuntosRefTemp();
				}
			});
    	}
	}
	this.LoadOverviewMap=function LoadOverviewMap(custommap,custommap2){
		var omap=document.getElementById("map_overview");
		omap.firstChild.style.border = "1px solid gray";
		omap.firstChild.firstChild.style.left="4px";
		omap.firstChild.firstChild.style.top="18px";
		omap.firstChild.firstChild.style.width="140px";
		omap.firstChild.firstChild.style.height="126px";
		var diva= document.createElement("div");
		diva.innerHTML="<div align=\"center\"><a class=\"link_infowindow2\" href=\"javascript:ChangeMap();\">Haz click para cambiar</a></div>";
		omap.firstChild.appendChild(diva);
		GEvent.clearInstanceListeners(ovcontrol.getOverviewMap());
		var ovmap = ovcontrol.getOverviewMap();
		ovmap.addMapType(custommap);
		ovmap.addMapType(custommap2);
		ovmap.removeMapType(G_NORMAL_MAP);
		ovmap.removeMapType(G_HYBRID_MAP);
		ovmap.removeMapType(G_SATELLITE_MAP);
		ovmap.setCenter(new GLatLng(this.Xinit,this.Yinit), this.Zoom,custommap2);
		GEvent.addListener(ovmap,"click",function(){
			if(ovcontrolCurrentMap==0){
				map.setMapType(map.getMapTypes()[0]);
				ovmap.setMapType(ovmap.getMapTypes()[1]);
				ovcontrolCurrentMap=1;
			}
			else if(ovcontrolCurrentMap==1){
				map.setMapType(map.getMapTypes()[1]);
				ovmap.setMapType(ovmap.getMapTypes()[0]);
				ovcontrolCurrentMap=0;
			}
		});
	}
	this.LoadE=function LoadE(x,y,zoom,contenido,GetTileurlFunctionNovaq,GetTileurlFunctionHibrid,Thib){
		if (GBrowserIsCompatible()) {
			this.Zoom=zoom;
			this.Xinit=x;
			this.Yinit=y;
			conOvermap=0;
			map = new GMap2(document.getElementById(contenido));
			
			/*Hibrid*/
			var tilelayers = [new GTileLayer(new GCopyrightCollection(),8,18),new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayers[0].getTileUrl = function(a,b){
				return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
			}
			tilelayers[0].isPng= function() {return true;} 
			tilelayers[1].getTileUrl = GetTileurlFunctionHibrid;
			tilelayers[1].isPng= function() {return true;} 
			var custommap = new GMapType(tilelayers, G_SATELLITE_MAP.getProjection(), Thib,{errorMessage:_mMapError});
			map.addMapType(custommap);
			
			/*novaq*/
			var tilelayersM = [new GTileLayer(new GCopyrightCollection(),8,18)];
			tilelayersM[0].getTileUrl = GetTileurlFunctionNovaq;
			tilelayersM[0].isPng= function() {return true;} 
			var custommap2 = new GMapType(tilelayersM, G_SATELLITE_MAP.getProjection(), "Novaq",{errorMessage:_mMapError});
			map.addMapType(custommap2);
			
			map.removeMapType(G_NORMAL_MAP);
			map.removeMapType(G_HYBRID_MAP);
			map.removeMapType(G_SATELLITE_MAP);
			map.addControl(new GMapTypeControl());
			map.setCenter(new GLatLng(x,y), zoom,custommap);
			map.addControl(new GSmallMapControl());
    	}
	}
	/*Crea el mapa nuevo*/
    this.LoadNew=function LoadNew(x,y,zoom,contenido,padre,imagen,GetTileurlFunctionHibrid,GetTileurlFunctionNovaq) {
      if (GBrowserIsCompatible()) {
	  	this.Zoom=zoom;
		this.Xinit=x;
		this.Yinit=y;
		conOvermap=1;
		Padre=padre;
		this.ImagenMarker=imagen;
        map = new GMap2(document.getElementById(contenido));
		
		/*Hibrid*/
		var tilelayers = [new GTileLayer(new GCopyrightCollection(),8,18),new GTileLayer(new GCopyrightCollection(),80,18)];
		tilelayers[0].getTileUrl = function(a,b){
			return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
		}
		tilelayers[0].isPng= function() {return true;} 
		tilelayers[1].getTileUrl = GetTileurlFunctionHibrid;
		tilelayers[1].isPng= function() {return true;} 
		var custommap = new GMapType(tilelayers, G_SATELLITE_MAP.getProjection(), "Hibrido",{errorMessage:_mMapError});
		map.addMapType(custommap);
			
		/*Novaq*/
		var tilelayersM = [new GTileLayer(new GCopyrightCollection(),8,18),new GTileLayer(new GCopyrightCollection(),8,18)];
		tilelayersM[0].getTileUrl = function(a,b){
			return G_SATELLITE_MAP.getTileLayers()[0].getTileUrl(a,b);
		}
		tilelayersM[1].getTileUrl = GetTileurlFunctionNovaq;
		tilelayersM[1].isPng= function() {return true;} 
		var custommap2 = new GMapType(tilelayersM, G_SATELLITE_MAP.getProjection(), "Novaq",{errorMessage:_mMapError});
		map.addMapType(custommap2);
		
		map.removeMapType(G_NORMAL_MAP);
		map.removeMapType(G_HYBRID_MAP);
		map.removeMapType(G_SATELLITE_MAP);
		map.setCenter(new GLatLng(x,y), zoom,custommap);
		map.addControl(new GSmallMapControl());
		map.addControl(new GScaleControl());
		ovcontrol = new GOverviewMapControl(new GSize(150,150)); 
		GEvent.clearInstanceListeners(ovcontrol);
		map.addControl(ovcontrol);
		//map.enableScrollWheelZoom();
		this.AgregarEventosSetPoints();
		var funLoadAllPR=this.loadAllPuntosRef;
		var remoAllPRT=this.removeAllPuntosRefTemp;
		var funPriorityPR=this.loadPriorityPuntosRef;
		this.LoadOverviewMap(custommap,custommap2);
		GEvent.addListener(map, 'zoomend', function(oldLevel, newLevel) {
			var loadAllPuntosRef=funLoadAllPR;
			var removeAllPuntosRefTemp=remoAllPRT;
			var loadPriorityPuntosRef=funPriorityPR;
			if(newLevel>=17 && newLevel<=18){
				loadAllPuntosRef();
			}
			if(newLevel>=15 && newLevel<=16){
				loadPriorityPuntosRef();
			}
			if(newLevel<15){
				removeAllPuntosRefTemp();
			}
			setTimeout("SetearZoom();",500);
		});
		
		GEvent.addListener(map, 'movestart', function() {
			setTimeout("SetearZoom();",500);
		});
      }
    }
	/*Agrega los eventos*/
	this.AgregarEventosSetPoints=function AgregarEventosSetPoints(){
		if(Padre!='no_parent'){
			GEvent.addListener(map, 'click', function(overlay, point) {
				if(cambiar){
					map.removeOverlay(globalMarker);
					map.panTo(point);
					globalMarker= new GMarker(point);
					map.addOverlay(globalMarker);
					Padre.document.getElementById("Y").value=point.x;
					Padre.document.getElementById("X").value=point.y;
				}
				else{
					cambiar=true;
				}
			});
		}
	}
	/*agrega todos los puntos de referencia*/
	this.CargarPuntosRef=function CargarPuntosRef(combo){
		if(map){
			alert(combo);
			var largo=document.getElementById(combo).length;
			PuntosRef=new Array(largo);
			for(i=0;i<largo;i++){
				var x=document.getElementById(combo).options[i].getAttribute("x");
				var y=document.getElementById(combo).options[i].getAttribute("y");
				var widthIcon=document.getElementById(combo).options[i].getAttribute("widthIcon");
				var heightIcon=document.getElementById(combo).options[i].getAttribute("heightIcon");
				var rutaImg=document.getElementById(combo).options[i].getAttribute("rutaImg");
				var texto=document.getElementById(combo).options[i].text;
				var paginaweb=document.getElementById(combo).options[i].getAttribute("pagWeb");
				var rutaImagen1=document.getElementById(combo).options[i].getAttribute("rutaImagen1");
				var rutaImagen2=document.getElementById(combo).options[i].getAttribute("rutaImagen2");
				var prioridad=document.getElementById(combo).options[i].getAttribute("prioridad");
				var id=i;
				var puntRef=new Punto_ref();
				puntRef.set(x,y,id,texto,rutaImagen1,rutaImagen2,rutaImg,widthIcon,heightIcon,prioridad,'esp',paginaweb);
				PuntosRef[i]=puntRef;
				cantidadPuntosRef++;
			}
		}
		else{
			setTimeout("ObjMap.CargarPuntosRef('CombNovaq')",1000);
		}
	}
	/*carga el mapa con un punto predeterminado*/
    this.LoadEdit=function LoadEdit(x,y,zoom,xpoint,ypoint,contenido,padre,imagen,GetTileurlFunctionHibrid,GetTileurlFunctionNovaq) {	
		this.LoadNew(x,y,zoom,contenido,padre,imagen,GetTileurlFunctionHibrid,GetTileurlFunctionNovaq);	
		setTimeout("ObjMap.AddPoint("+xpoint+","+ypoint+")",1000);
		//this.AddPoint(xpoint,ypoint);
   	}
	/*Agrega un punto al mapa*/
	this.AddPoint=function AddPoint(x,y){
		if(map){
			map.removeOverlay(globalMarker);
			var point = new GPoint(y,x);
			map.setCenter(new GLatLng(x,y), this.Zoom);
			globalMarker= new GMarker(point);
			map.addOverlay(globalMarker);
		}
		else{
			AddPoint(x,y);
		}
	}
	/*Agrega un local al mapa*/
	this.addLocal=function addLocal(Id_local,x,y,Nombre_empresa,Descripcion,Nombre,Direccion,Telefono,Website,rutaImagen1,rutaImagen2,rutaImg,widthIcon,heightIcon,showInfowindow,idioma,paginaweb){
		var ncant=cantidadLocales+1;
		var iLocales=new Array(ncant);
		for(i=0;i<cantidadLocales;i++){
			iLocales[i]=Locales[i];
		}
		var loc=new Local();
		loc.set(x,y,cantidadLocales,Id_local,Nombre_empresa,Descripcion,Nombre,Direccion,Telefono,Website,rutaImagen1,rutaImagen2,rutaImg,widthIcon,heightIcon,idioma,paginaweb);
		loc.createMarker(showInfowindow);
		loc.addOverlay();
		iLocales[cantidadLocales]=loc;
		cantidadLocales++;
		Locales=iLocales;
	}
	/*hacer resize hasta calzar con el zoom*/
	this.resizeZoomLocales=function resizeZoomLocales(){
		var minX=this.getMinX()-0.001;
		var minY=this.getMinY()-0.001;
		var maxX=this.getMaxX()+0.001;
		var maxY=this.getMaxY()+0.001;
		var newZoom=map.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(minX,minY),new GLatLng(maxX,maxY)));	
		if(newZoom<10)
			newZoom=10;
		if(newZoom>=17)
			newZoom=16;
		this.Zoom=newZoom;
		map.setCenter(new GLatLng(minX+(maxX-minX)/2,minY+(maxY-minY)/2), newZoom);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*obtiene el minimo x de los locales*/
	this.getMinX=function getMinX(){
		var min=99999;
		for(i=0;i<cantidadLocales;i++){
			if(min>parseFloat(Locales[i].x))
				min=parseFloat(Locales[i].x);
		}
		return min;
	}
	/*obtiene el minimo y de los locales*/
	this.getMinY=function getMinY(){
		var min=99999;
		for(i=0;i<cantidadLocales;i++){
			if(min>parseFloat(Locales[i].y))
				min=parseFloat(Locales[i].y);
		}
		return min;
	}
	/*obtiene el minimo y de los locales*/
	this.getMaxY=function getMaxY(){
		var max=-99999;
		for(i=0;i<cantidadLocales;i++){
			if(max<parseFloat(Locales[i].y))
				max=parseFloat(Locales[i].y);
		}
		return max;
	}
	/*obtiene el minimo y de los locales*/
	this.getMaxX=function getMaxX(){
		var max=-999999;
		for(i=0;i<cantidadLocales;i++){
			if(max<parseFloat(Locales[i].x))
				max=parseFloat(Locales[i].x);
		}
		return max;
	}
	/*remove locales*/
	this.removeLocales=function removeLocales(){
		for(i=0;i<cantidadLocales;i++){
			Locales[i].removeLocal();
		}
		cantidadLocales=0;
	}
	/*remove PuntosRef*/
	this.removeAllPuntosRefTemp=function removeAllPuntosRefTemp(){
		for(i=0;i<cantidadPuntosRef;i++){
			PuntosRef[i].removePuntoRef();
		}
	}
	/*load all PuntosRef*/
	this.loadAllPuntosRef=function loadAllPuntosRef(){
		for(i=0;i<cantidadPuntosRef;i++){
			PuntosRef[i].removePuntoRef();
			PuntosRef[i].createMarker("infowindow");
			PuntosRef[i].addOverlay();
		}
	}
	/*load priority PuntosRef*/
	this.loadPriorityPuntosRefwithoutWindow=function loadPriorityPuntosRefwithoutWindow(){
		for(i=1;i<cantidadPuntosRef;i++){
			if(PuntosRef[i].prioridad==1 || PuntosRef[i].prioridad==1){
				PuntosRef[i].removePuntoRef();
				PuntosRef[i].createMarker("");
				PuntosRef[i].addOverlay();
			}
			else{
				PuntosRef[i].removePuntoRef();
			}
		}
	}
	/*load priority PuntosRef*/
	this.loadPriorityPuntosRef=function loadPriorityPuntosRef(){
		for(i=1;i<cantidadPuntosRef;i++){
			if(PuntosRef[i].prioridad==1 || PuntosRef[i].prioridad==1){
				PuntosRef[i].removePuntoRef();
				PuntosRef[i].createMarker("infowindow");
				PuntosRef[i].addOverlay();
			}
			else{
				PuntosRef[i].removePuntoRef();
			}
		}
	}
	
	/*centra el mapa con respecto a unas coordenadas de un combo*/
	this.centrarCmb=function centrarCmb(val,combo){
		PuntosRef[val].openInfowindow(17);
	}
	/*centra el mapa con respecto a unas coordenadas de un local*/
	this.centrarLocal=function centrarLocal(val){
		Locales[val].openInfowindow(this.Zoom);
	}
}
/*clase puntoref*/
function Punto_ref(){
	this.x;
	this.y;
	this.point;
	this.id;
	this.text;
	this.rut1;
	this.rut2;
	this.rutaImg;
	this.widthIcon;
	this.heightIcon;
	this.infowindowContent;
	this.infowindowContentBlow;
	this.marcador;
	this.prioridad;
	this.Idioma;
	this.paginaweb;
	this.set=function set(x,y,id,text,rut1,rut2,rutaImg,widthIcon,heightIcon,prioridad,idioma,paginaweb){
		var point = new GPoint(y,x);
		this.x=x;
		this.y=y;
		this.point=point;
		this.id=id;
		this.text=text;
		this.rut1=rut1;
		this.rut2=rut2;
		this.rutaImg=rutaImg;
		this.widthIcon=widthIcon;
		this.heightIcon=heightIcon;
		this.prioridad=prioridad;
		this.Idioma=idioma;
		this.paginaweb=paginaweb;
	}
	
	/*crea un marcador*/
	this.createMarker=function createMarker(showinfo){
	  var icon = new GIcon(this.crearIcono());
	  var marker = new GMarker(this.point, icon);
	  if(showinfo=="infowindow"){
		  var valor=this.setInfoWindowContent();
		  var valor2=this.setInfoWindowContentBlow();
		  GEvent.addListener(marker, "click", function(overlay, point) {
			var val=valor;
			map.openInfoWindowHtml(marker.getPoint(),val,false);
		  });
		  GEvent.addListener(map.getInfoWindow(), "closeclick", function() {
			cambiar=false;
		  });
	  }
	  this.marcador=marker;
	}
	
	this.setInfoWindowContent=function setInfoWindowContent(){
		var valor="<table id=\"imgB1\" cellspacing=\"0\" cellpadding=\"0\">";
		valor+="<tr><td colspan=\"2\" align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.text+"</font></td></tr>";
		valor+="<tr>";
		valor+="<td style=\"padding-right: 5px\">";
		if(this.rut1!=""){
			valor+="<img alt=\"Locales\" width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"PuntosRef["+this.id+"].blowUp();\" src=\""+this.rut1+"\">";
		}
		valor+="</td>";
		valor+="<td>";
		if(this.rut2!=""){
			valor+="<img alt=\"Locales\" width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"PuntosRef["+this.id+"].blowUp();\" src=\""+this.rut2+"\">";
		}
		valor+="</td></tr>";
		if(this.Idioma=="ing"){
			if(this.paginaweb!=""){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\""+this.paginaweb+"\">Click for more information...</a></td></tr>";
			}
			if(this.rut1!="" || this.rut2!=""){
				valor+="<tr><td colspan=\"2\" align=\"right\"><a class=\"link_infowindow2\" href=\"javascript:PuntosRef["+this.id+"].blowUp();\">Click to enlarge</a></td></tr>";
			}
		}
		if(this.Idioma=="esp"){
			if(this.paginaweb!=""){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\""+this.paginaweb+"\">Haz click para m&aacute;s informaci&oacute;n...</a></td></tr>";
			}
			if(this.rut1!="" || this.rut2!=""){
				valor+="<tr><td colspan=\"2\" align=\"right\" ><a class=\"link_infowindow2\" href=\"javascript:PuntosRef["+this.id+"].blowUp();\">Haz click para agrandar</a></td></tr>";
			}
		}
		valor+="</table>";
		this.infowindowContent=valor;
		return valor;
	}
	
	this.setInfoWindowContentBlow=function setInfoWindowContentBlow(){
		var valor="<table id=\"imgB1\" cellspacing=\"0\" cellpadding=\"0\">";
		valor+="<tr><td colspan=\"2\" align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.text+"</font></td></tr>";
		valor+="<tr>";
		valor+="<td style=\"padding-right: 5px\">";
		if(this.rut1!=""){
			valor+="<img alt=\"Locales\" width=\"210px\" style=\"cursor:pointer;\" height=\"210px\" onclick=\"PuntosRef["+this.id+"].blowDown();\" src=\""+this.rut1+"\">";
		}
		valor+="</td>";
		valor+="<td>";
		if(this.rut2!=""){
			valor+="<img alt=\"Locales\" width=\"210px\" style=\"cursor:pointer;\" height=\"210px\" onclick=\"PuntosRef["+this.id+"].blowDown();\" src=\""+this.rut2+"\">";
		}
		valor+="</td></tr>";
		if(this.Idioma=="ing"){
			if(this.paginaweb!=""){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\""+this.paginaweb+"\">Click for more information...</a></td></tr>";
			}
			if(this.rut1!="" || this.rut2!=""){
				valor+="<tr><td colspan=\"2\" align=\"right\"><a class=\"link_infowindow2\" href=\"javascript:PuntosRef["+this.id+"].blowDown();\">Click to reduce</a></td></tr>";
			}
		}
		if(this.Idioma=="esp"){
			if(this.paginaweb!=""){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\""+this.paginaweb+"\">Haz click para m&aacute;s informaci&oacute;n...</a></td></tr>";
			}
			if(this.rut1!="" || this.rut2!=""){
				valor+="<tr><td colspan=\"2\" align=\"right\"><a class=\"link_infowindow2\" href=\"javascript:PuntosRef["+this.id+"].blowDown();\">Haz click para reducir</a></td></tr>";
			}
		}
		valor+="</table>";
		this.infowindowContentBlow=valor;
		return valor;
	}
	/*Abre el infowindow normal*/
	this.openInfowindow=function openInfowindow(zoom){
		map.setCenter(new GLatLng(this.x,this.y), zoom);
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContent);
	}
	/*Abre el infowindow grande*/
	this.blowUp=function blowUp(){
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContentBlow,false);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*Abre el infowindow normal*/
	this.blowDown=function blowDown(){
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContent,false);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*Agrega el marker al mapa*/
	this.addOverlay=function addOverlay(){
		map.addOverlay(this.marcador);
	}
	/*remove punto ref*/
	this.removePuntoRef=function removePuntoRef(){
		map.removeOverlay(this.marcador);
	}
	/*Crea un icono*/
	this.crearIcono=function crearIcono(){
		var baseIcon = new GIcon();
		baseIcon.image = this.rutaImg;
		baseIcon.iconSize = new GSize(this.widthIcon, this.heightIcon);
		baseIcon.iconAnchor = new GPoint(9, 20);
		return baseIcon;
	}
}



/*clase local*/
function Local(){
	this.x;
	this.y;
		
	this.point;
	this.Id_local;
	this.Nombre_empresa;
	this.Descripcion;
	this.Nombre;
	this.Direccion;
	this.Telefono;
	this.Website;
	this.rutaImagen1;
	this.rutaImagen2;
	this.rutaImg;
	this.widthIcon;
	this.heightIcon;
	this.marcador;
	this.infowindowContent;
	this.infowindowContentBlow;
	this.Idioma;
	this.id;
	this.paginaweb;//si es igual a 1 es que no quiere paginaweb
	this.set=function set(x,y,idC,Id_local,Nombre_empresa,Descripcion,Nombre,Direccion,Telefono,Website,rutaImagen1,rutaImagen2,rutaImg,widthIcon,heightIcon,idioma,paginaweb){
		var point = new GPoint(y,x);
		this.x=x;
		this.y=y;
		this.id=idC;
		this.point=point;
		this.Id_local=Id_local;
		this.Nombre_empresa=Nombre_empresa;
		this.Descripcion=Descripcion;
		this.Nombre=Nombre;
		this.Direccion=Direccion;
		this.Telefono=Telefono;
		this.Website=Website;
		this.rutaImagen1=rutaImagen1;
		this.rutaImagen2=rutaImagen2;
		this.rutaImg=rutaImg;
		this.widthIcon=widthIcon;
		this.heightIcon=heightIcon;
		this.Idioma=idioma;
		this.paginaweb=paginaweb;
	}
	/*remove a local*/
	this.removeLocal=function removeLocal(){
		map.removeOverlay(this.marcador);
	}
	/*crea un marcador*/
	this.createMarker=function createMarker(showinfo){
	  var icon = new GIcon(this.crearIcono());
	  var marker = new GMarker(this.point, icon);
	  if(showinfo=="infowindow"){
		  var valor=this.setInfoWindowContent();
		  var valor2=this.setInfoWindowContentBlow();
		  GEvent.addListener(marker, "click", function(overlay, point) {
			var val=valor;
			map.openInfoWindowHtml(marker.getPoint(),val,false);
		  });
		  GEvent.addListener(map.getInfoWindow(), "closeclick", function() {
			cambiar=false;
		  });
	  }
	  this.marcador=marker;
	}
	/*setea el contenido del infowindow*/
	this.setInfoWindowContent=function setInfoWindowContent(){
		if(this.paginaweb==1){
			var valor="<table width=\"220px\" cellspacing=\"0\" cellpadding=\"0\">";
			valor+="<tr>";
				valor+="<td colspan=\"2\"  align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.Nombre+"</font></td>";
			valor+="</tr>";
			valor+="<tr>";
				valor+="<td colspan=\"2\"  id=\"txDescripcion\" style=\"padding-right: 5px; width:220px\">";
					valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Descripcion:&nbsp;</strong>"+this.Descripcion.substr(0,70)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowUp();\">...</a></font>";
				valor+="</td>";
			valor+="</tr>";
			valor+="<tr>";
				valor+="<td colspan=\"2\"  id=\"txDireccion\" style=\"padding-right: 5px; width:220px\">";
					valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Direccion:&nbsp;</strong>"+this.Direccion.substr(0,70)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowUp();\">...</a></font>";
				valor+="</td>";
			valor+="</tr>";
			valor+="<tr>";
			if(this.rutaImagen2!=""){
				if(this.rutaImagen1!=""){
					valor+="<td align=\"center\" style=\"padding-right: 5px;\">";
					valor+="<img width=\"40px\" height=\"40px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"40px\" height=\"40px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
			}
			if(this.rutaImagen1!=""){
				if(this.rutaImagen2!=""){
					valor+="<td align=\"center\">";
					valor+="<img width=\"40px\" height=\"40px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"40px\" height=\"40px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
			}
			
			valor+="</tr>";
			valor+="</table>";
			this.infowindowContent=valor;
			return valor;
		}
		else{
			var valor="<table width=\"220px\" cellspacing=\"0\" cellpadding=\"0\">";
			valor+="<tr>";
				valor+="<td colspan=\"2\" align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.Nombre+"</font></td>";
			valor+="</tr>";
			//valor+="<tr>";
				//valor+="<td colspan=\"2\" id=\"txDireccion\" style=\"padding-right: 5px; width:220px\">";
					//valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Direccion:&nbsp;</strong>"+this.Direccion.substr(0,70)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowUp();\">...</a>"+"</font>";
				//valor+="</td>";
			//valor+="</tr>";
			valor+="<tr>";
			if(this.rutaImagen2!=""){
				if(this.rutaImagen1!=""){
					valor+="<td align=\"center\" style=\"padding-right: 5px;\">";
					valor+="<img width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
			}
			if(this.rutaImagen1!=""){
				if(this.rutaImagen2!=""){
					valor+="<td align=\"center\">";
					valor+="<img width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"110px\" height=\"110px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowUp();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
			}
			
			valor+="</tr>";
			if(this.Idioma=="ing"){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\"../../Novaq/Novaq/infopage.php?id="+this.Id_local+"&idioma="+this.Idioma+"\">Click&nbsp;for&nbsp;more&nbsp;information...</a></td></tr>";
			}
			else{
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\"../../Novaq/Novaq/infopage.php?id="+this.Id_local+"&idioma="+this.Idioma+"\">Haz&nbsp;click&nbsp;para&nbsp;m&aacute;s&nbsp;informaci&oacute;n...</a></td></tr>";
			}
			valor+="</table>";
			this.infowindowContent=valor;
			return valor;
		}
	}
	
	this.setInfoWindowContentBlow=function setInfoWindowContentBlow(){
		if(this.paginaweb==1){
			var valor="<table width=\"220px\" cellspacing=\"0\" cellpadding=\"0\">";
			valor+="<tr>";
				valor+="<td colspan=\"2\" align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.Nombre+"</font></td>";
			valor+="</tr>";
			valor+="<tr>";
				valor+="<td colspan=\"2\" id=\"txDescripcion\" style=\"padding-right: 5px;width:360px\">";
					valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Descripcion:&nbsp;</strong>"+this.Descripcion.substr(0,190)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowDown();\">...</a>"+"</font>";
				valor+="</td>";
			valor+="</tr>";
			valor+="<tr>";
				valor+="<td colspan=\"2\" id=\"txDireccion\" style=\"padding-right: 5px;width:360px\">";
					valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Direccion:&nbsp;</strong>"+this.Direccion.substr(0,190)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowDown();\">...</a>"+"</font>";
				valor+="</td>";
			valor+="</tr>";
			valor+="<tr>";
			if(this.rutaImagen2!=""){
				if(this.rutaImagen1!=""){
					valor+="<td align=\"center\" style=\"padding-right: 5px;padding-left: 5px;\">";
					valor+="<img width=\"100px\" height=\"100px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"100px\" height=\"100px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
			}
			if(this.rutaImagen1!=""){
				if(this.rutaImagen2!=""){
					valor+="<td align=\"center\">";
					valor+="<img width=\"100px\" height=\"100px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"100px\" height=\"100px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
			}
			
			valor+="</tr>";
			valor+="</table>";
			this.infowindowContentBlow=valor;
			return valor;
		}
		else{
			var valor="<table width=\"360px\" cellspacing=\"0\" cellpadding=\"0\">";
			valor+="<tr>";
				valor+="<td colspan=\"2\" align=\"center\"><font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;font-weight: bold;\">"+this.Nombre+"</font></td>";
			valor+="</tr>";
			//valor+="<tr>";
				//valor+="<td colspan=\"2\" id=\"txDireccion\" style=\"padding-right: 5px; width:360px\">";
					//valor+="<font style=\" font-family: Tahoma, sans-serif;font-size: 12px;font-style: normal;color: #333333;text-decoration: none;\"><strong>Direccion:&nbsp;</strong>"+this.Direccion.substr(0,190)+"<a class=\"link_infowindow2\" href=\"javascript:Locales["+this.id+"].blowDown();\">...</a>"+"</font>";
				//valor+="</td>";
			//valor+="</tr>";
			valor+="<tr>";
			if(this.rutaImagen2!=""){
				if(this.rutaImagen1!=""){
					valor+="<td align=\"center\" style=\"padding-right: 5px;padding-left: 5px;\">";
					valor+="<img width=\"180px\" height=\"180px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"180px\" height=\"180px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen2+"\">";
					valor+="</td>";
				}
			}
			if(this.rutaImagen1!=""){
				if(this.rutaImagen2!=""){
					valor+="<td align=\"center\">";
					valor+="<img width=\"180px\" height=\"180px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
				else{
					valor+="<td colspan=\"2\" align=\"center\">";
					valor+="<img width=\"180px\" height=\"180px\" style=\"cursor:pointer;\" onclick=\"Locales["+this.id+"].blowDown();\" src=\""+this.rutaImagen1+"\">";
					valor+="</td>";
				}
			}
			
			valor+="</tr>";
			if(this.Idioma=="ing"){
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\"../../Novaq/Novaq/infopage.php?id="+this.Id_local+"&idioma="+this.Idioma+"\">Click&nbsp;for&nbsp;more&nbsp;information...</a></td></tr>";
			}
			else{
				valor+="<tr><td colspan=\"2\" align=\"center\"><a class=\"link_infowindow\" target=\"_blank\" href=\"../../Novaq/Novaq/infopage.php?id="+this.Id_local+"&idioma="+this.Idioma+"\">Haz&nbsp;click&nbsp;para&nbsp;m&aacute;s&nbsp;informaci&oacute;n...</a></td></tr>";
			}
			valor+="</table>";
			
			this.infowindowContentBlow=valor;
			return valor;
		}
	}
	
	this.openInfowindow=function openInfowindow(zoom){
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContent,false);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*Abre el infowindow grande*/
	this.blowUp=function blowUp(){
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContentBlow,false);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*Abre el infowindow normal*/
	this.blowDown=function blowDown(){
		map.openInfoWindowHtml(this.marcador.getPoint(),this.infowindowContent,false);
		if(conOvermap==1){
			setTimeout("SetearZoom();",500);
		}
	}
	/*Agrega el marker al mapa*/
	this.addOverlay=function addOverlay(){
		map.addOverlay(this.marcador);
	}
	
	/*Crea un icono*/
	this.crearIcono=function crearIcono(){
		var baseIcon = new GIcon();
		baseIcon.image = this.rutaImg;
		baseIcon.iconSize = new GSize(this.widthIcon, this.heightIcon);
		baseIcon.iconAnchor = new GPoint(9, 20);
		return baseIcon;
	}
}
