// 
function get_groupid(name) {
    name = name.substring(0,1);
    for (g in groups) {
	if (groups[g] == name)
	    return g;
    }
}
function get_dirid(grp,dir) {
    g = get_groupid(grp);
    for (i in grouparray[g]) {
	if (grouparray[g][i] == dir)
	    return i;
    }
}

function toggle_hi(grp,index) {
    overimg=grp+index;
    g = get_groupid(grp);
    for (i=1;i<=6;i++) {
	name=grp+i;
	if (i == index) {
	    document.images[name].src=navimages[g][i][1].src;
	} else {
	    if (document.images[name].src != navimages[g][i][0].src) {
		document.images[name].src=navimages[g][i][0].src;
	    }
	}
    }
}

function alloff() {
    overgrp = get_groupid(overimg);
    leavegrp = get_groupid(leaveimg);
    for (g in groups) {
	agrp = groups[g];
	if (g == overgrp && leaveimg != overimg) 
	    continue;
	for (i=1;i<=6;i++)
	    document.images[agrp+i].src=navimages[g][i][0].src;
    }
}

function toggle_lo(grp,index) {
    if (allstop == 1) return;
    leaveimg=grp+index;
    window.setTimeout("alloff();",50);
}



// pre-caching
allstop=null;
overimg=null;
leaveimg=null;
groups=new Array('s','n','o','c');
grouparray = new Array(
		       new Array(null,'enieuwsbrief','discussieermee','deskundigadvies','actuelevragen','checklisten','nuttigeadressen'),
		       new Array(null,'orenpvt','wettenenregels','management','peno','arboenmilieu','begrippenlijst'),
		       new Array(null,'orliteratuur','adviseurs','accomodaties','orpromotie','cursussen','software'),
		       new Array(null,'profiel','sitemap','abonnement','adverteren','contact','voorwaarden'),
		       null
		       );
patharray = window.location.pathname.split('/');
ingrp = patharray[1].substring(0,1);
indir = get_dirid(ingrp,patharray[2]);
navimages = new Array();
for (g in groups) {
    group = groups[g];
    navimages[g] = new Array();
    for (i=1; i<=6; i++) {
	navimages[g][i] = new Array();
	for (j=0; j<= 1; j++) {
	    navimages[g][i][j] = new Image();
	    if (ingrp == group && indir == i) {
		navimages[g][i][j].src = "/struct/nav/"+group+i+"1.jpg";
	    } else {
		navimages[g][i][j].src = "/struct/nav/"+group+i+j+".jpg";
	    }
	}
    }
}
g=null;
