function autocomplete(inp, arr, taxonomy) {
var currentFocus;
inp.addEventListener("input", function(e) {
var a, b, i, val = this.value;
closeAllLists();
if (!val) {
return false;
}
currentFocus = -1;
a = document.createElement("DIV");
a.setAttribute("id", this.id + "autocomplete-list");
a.setAttribute("class", "autocomplete-items");
this.parentNode.appendChild(a);
for (i = 0; i < arr.length; i++) {
if (arr[i].substr(0, val.length).toUpperCase() == val.toUpperCase()) {
b = document.createElement("DIV");
b.innerHTML = "" + arr[i].substr(0, val.length) + "";
b.innerHTML += arr[i].substr(val.length);
b.innerHTML += "";
b.addEventListener("click", function(e) {
inp.value = this.getElementsByTagName("input")[0].value;
closeAllLists();
window.location.href="https://www.mpcontrol.es/?s="+encodeURI(inp.value)+"&taxonomy="+taxonomy+"&post_type=equipos";
});
a.appendChild(b);
}
}
});
inp.addEventListener("keydown", function(e) {
var x = document.getElementById(this.id + "autocomplete-list");
if (x) x = x.getElementsByTagName("div");
if (e.keyCode == 40) {
currentFocus++;
addActive(x);
} else if (e.keyCode == 38) {
currentFocus--;
addActive(x);
} else if (e.keyCode == 13) {
e.preventDefault();
if (currentFocus > -1) {
if (x) x[currentFocus].click();
}else{
if (x) x[0].click();
}
}
});
function addActive(x) {
if (!x) return false;
removeActive(x);
if (currentFocus >= x.length) currentFocus = 0;
if (currentFocus < 0) currentFocus = (x.length - 1);
x[currentFocus].classList.add("autocomplete-active");
}
function removeActive(x) {
for (var i = 0; i < x.length; i++) {
x[i].classList.remove("autocomplete-active");
}
}
function closeAllLists(elmnt) {
var x = document.getElementsByClassName("autocomplete-items");
for (var i = 0; i < x.length; i++) {
if (elmnt != x[i] && elmnt != inp) {
x[i].parentNode.removeChild(x[i]);
}
}
}
document.addEventListener("click", function(e) {
closeAllLists(e.target);
});
}
var normatives = ["","21 CFR P.11","AECTP 300","ASTM","ASTM D7539","ATP","BMW GS 95011-4","BMW PR 303.5","BMW PR 306.5 (Sin Radiación)","BMW PR 308.2","BOE-A-2013-11936","BS 2011","BS EN 2002-001","BS EN 2266-008","BS EN 2713-012","BS EN 3645-002","BS EN 3646","BS EN 4165-014","BS EN 4708-203","Coeficiente K","DIN","DIN 40046","DIN 40046-721-6","DIN 50014","DIN 50016","DIN 72300-4","DIN EN 60721-1:1997-02","DIN IEC 721-6","DIN/IEC 68-2-30","ECE/TRANS/312","ECE/TRANS/WP.11","EMA","EN","EN 12368:2006","EN 23007","EN 50130-5:2011","EN 54-2:1997","EN 54-2:1997 A1:2006","EN 62676-1-1:2014","ETS 300019-2","ETSI EN 300019-2-4 Test Ab/Ad","ETSI EN 300019-2-4 Test Bb/Bd","ETSI EN 300019-2-4 Test Cab","ETSI EN 300019-2-4 Test Cb","ETSI EN 300019-2-4 Test Db","ETSI EN 300019-2-4 Test Nb","EX 58-1","EX 58-15","EX 58-2","EX 58-4","EX 58-5","EX 58-6","FDA","GB/T 2423.2","GB/T 2423.3","GB/T 2423.50","GMP","ICH","IEC","IEC 60068-2-1 Test A","IEC 60068-2-14 Test Nb","IEC 60068-2-2 Test B","IEC 60068-2-30 Test Db Var. 1","IEC 60068-2-30 Test Db Var. 2","IEC 60068-2-38","IEC 60068-2-4 Test D","IEC 60068-2-56","IEC 60068-2-67","IEC 60068-2-78","IEC 60721-4","IEC 61215","IEC 61300-2-17","IEC 61300-2-19","IEC 61300-2-21","IEC 61300-2-22","IEC 61300-2-46","IEC 61300-2-48","IEC 61646","IEC 62108:2021","IEC 62599-1 Part 1","IEC-60068-3-5","ISO","ISO 13408-1","ISO 16750-4 Damp heat cyclic","ISO 16750-4 Damp heat steady","ISO 16750-4 High temperature","ISO 16750-4 Hum heat cyclic","ISO 16750-4 Low temperature","ISO 16750-4 Tem/humid cyclic","ISO 16750-4 Temp.cycling","ISO 16750-4 Temp.steps","ITC/2590/2010","JESD22-A100D","JESD22-A101C","JESD22-A103C","JESD22-A103D","JESD22-A119","JJF1101","MIL-E-5272 Part 4.4","MIL-STD","MIL-STD-202 G Method 103B","MIL-STD-202 G Method 108A","MIL-STD-202 H Method 103B","MIL-STD-202 H Method 106G","MIL-STD-202 H Method 106H","MIL-STD-202 H Method 108A","MIL-STD-331 C Method 106D","MIL-STD-331 C Test C 6.2.1.2","MIL-STD-331 C Test C 6.2.1.3","MIL-STD-331 C Test C6","MIL-STD-750 F 1","MIL-STD-750-F 1 Change 3","MIL-STD-810 G Method 501.5","MIL-STD-810 G Method 502.5","MIL-STD-810 G Method 507.5","MIL-STD-810G","MIL-STD-883 J Method 1004.7","MIL-STD-883 J Method 1008.2","PIC/S PI 007-6","PNE-prEN 300019-2-0 V2.1.6","PNE-prEN IEC 60721-2-6:2021","PSA","Q1A","Q1A (R2)","Q1C","Q5C","R.D. 237/2000","R.D. 380/2001","RTCA-DO-160G","Telcordia GR1435","Telcordia GR326","Tests 10.11 10.12 und 10.13","UL 1703 (test 33 temperature cycling test test 34 humidity test)","UNE","UNE 20501-2-49:1986","UNE-EN 12368:2008","UNE-EN 13129","UNE-EN 14750","UNE-EN 14813","UNE-EN 23007","UNE-EN 23007-2: 1998 Erratum: 2004","UNE-EN 23007-2:1998 1ªMod. 2008","UNE-EN 300019-2-3 V2.5.1","UNE-EN 300019-2-8 V2.2.1","UNE-EN 50130-5:2000","UNE-EN 50130-5:2011","UNE-EN 50131-2-4:2008","UNE-EN 50131-5-3:2005","UNE-EN 50133-1:1998","UNE-EN 50155:2007","UNE-EN 54-3:2001","UNE-EN 54-3/A1:2002","UNE-EN 60068-2-1:2007","UNE-EN 60068-2-14:2011","UNE-EN 60068-2-2:2008","UNE-EN 60068-2-30:2006","UNE-EN 60068-2-38:2010","UNE-EN 60068-2-39:2016","UNE-EN 60068-2-40:2000","UNE-EN 60068-2-53:2011","UNE-EN 60068-2-67:1996/A1:2019","UNE-EN 60068-2-78:2013","UNE-EN 60068-3-1:2012","UNE-EN 60068-3-11:2008","UNE-EN 60068-3-4:2002","UNE-EN 60068-3-7:2002","UNE-EN 60721-2-1:2014","UNE-EN 60839-11-1:2014","UNE-EN 62676-1-1:2015","UNE-EN IEC 60068","UNE-EN IEC 60068-3-3:2019/AC:2021-10","UNE-EN IEC 60068-3-5:2018","UNE-EN IEC 60068-3-6:2018","UNE-EN IEC 60068-3-6:2018/AC:2018-05","UNE-EN IEC 60068-3-7:2020","UNE-EN IEC 60721-2-4:2018","UNE-EN IEC 60721-2-4:2018/AC:2018-12","UNE-EN-50131-3:2010","UNE-EN-50131-4:2010","USP","USP 797","VG 95210 Blatt 7 Meth. 106C","VG 95332","Volkswagen PV 1200","Volkswagen PV 1210","Volkswagen PV 2005","VW PV 1200","VW PW1200"];
var sectors = ["","Aeronáutica","Agronomía","Automoción","Biotecnología","Construcción","Cosmética","Electromecánico","Energético","Entomología","Farma y afines","Ferroviario","Materiales","Packaging","Veterinario"];
jQuery(window).load(function(){
autocomplete(document.getElementById("inputNormativa"), normatives, 'normativas');
autocomplete(document.getElementById("inputSector"), sectors, 'sectores');
jQuery("#buscador-normativa-sector button").click(function(){
jQuery("#buscador-normativa-sector .inputswrapper").toggleClass("shown");
});
autocomplete(document.getElementById("inputNormativaMobile"), normatives, 'normativas');
autocomplete(document.getElementById("inputSectorMobile"), sectors, 'sectores');
jQuery("#buscador-normativa-sector-mobile button").click(function(){
jQuery("#buscador-normativa-sector-mobile .inputswrapper").toggleClass("shown");
});
autocomplete(document.getElementById("inputNormativaHomepage"), normatives, 'normativas');
autocomplete(document.getElementById("inputSectorHomepage"), sectors, 'sectores');
jQuery("#buscador-normativa-sector-homepage .fakebutton").click(function(){
jQuery("#buscador-normativa-sector-homepage .autocomplete-items div").eq(0).click();
});
});