﻿var idMenuMax = '6';
var idMenuMin = '0';

function initMenu(IndexSelect) {
    // Correction du bug IE6
    try { 
        document.execCommand("BackgroundImageCache", false, true); 
    } 
    catch(err) {
    }
    
    // Gestion des menus
    var oLis = document.getElementsByTagName('li');
    
    for (var i=0; i<oLis.length; i++) {
        var regExpMatchOver = new RegExp("(m-over)+","g");
        var regExpMatchOut = new RegExp("(m-out)+","g");
        
        if(IndexSelect != '-1' && oLis[i].id == IndexSelect)
        {
           oLis[i].className = 'm-select';
        }
        if ((regExpMatchOver.test(oLis[i].className)) || (regExpMatchOut.test(oLis[i].className))) {
            oLis[i].onmouseover = function() { 
                var regExpReplace = new RegExp("(m-out)+","g"); 
                this.className = this.className.replace(regExpReplace, 'm-over');
            }
            oLis[i].onmouseout = function() { 
                var regExpReplace = new RegExp("(m-over)+","g"); 
                this.className = this.className.replace(regExpReplace, 'm-out');
            }                 
        }
        else{
            if (IndexSelect != '-1' && oLis[i].id == IndexSelect) {            
                 oLis[i].className = 'm-select';    
                 oLis[i].onmouseover = function() { 
                    var regExpReplace = new RegExp("(m-select)+","g"); 
                    this.className = this.className.replace(regExpReplace, 'm-over'); 
                }  
                 oLis[i].onmouseout = function() { 
                    var regExpReplace = new RegExp("(m-over)+","g"); 
                    this.className = this.className.replace(regExpReplace, 'm-select');
                }
            }
            
        }
        
    }
    
    return false;
}