var hover;
var lastUsedObject;
var lastUsedClass;
var childDiv = null;
window.onload = function(){
    childDiv = document.getElementById('childLinks');
}

function getStyle(el,styleProp)
{
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function childHoverStart(){
	hover = true;
	menu_down(lastUsedObject,lastUsedClass);


}
function childHoverEnd(){
	hover = false;
	menu_up(lastUsedObject);
}
/**
 * Functie om submenu te verbergen
 */
function menu_up(myObject){
	if (!hover){
		p = document.getElementById(myObject);
		p.style.borderBottom = "1px solid black";
    if(childDiv)
      childDiv.style.visibility = "hidden";
	}
}
function getLinks(kleur){
    var arr = null;
    var links = "";
    if(kleur=="wit"){
        arr = witLinks;
    }
    else if(kleur=="geel"){
        arr = geelLinks;
    }else if(kleur=="oranje"){
        arr = oranjeLinks;
    }else if(kleur=="groen"){
        arr = groenLinks;
    }else if(kleur=="blauw"){
        arr = blauwLinks;
    }else if(kleur=="bruin"){
        arr = bruinLinks;
    }else if(kleur=="zwart"){
        arr = zwartLinks;
    }
    else{
        return "";
    }
    for(var link in arr){
        if(links == ""){
            links += arr[link];
        }
        else{
            links += " | "+arr[link];
        }
    }
    return links;

}
/**
 * Functie om menu te laten zien
 *
 */
function menu_down(kleur,linkClass){
	p = document.getElementById(kleur);
    if(navigator.appName == "Microsoft Internet Explorer")
        color = getStyle(kleur,'backgroundColor');
    else
        color = getStyle(kleur,'background-Color');       

    p.style.borderBottom = '1px solid '+color;

	if(childDiv)
  {
    childDiv.style.backgroundColor = color;
    childDiv.style.visibility = "visible";
  }
	//links laden
	if(!hover){
        childDiv.setAttribute((document.all ? "className" : "class"),linkClass);
        childDiv.innerHTML = getLinks(kleur);
		//url = 'http://www.jcdrunen.nl/menu.php?kleur='+kleur+'&class='+linkClass+'';
		//clientSideInclude('childLinks', url);
	}
	lastUsedObject = kleur;
	lastUsedClass = linkClass;
}

