
var menuids=["treemenu1"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
		if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
			ultags[t].style.top=ultags[t].parentNode.offsetHeight+"px" //dynamically position first level submenus to be height of main menu item
		}
		else{ //else if this is a sub level menu (ul)
		  ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
		}
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
  }
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal)

function stem(id)
{
	var xmlHttp;
	if (window.xmlHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlHttp = new xmlHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		// code for IE6, IE5
		xmlHttp = new ActiveXObject("Microsoft.xmlHttp");
	}
	else
	{
		alert("Uw browser kent geen ajax!");
	}

	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4)
		{
			if(xmlHttp.responseText=="error")
			{
				alert("U kan maar 1 keer stemmen.");
			}
			else
			{
				document.getElementById("stemstats").innerHTML = xmlHttp.responseText;
				document.getElementById("stemdiv").style.display = "none";
				document.getElementById("stemstats").style.display = "block";
			}
		}
	}
	xmlHttp.open("GET","stempoll.php?id=" + id);
	xmlHttp.send(null);
}

function makelink()
{
	var tekst = prompt("Wat moet de tekst zijn van de link?");
	var url = prompt("Wat moet de link worden?");
	if(url.substr(0,7)!="http://")
	{
		url="http://"+url;
	}
	document.getElementById("bericht").value += "<a href='" + url + "'>" + tekst + "</a>";
}

function viewTopscore(team)
{
	document.location = "?page=overig/topscorers&team=" + team;	
}

function scoreInvullen(id)
{
	document.location = "?page=cms/wedstrijden/export&id=" + id;	
}
