
// Removes the multi overlays from the map, but keeps them in the array
function multiOverLays(mode, type, ids_stations) {
    initialize();
    // @mode :              stting           => clearOverlays // showOverlays
    // @type :              String          => liste des types (S, E, C, S...), à convertir en tableau
    // @ids_stations :      String          => liste des types stations, si besoin à passer à la fonction du @mode
    //alert("multiOverLays / type => " + type);
    var listeT = [];
    var reg=new RegExp("[,; ]+", "g");
    listeT = type.split(reg);
    //alert("multiOverLays / nbtype => " + listeT.length);
    for (t in listeT) {
        //alert("multiOverLays / listeT[t] => " + listeT[t]);
        if (mode == "clearOverlays") {
            clearOverlays(listeT[t], ids_stations);
        }else{
            showOverlays(listeT[t], ids_stations);
        }
    }
}

function clearOverlays(typeA, ids_stations) {
    markersArrayAff = new Array;
    if (typeA == "S") {
        markersArrayAff = markersstationsArray;
    }else if (typeA == "SP") {
        markersArrayAff = markersstationsArray;
        markersArrayVerif = markersstationsPoluArray;
    }else if (typeA == "E") {
        markersArrayAff = markersetudesArray;
    }else if (typeA == "EI") {
        markersArrayAff = markersetudes_interArray;
    }else if (typeA == "EF") {
        markersArrayAff = markersetudes_finArray;
    }else if (typeA == "C") {
        markersArrayAff = markerscarrieresArray;
    }
    //alert(typeA+ "// stations="+ids_stations+" // nbmarker="+markersArrayAff.length);
    //alert("fct clearOverlays=> typeA => "+typeA+ " // "+typeof(typeA)+" // "+markersArrayAff.length);
    if (typeof(typeA)=='string' && markersArrayAff.length > 0) {
        //alert("typeA => "+typeA);
        for (i in markersArrayAff) {
            if (!ids_stations) {
                if (markersArrayAff[i]) {markersArrayAff[i].setMap(null)};
            }else{
                var listeS = [];
                var reg=new RegExp("[,; ]+", "g");
                listeS = ids_stations.split(reg);
                for (s in listeS) {
                    if (listeS[s] == markersArrayVerif[i]) {
                        if (markersArrayAff[i]) {markersArrayAff[i].setMap(null)};
                    }
                }
            }
        }
    }
}
// Shows any overlays currently in the array
function showOverlays(typeA, ids_stations) {
    if (typeA == "S") {
        markersArrayAff = markersstationsArray;
    }else if (typeA == "SP") {
        markersArrayAff = markersstationsArray;
        markersArrayVerif = markersstationsPoluArray;
    }else if (typeA == "E") {
        markersArrayAff = markersetudesArray;
    }else if (typeA == "EI") {
        markersArrayAff = markersetudes_interArray;
    }else if (typeA == "EF") {
        markersArrayAff = markersetudes_finArray;
    }else if (typeA == "C") {
        markersArrayAff = markerscarrieresArray;
    }
    //alert(typeA+ "("+typeof(typeA)+") // stations="+ids_stations+" // nbmarker="+markersArrayAff.length);
    if (typeof(typeA)=='string' && markersArrayAff.length > 0) {
        //alert("typeA => "+typeA);
        for (i in markersArrayAff) {
            if (!ids_stations) {
                if (markersArrayAff[i]) {markersArrayAff[i].setMap(map)};
            }else{
                var listeS = [];
                var reg=new RegExp("[,; ]+", "g");
                listeS = ids_stations.split(reg);
                for (s in listeS) {
                    if (listeS[s] == markersArrayVerif[i]) {
                        if (markersArrayAff[i]) {markersArrayAff[i].setMap(map)};
                    }
                }
            }
        }
    }
}
function unchekPolluants(sauf) {
    var list = document.map_Show;
    //alert(list.length);
    for (i = 0; i < list.length; i++) {
    	if (list[i].type == "radio") {
    	   var verif = 'polluants'+sauf;
            //alert(list[i].name+' == '+verif);
            if ((sauf != '' && list[i].name != verif) || !sauf) {
                list[i].checked = false ;
            }
        }
    }
}
function chekPolluants() {
    var list = document.map_Show;
    //alert(list.length);
    for (i = 0; i < list.length; i++) {
    	list[i].checked = true ;
    }
}
<!--
// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0
// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
    //alert(document.getElementById("map_canvas").style.top);
    //alert(document.getElementById("map_canvas").scrollLeft);
    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX + document.body.scrollLeft
        tempY = event.clientY + document.body.scrollTop
    } else {  // grab the x-y pos.s if browser is NS
        //alert(document.getElementById("map_canvas").width);
        tempX = e.pageX -  parseInt(document.body.clientWidth/2) + parseInt(580/2)
        tempY = e.pageY -  parseInt(document.body.clientHeight/2)
    }
    // catch possible negative values in NS4
    if (tempX < 0){tempX = 0}
    if (tempY < 0){tempY = 0}
    // show the position values in the form named Show
    // in the text fields named MouseX and MouseY
    document.map_Show.MouseX.value = tempX
    document.map_Show.MouseY.value = tempY
    return true
}
//-->
//google.maps.event.addDomListener(window, 'load', initialize);
google.maps.event.addDomListener(window, 'load', function(){multiOverLays('clearOverlays', 'EI, EF')});
