function limpiar(texto) { texto = replace(texto,'.',''); texto = replace(texto,':',''); texto = replace(texto,';',''); texto = replace(texto,')',''); texto = replace(texto,'(',''); texto = replace(texto,'á','a'); texto = replace(texto,'é','e'); texto = replace(texto,'í','i'); texto = replace(texto,'ó','o'); texto = replace(texto,'ú','u'); texto = replace(texto,'ñ','n'); texto = replace(texto,' ','-'); texto = replace(texto,',',''); texto = replace(texto,'c/','calle'); texto = replace(texto,'C/','Calle'); texto = replace(texto,'/',''); return texto; } function replace(texto,s1,s2){ return texto.split(s1).join(s2); } function enviarform(){ origen=limpiar(document.buscar.de.value); destino=limpiar(document.buscar.a.value); location.href='de-'+origen+'-a-'+destino+'.htm'; return false; } function iniciarmapa(origen,destino,existe){ if (GBrowserIsCompatible()) { map = new GMap2(document.getElementById("map")); dirn = new GDirections(map); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); /* GEvent.addListener(dirn,"error", function() { alert("Dirección desconocida: "+dirn.getStatus().code); });*/ dirn.load("from: "+origen+" to: "+ destino, {getSteps:true,locale:"es_ES"}); } }