Tags

if ($.browser.msie && $.browser.version >= 6) { //width="450" height="500" imageMexico = '
'; imageLatinoamerica = '
'; $("#map_mexico").html(imageMexico); $("#map_latinoamerica").html(imageLatinoamerica); } else { if (document.getElementById("latinoamerica_map")!=null && document.getElementById("mx_map")!=null) { colorOn = '#ed6c20'; colorOff = '#9a80be'; colorSelect = '#e24b23'; var paisSeleccion = ["MX", "CO", "CR", "EC", "GT", "HN", "PE", "DO", "UY", "NI", "BOL", "GUA", "CL", "py", "us"]; var paises = ["PE", "gf", "BOL", "MX", "BEL", "br", "DO", "cu", "ve", "CO", "GUA", "sr", "pa", "ar", "CR", "py", "ht", "ca", "sv", "gy", "UY", "HN", "NI", "CL", "EC", "us", "bs", "bs-", "bs.", "fk", "fk-", "fk.", "jm", "jm-", "jm.", "pr", "pr-", "pr.", "tt", "tt-", "tt.", "cv", "cv-", "cv.", "pf", "pf-", "pf.", "mq", "mq-", "mq.", "an", "an-", "an.", "dm", "dm-", "dm.", "gp", "gp-", "gp.", "ki", "ki-", "ki.", "ag", "ag-", "ag.", "bb", "bb-", "bb.", "tc", "tc-", "tc.", "vc", "vc-", "vc.", "lc", "lc-", "lc.", "vi", "vi-", "vi.", "gd", "gd-", "gd.", "ky", "ky-", "ky.", "kn", "kn-", "kn.", "ms", "ms-", "ms.", "pm", "pm-", "pm.", "ck", "ck-", "ck.", "aw", "aw-", "aw.", "vg", "vg-", "vg.", "ai", "ai.", "bm", "bm-", "bm.", "pn", "pn-", "pn." ]; var paises_nombre = ["México", "Colombia", "Costa Rica", "Ecuador", "Guatemala", "Honduras", "Peru", "Republica Dominicana", "Uruguay", "Nicaragua", "Bolivia"]; var opais = document.getElementById("latinoamerica_map"); //**Esta inicialización se pasa a una funcion global init_MapsEventListener (before /head)*/ opais.addEventListener("load", function () { //console.log('start listener opais'); var svgDoc = opais.contentDocument; for (i = 0; i < paises.length; i++) { //efecto con el mouse arriba //console.debug(paises[i]); var pais = svgDoc.getElementById(paises[i]); pais.style.setProperty("cursor", "pointer", "") fillColor(pais, colorOff) if (in_array(pais.id, paisSeleccion)) { fillColor(pais, colorOn) } pais.addEventListener("mouseover", function () { for (x = 0; x < paises.length; x++) { if (this.id != paises[x]) { aPais = svgDoc.getElementById(paises[x]); fillColor(aPais, colorOff); // Colorea los países con información if (in_array(paises[x], paisSeleccion)) { fillColor(aPais, colorOn) } } } // Color hover a los paises con info if (in_array(this.id, paisSeleccion)) { // console.log(this.id); fillColor(this, colorSelect) } //fillColor(this,colorOn) //$('edo').innerHTML = edos_names[edos.indexOf(this.id) ] }, false); pais.addEventListener("click", function () { // alert('Click sobre el estado de: ['+this.id+']'); // document.getElementById('txt_seleccion').innerHTML = 'Seleccionado: '+this.id+''; txtPais = document.getElementById("txt_pais"); txtPais.value = this.id; if (this.id == "MX") { visibleMexico(); } else { txtEstado = document.getElementById("txt_estado"); txtEstado.value = ""; $("#map_latinoamerica").hide(10); distribuidores(); } }, false); //fillColor(svgDoc.getElementById(edo_init) , colorOn) /// } //add behaviour }, false); // init_MapsEventListener(); edo_init = 'OAX'; var edos = ["AGUSC", "BCN", "BCS", "CHIPS", "CHUA", "CMP", "COAH", "COL", "DF", "DRG", "EDO-M", "GUAJT", "GUERO", "HDLG", "JALC", "MICHN", "NAYT", "NL", "OAX", "PUEB", "QROO", "QRTRO", "SLP", "SNLA", "SNRA", "TABSC", "TAMAP", "VRZ", "TLAX", "MORLS", "YUC", "ZACTS" ]; var edos_names = ['Aguascalientes', 'Baja California', 'Baja California Sur', 'Campeche', 'Chihuahua', 'Chiapas', 'Coahuila', 'Colima', 'Distrito Federal', 'Durango', 'Guerrero', 'Guanajuato', 'Hidalgo', 'Jalisco', 'México', 'Michoacán', 'Morelos', 'Nayarit', 'Nuevo León', 'Oaxaca', 'Puebla', 'Querétaro', 'Quintana Roo', 'Sinaloa', 'San Luis Potosí', 'Sonora', 'Tabasco', 'Tamaulipas', 'Tlaxcala', 'Veracruz', 'Yucatán', 'Zacatecas' ]; var mapaEstado = document.getElementById("mx_map"); mapaEstado.addEventListener("load", function () { var svgDoc = mapaEstado.contentDocument; for (i = 0; i < edos.length; i++) { //efecto con el mouse arriba var edo = svgDoc.getElementById(edos[i]); edo.style.setProperty("cursor", "pointer", ""); fillColor(edo, colorOff); edo.addEventListener("mouseover", function () { for (x = 0; x < edos.length; x++) { if (this.id != edos[x]) { estado = svgDoc.getElementById(edos[x]); fillColor(estado, colorOff) } } fillColor(this, colorOn) //$('edo').innerHTML = edos_names[edos.indexOf(this.id) ] }, false); edo.addEventListener("click", function () { txtEstado = document.getElementById("txt_estado"); txtEstado.value = this.id; $("#map_mexico").hide(5); distribuidores(); }, false); fillColor(svgDoc.getElementById(edo_init), colorOn) /// } //add behaviour }, false); //** Esta función se pasa a las funciones globales (before /head) */ // function fillColor(e, c) { // if (e.tagName != 'g') { // e.style.setProperty("fill", c, ""); // return // } // paths = e.getElementsByTagName('path') // for (j = 0; j < paths.length; j++) // paths[j].style.setProperty("fill", c, "") // } } }
OSZAR »