function getMarkers(n) { var batch = []; for (var i = 0; i < n; ++i) { if (varpoint.length<=i) break; varp = varpoint[i].split("|"); vicon=eval(varp[2]); vnomb=varp[3]; vhtml=varp[4]; vid=0;vft='';vno='';vta="";vt1="";vt2="";vt3="";vlg='';vlk=''; varp2 = vhtml.split("¿?"); if (varp2[0]) {vid=varp2[0];} if (varp2[1]) {vft=varp2[1];} if (varp2[2]) {vno=varp2[2];} if (varp2[3]) {vdes="<b>Descrip.:</b> "+varp2[3]+"<br>";} if (varp2[4]) {vt1="<b>Tel:</b> "+varp2[4]+"<br>";} if (varp2[5]) {vt2="<b>Tel:</b> "+varp2[5]+"<br>";} if (varp2[6]) {vt3="<b>Tel:</b> "+varp2[6]+"<br>";} if (varp2[7]) {vlg=varp2[7];} if (varp2[8]) {vlk=varp2[8];} vlk=vlk.replace(/%%%/g, "\""); if (varp2[9]) {vlkf=varp2[9];} if (varp2[10]) {vtdes=varp2[10];} if (varp2[11]) {vthas=varp2[11];} if (varp2[12]) {vttip=varp2[12];} if (varp2[13]) {vtalc=varp2[13];} if (varp2[14]) {vtmin=varp2[14];} if (varp2[15]) {vtmax=varp2[15];} if (varp2[16]) {vtwid=varp2[16];} if (varp2[17]) {vtlef=varp2[17];} if (varp2[18]) {vtfle=varp2[18];} vlink2=varp2[19]; vlinkfot=varp2[20]; vhtmltar=""; if (varp2[10]>0 && varp2[10]>0) {vhtmltar="<div style='position:relative;text-align:left;top:15px;' class='let2'>"+vttip+" "+vtmin+"</div><div style='position:relative;text-align:right;' class='let2'>"+vttip+" "+vtmax+"</div><div class='outer'><div style='position:relative;width: "+vtwid+";left:"+vtlef+"' class='inner' id='inner1'></div></div><div style='position:relative;left:"+vtfle+";top:0;background-image:url(../comunes/flecha.png);background-repeat: no-repeat;width:13;height:14;'></div><div style='position:relative;' class='let1'><center>"+vttip+" "+vtdes+" ~ "+vttip+" "+vthas+"</center></div><div style='position:relative;' class='let2'><center>"+vtalc+"</center></div>";} vhtmlnew="<table border=0 bgcolor='#006699'><tr><td></td><td width='20' nowrap><div class='clavitit' id='e"+vid+"' onclick=\"marcoanu("+vid+",'"+vlinkfot+"','"+vlink2+"','"+vno+"');\"></div></td><td><span class='clavitit' onclick=\"marcoanu("+vid+",'"+vlinkfot+"','"+vlink2+"','"+vno+"');\"><a name='"+vno+"'> "+vid+" <font color='#990000'>|</font> "+vno+"</span></td></tr><tr><td width='144' valign='top' height='150' nowrap rowspan='2'><div style='width:128px'><div style='text-align:center;'>"+vlkf+"<img class='fot' src='"+vft+"' id='avi"+vid+"'></a></div>"+vhtmltar+"</div></td><td rowspan='2'></td><td width='100%' height='160px' valign='top' align='left'><p class='clavitex'>"+vdes+vt1+vt2+vt3+"<b>Ubic: </b>"+vlg+"</p></td></tr><tr><td width='100%' valign='top' align='left'><p class='clletlink'><img border='0' src='../comunes/gmapas/vw_luzpre.png'> "+vlk+"</p></td></tr></table>"; var spotmrkr = createMarker(new GLatLng(varp[0],varp[1]),vnomb,vicon,vhtmlnew,vid); batch.push(spotmrkr); } return batch; } function createMarker(posn, title, icon, vhtml,vid) { var marker = new GMarker(posn, {title: title, icon: icon}); GEvent.addListener(marker, 'click', function() { marker.openExtInfoWindow(map,"custom_info_window",vhtml,{beakOffset: 16}); veo_sel(vid); } ); return marker; } function abro_punto() { 	varp = varpoint[0].split("|"); 	vicon=eval(varp[2]); 	vnomb=varp[3]; 	vhtml=varp[4]; 	vid=0;vft='';vno='';vta="";vt1="";vt2="";vt3="";vlg='';vlk=''; 	varp2 = vhtml.split("¿?"); if (varp2[0]) {vid=varp2[0];} if (varp2[1]) {vft=varp2[1];} if (varp2[2]) {vno=varp2[2];} if (varp2[3]) {vdes="<b>Descrip.:</b> "+varp2[3]+"<br>";} if (varp2[4]) {vt1="<b>Tel:</b> "+varp2[4]+"<br>";} if (varp2[5]) {vt2="<b>Tel:</b> "+varp2[5]+"<br>";} if (varp2[6]) {vt3="<b>Tel:</b> "+varp2[6]+"<br>";} if (varp2[7]) {vlg=varp2[7];} if (varp2[8]) {vlk=varp2[8];} vlk=vlk.replace(/%%%/g, "\""); if (varp2[9]) {vlkf=varp2[9];} if (varp2[10]) {vtdes=varp2[10];} if (varp2[11]) {vthas=varp2[11];} if (varp2[12]) {vttip=varp2[12];} if (varp2[13]) {vtalc=varp2[13];} if (varp2[14]) {vtmin=varp2[14];} if (varp2[15]) {vtmax=varp2[15];} if (varp2[16]) {vtwid=varp2[16];} if (varp2[17]) {vtlef=varp2[17];} if (varp2[18]) {vtfle=varp2[18];} vlink2=varp2[19]; vlinkfot=varp2[20]; vhtmltar=""; if (varp2[10]>0 && varp2[10]>0) {vhtmltar="<div style='position:relative;text-align:left;top:15px;' class='let2'>"+vttip+" "+vtmin+"</div><div style='position:relative;text-align:right;' class='let2'>"+vttip+" "+vtmax+"</div><div class='outer'><div style='position:relative;width: "+vtwid+";left:"+vtlef+"' class='inner' id='inner1'></div></div><div style='position:relative;left:"+vtfle+";top:0;background-image:url(../comunes/flecha.png);background-repeat: no-repeat;width:13;height:14;'></div><div style='position:relative;' class='let1'><center>"+vttip+" "+vtdes+" ~ "+vttip+" "+vthas+"</center></div><div style='position:relative;' class='let2'><center>"+vtalc+"</center></div>";} vhtmlnew="<table border=0 bgcolor='#006699'><tr><td></td><td width='20' nowrap><div class='clavitit' id='e"+vid+"' onclick=\"marcoanu("+vid+",'"+vlinkfot+"','"+vlink2+"','"+vno+"');\"></div></td><td><span class='clavitit' onclick=\"marcoanu("+vid+",'"+vlinkfot+"','"+vlink2+"','"+vno+"');\"><a name='"+vno+"'> "+vid+" <font color='#990000'>|</font> "+vno+"</span></td></tr><tr><td width='144' valign='top' height='150' nowrap rowspan='2'><div style='width:128px'><div style='text-align:center;'>"+vlkf+"<img class='fot' src='"+vft+"' id='avi"+vid+"'></a></div>"+vhtmltar+"</div></td><td rowspan='2'></td><td width='100%' height='160px' valign='top' align='left'><p class='clavitex'>"+vdes+vt1+vt2+vt3+"<b>Ubic: </b>"+vlg+"</p></td></tr><tr><td width='100%' valign='top' align='left'><p class='clletlink'><img border='0' src='../comunes/gmapas/vw_luzpre.png'> "+vlk+"</p></td></tr></table>"; 	markerOptions = { icon:vicon }; 	var vmarker = new GMarker(new GLatLng(varp[0],varp[1]), markerOptions); 	map.addOverlay(vmarker); 	GEvent.addListener(vmarker, 'click', function() { 	 vmarker.openExtInfoWindow(map,"custom_info_window",vhtmlnew,{beakOffset: 16}); 	 veo_sel(vid); 	} ); 	GEvent.trigger(vmarker, "click"); } 			 function veo_sel(id) { try { var varsele; varsele=readCookie('seleccion'); varimg = "url(../comunes/gmapas/vw_estvac.png) no-repeat"; if (varsele=="" || varsele==null) { } else { varmat=varsele.split(","); for (valor=0;valor<varmat.length;valor++){ if (varmat[valor]==id) {varimg = "url(../comunes/gmapas/vw_est.png) no-repeat";} } } document.getElementById('e'+id).style.background = varimg; } catch(err) { setTimeout('veo_sel('+id+');',250); } } function muevo_peri(cliy) { vtopeini=2;vtopefin=11; vtope = cliy-parseInt(dregla.style.top)-14; if (vtope<vtopeini) vtope=vtopeini; if (vtope>parseInt(dregla.style.height)-vtopefin) vtope=parseInt(dregla.style.height)-vtopefin; vpor=parseInt(parseInt(vtope-vtopeini)*100/(parseInt(dregla.style.height)-vtopefin-vtopeini)); vpor=parseInt(Math.abs((vpor/100)-1)*100); vzoom=Math.round(vpor/10)*10; if (vzoom<=4) map.setCenter(new GLatLng(-40,-60),4); return vtope; } function actua_peri() { vzoom= parseInt((map.getZoom()-4) * 100 / 13); if (vzoom<0) vzoom=0; if (vzoom>100) vzoom=100; vtopeini=9;vtopefin=58; vpor=parseInt(Math.abs((vzoom/100)-1)*100); if (vzoom==0) vpor=100; vtope = parseInt(parseInt(vtopefin-vtopeini) * vpor / 100)+2; peri.style.top = vtope; } function mover(dir) { if (dir=='cn') {map.setCenter(new GLatLng(vlatini,vlngini),vzoomini);vlat=vlatini;vlng=vlngini;} if (dir=='d') {map.panBy(new GSize(-300,0));} if (dir=='i') {map.panBy(new GSize(300,0));} if (dir=='a') {map.panBy(new GSize(0,300));} if (dir=='b') {map.panBy(new GSize(0,-300));} actua_peri(); } function cambiopc(tipo,tipoant) { if (tipo!=tipoant) { opciontipo=tipo; document.getElementById('opcmapas').style.display='none'; document.getElementById('opcbuscar').style.display='none'; document.getElementById('opcfavor').style.display='none'; document.getElementById('opcregla').style.display='none'; document.getElementById('botmap').style.background='url(../comunes/gmapas/vw_omap.png)'; document.getElementById('botbus').style.background='url(../comunes/gmapas/vw_obus.png)'; document.getElementById('botest').style.background='url(../comunes/gmapas/vw_oest.png)'; document.getElementById('botreg').style.background='url(../comunes/gmapas/vw_oreg.png)'; if (tipo=='opcbuscar') {document.getElementById('opcbuscar').style.display='inline';document.getElementById('botbus').style.background='url(../comunes/gmapas/vw_sobus.png)';esc_capa('titopc',null,"BUSCADOR");} if (tipo=='opcmapas') {document.getElementById('opcmapas').style.display='inline';document.getElementById('botmap').style.background='url(../comunes/gmapas/vw_somap.png)';esc_capa('titopc',null,"SELECTOR DE MAPAS");} if (tipo=='opcfavor') {document.getElementById('opcfavor').style.display='inline';document.getElementById('botest').style.background='url(../comunes/gmapas/vw_soest.png)';esc_capa('titopc',null,"OPCIONES DE SELECCIÓN");} if (tipo=='opcregla') {document.getElementById('opcregla').style.display='inline';document.getElementById('botreg').style.background='url(../comunes/gmapas/vw_soreg.png)';esc_capa('titopc',null,"MEDIDOR DE DISTANCIAS");} } } var ns4 = (document.layers)? true:false; var ie4 = (document.all)? true:false; var IsN6_or_7=(navigator.userAgent.indexOf("Gecko")!=-1); function esc_capa(id,nestref,text) { if (ns4) { var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document; lyr.open(); lyr.write(text); lyr.close(); } if (ie4) document.all[id].innerHTML = text; if (IsN6_or_7) { document.getElementById(id).innerHTML=text; } } function ll(num) { num = parseFloat(num); vh = parseInt(num); vresto = ((num - parseInt(num))*60); vresto = Math.round(vresto*1000)/1000; if (parseInt(vresto)<10) vresto = "0"+vresto; if (parseInt(vresto)==parseFloat(vresto)) vresto=vresto+'.'; vresto=vresto+'000'; vresto=vresto.substring(0,6); vm = vresto; return vh+'° '+vm; } function Rectangle(bounds, opt_weight, opt_color) { this.bounds_ = bounds; this.weight_ = opt_weight || 1; this.color_ = opt_color || "#000000"; } Rectangle.prototype = new GOverlay(); Rectangle.prototype.initialize = function(map) { var div = document.createElement("div"); div.style.border = this.weight_ + "px dashed " + this.color_; div.style.position = "absolute"; map.getPane(G_MAP_MAP_PANE).appendChild(div); this.map_ = map; this.div_ = div; }; Rectangle.prototype.remove = function() { this.div_.parentNode.removeChild(this.div_); }; Rectangle.prototype.copy = function() { return new Rectangle(this.bounds_, this.weight_, this.color_, this.backgroundColor_, this.opacity_); }; Rectangle.prototype.redraw = function(force) { if (!force) return; var c1 = this.map_.fromLatLngToDivPixel(this.bounds_.getSouthWest()); var c2 = this.map_.fromLatLngToDivPixel(this.bounds_.getNorthEast()); this.div_.style.width = Math.abs(c2.x - c1.x) + "px"; this.div_.style.height = Math.abs(c2.y - c1.y) + "px"; this.div_.style.left = (Math.min(c2.x, c1.x) - this.weight_) + "px"; this.div_.style.top = (Math.min(c2.y, c1.y) - this.weight_) + "px"; }; function cargo_combo_mapas(clave){ removeOpt(); tsitio=""; for (var i = 0; i < vasitio.length; ++i) { if (vasitio[i]==clave || clave=='viaweb'){ if (tsitio!=vasitio[i]) { addOptGroup(vaslgn[i],vanom[i],vaclave[i]); tsitio=vasitio[i]; } else { addOptionToOptGroup(vanom[i],vaclave[i]); } } } addOptGroup("","",""); } function sel_combo() { var rselect = document.getElementById( "m" ); for (i=0;i<rselect.length;++i){ if (rselect.options[i].value==vmapa) vselected=i; } rselect.options[vselected].selected=true; } function addOptGroup(vgrupo,vtexto,vvalor) { var rselect = document.getElementById( "m" ); var optgroup = document.createElement( "optgroup" ); optgroup.label = vgrupo; rselect.appendChild( optgroup ); deletedOptions.push(optgroup); var option = new Option(); option.value = vvalor; option.appendChild( document.createTextNode( vtexto )); optgroup.appendChild( option ); return false; } function addOptionToOptGroup(vtexto,vvalor) { var rselect = document.getElementById( "m" ); var optgroup = rselect.lastChild; var option = new Option(); option.value = vvalor; option.appendChild( document.createTextNode( vtexto )); optgroup.appendChild( option ); rselect.selectedIndex = rselect.options.length - 1; return false; } function removeOpt() { var rselect = document.getElementById( "m" ); for (i=0;i<deletedOptions.length;++i){ var optgroup = deletedOptions[i].parentNode; optgroup.removeChild(deletedOptions[i]); } while (deletedOptions.length>0) deletedOptions.pop(); } function marcoanu(aviso,imagen,link,nombre,forza) {	var pic = document.getElementById("avi"+aviso);	vheight =pic.offsetHeight; var vest; var vposest=0;	var varsele; var varcantsel=0; varseleant=readCookie('seleccion'); varsele=""; if (varseleant) {varmat=varseleant.split(","); vcoma="";	for (valor=0;valor<varmat.length;valor++){if (varmat[valor]!=aviso) {varsele+=vcoma+varmat[valor];vcoma=",";}}}	vcoma=""; vest=document.getElementById('e'+aviso).style.background;	if (vest) vposest=vest.indexOf("vw_estvac.png"); vfoto = 'a'+aviso;	vcont = imagen+'|||'+link+'|||'+nombre+'|||'+vheight; if (vposest == -1 && !forza) {document.getElementById('e'+aviso).style.background = "url(../comunes/gmapas/vw_estvac.png) no-repeat";	createCookie(vfoto,'',-1);} else { document.getElementById('e'+aviso).style.background="url(../comunes/gmapas/vw_est.png) no-repeat"; if (varsele) vcoma=","; varsele+=vcoma+aviso; createCookie(vfoto,vcont);}	createCookie('seleccion',varsele);} function veo_cantsel() { varsele=readCookie('seleccion'); if (varsele) { varmat=varsele.split(","); varcanti=varmat.length; if (varmat.length==1) {vartexto=" Aviso Seleccionado"; } else {vartexto=" Avisos Seleccionados";} } else { varcanti=0; vartexto=" Avisos Seleccionados"; } esc_capa('spanvarmat',null,varcanti+" "+vartexto); } function replace(texto,s1,s2){ return texto.split(s1).join(s2); } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i<ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } function createCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; var ck = name+"="+value+expires+"; path=/"; document.cookie = ck; } function regla(valor) { if (valor==1) { map.getDragObject().setDraggableCursor("crosshair"); varregla = 1; } else { map.getDragObject().setDraggableCursor("auto"); varregla = 0; } } function borrar_puntos() { for (var i = vpuntero-1; i >= 0; --i) { map.removeOverlay(vlin[i]); map.removeOverlay(vpin[i]); vlin.pop(); vdist.pop(); vgeol.pop(); vpoin.pop(); vpin.pop(); } for (var i = 0; i < vlin.length; ++i) { vlin.pop(); } for (var i = 0; i < vdist.length; ++i) { vdist.pop(); } for (var i = 0; i < vgeol.length; ++i) { vgeol.pop(); } for (var i = 0; i < vpoin.length; ++i) { vpoin.pop(); } for (var i = 0; i < vpin.length; ++i) { vpin.pop(); } formu.valregla.value=""; vpuntero=0; } function borro_punto() { map.removeOverlay(vlin[vpuntero-1]); map.removeOverlay(vpin[vpuntero-1]); vlin.pop(); vdist.pop(); vgeol.pop(); vpoin.pop(); vpin.pop(); vpuntero-=1; cargofregla(); } function addpoint( point ) { var pntar = [] ; if (vpoin[vpuntero-1]) { pntar.push(vpoin[vpuntero-1]); pntar.push(point); vlin.push(new GPolyline(pntar,"#990000", 3, .6)); dist=vpoin[vpuntero-1].distanceFrom(point); vdist.push(dist/1000); } else { formu.valregla.value=""; vlin.push(""); vdist.push(0); } var marker = new GMarker(point, {title: vpin.length+1,draggable: true, icon:icpin,bounceGravity: 0.5,clickable: false}); map.addOverlay(marker); GEvent.addListener(marker, "dragstart", function() { vpuntemp = marker.getTitle(); map.removeOverlay(vlin[vpuntemp-1]); map.removeOverlay(vlin[vpuntemp]); }); GEvent.addListener(marker, "dragend", function() { var pntar = []; if (vlin[vpuntemp-1]) { pntar.push(vlin[vpuntemp-1].getVertex(0)); pntar.push(marker.getLatLng()); ply=(new GPolyline(pntar,"#990000", 3, .6)); vlin.splice(vpuntemp-1,1,ply); map.addOverlay(vlin[vpuntemp-1]); } if (vlin[vpuntemp]) { pntar.pop();pntar.pop(); pntar.push(marker.getLatLng()); pntar.push(vlin[vpuntemp].getVertex(1)); ply=(new GPolyline(pntar,"#990000", 3, .6)); vlin.splice(vpuntemp,1,ply); map.addOverlay(vlin[vpuntemp]); } vpoin.splice(vpuntemp-1,1,marker.getLatLng()); geocoder.getLocations(marker.getLatLng(), showAddress2); actualizodistdesde(vpuntemp-1); }); GEvent.addListener(marker, "drag", function(point){ }); vpin.push(marker); vgeol.push("?"); if (vlin[vpuntero]) map.addOverlay(vlin[vpuntero]); geocoder.getLocations(point, showAddress); vpoin.push(point); vpuntero+=1; } function actualizodistdesde(vlugar) { if (vlugar==0) vlugar=1; for (var i = vlugar; i < vdist.length; ++i) { dist=vpoin[i].distanceFrom(vpoin[i-1]); vdist.splice(i,1,dist/1000); } } function showAddress(response) { if (!response || response.Status.code != 200) { vlugar="?"; } else { place = response.Placemark[0]; vprov=""; vciud=""; if (place.AddressDetails.Country.AdministrativeArea) vprov= place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName; vlugar=vprov; } vgeol[vpuntero-1]=vlugar; cargofregla(); } function showAddress2(response) { if (!response || response.Status.code != 200) { vlugar="?"; } else { place = response.Placemark[0]; vprov=""; vciud=""; if (place.AddressDetails.Country.AdministrativeArea) vprov= place.AddressDetails.Country.AdministrativeArea.AdministrativeAreaName; vlugar=vprov; } vgeol[vpuntemp-1]=vlugar; cargofregla(); } function cargofregla() { formu.valregla.value = ""; vdistanciatot=0; for (var i = 0; i < vlin.length; ++i) { vdistanciatot+=vdist[i]; formu.valregla.value = formu.valregla.value + vdistanciatot.toFixed(1)+" km - "+vgeol[i] + " \\n"; } formu.valregla.scrollTop = formu.valregla.scrollHeight ; } function comando(que) { var varsele; varsele=readCookie('seleccion'); formu.selec.selectedIndex=0; if (varsele=="" || varsele==null) { alert("Tiene que seleccionar al menos un Establecimiento");} else { if (que==1) { window.open('../buscar/index.php?t='+varsele, 'blank'); } else if (que==2) { window.location="../imapas/index.php?ob=rel&t="+varsele; } } } function desmarcar() { varsele=readCookie('seleccion'); if (varsele!="" && varsele!=null) { if (confirm('¿ Desea Desmarcar los Establecimientos Seleccionados ?')) { createCookie('seleccion',""); veo_cantsel(); } } else { alert("No hay Establecimientos Seleccionados"); } } function key(k) 	{ 		if(isie) {vcodigo=event.keyCode;} 		if(isnn) {vcodigo=k.keyCode;} 		if (vcodigo==123) { var myHtml = "<form onSubmit='sav();' action='../comunes/php/formviaweb.php' method=post name='formenvio'><table><tr><td colspan=2><b>Envío de Posición Geográfica</b></td></tr><tr><td colspan=2><span style='cursor:pointer;' onclick='map.setMapType(G_SATELLITE_MAP);'><u>«Vista Satélite»</u></span> <span style='cursor:pointer;' onclick='map.setMapType(G_NORMAL_MAP);'><u>«Vista Normal»</u></span></td></tr><tr><td colspan=2>"+ vlatlong.lat() + ", " + vlatlong.lng()+"<br><br></td></tr><tr><td>Establecimiento:</td><td><input type='text' name='realname' size='23' tabindex='1'></td></tr><tr><td>Email:</td><td><input type='text' name='email' size='23' tabindex='2'></td></tr><tr><td>Teléfono:</td><td><input type='text' name='telefono' size='23' tabindex='3'></td></tr><tr><td><input type=hidden name='consulta' value='"+vlatlong.lat() + ", " + vlatlong.lng()+"'></td><td><input type='submit' value='Enviar Ubicación' name='enviar' tabindex='5'><input type=hidden type='text' name='formulario' size='20' value='Envio de Posición Geográfica'><input type=hidden name='recipient' value='0'><input type=hidden name='check' value='HEA'><input type=hidden name='subject' value='ViaWeb: Envio de Posición Geográfica'></td></tr></table></form>"; map.openInfoWindow(new GLatLng(vlatlong.lat(),vlatlong.lng()), myHtml); } 	}
