var clicked=""
var gtype=".gif"
var selstate="_over"
loc="/images/";


if (typeof(loc)=="undefined" || loc==""){
	var loc=""
	if (document.body&&document.body.innerHTML){
		var tt = document.body.innerHTML.toLowerCase();
		var last = tt.indexOf("mainmenu.js\"");
		if (last>0){
			var first = tt.lastIndexOf("\"", last);
			if (first>0 && first<last) loc = document.body.innerHTML.substr(first+1,last-first-1);
		}
	}
}


function ShowMainMenu()
{
	document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>");
	document.write("<td><img src=\""+loc+"mainmenu_top.gif\" alt=\"\" width=\"141\" height=\"86\"></td>");
	tr(false);
	writeButton(loc,"../index.php?action=main","mainmenu_b1",141,37,"welkom","",0);
	writeButton(loc,"../index.php?action=zandje","mainmenu_b2",141,37,"t`zandje","",0);
	writeButton(loc,"../index.php?action=aanmelden","mainmenu_b3",141,37,"Aanmelden","",0);
	writeButton(loc,"../index.php?action=contact","mainmenu_b4",141,37,"Contact","",0);
	writeButton(loc,"../index.php?action=spelen","mainmenu_b5",141,37,"Spelen","",0);
	tr(true);
	document.write("<td><img src=\""+loc+"mainmenu_bottom.gif\" alt=\"\" width=\"141\" height=\"87\"></td>");
	document.write("</tr></table>");
}

function ShowZandjeMenu()
{

	document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>");
	document.write("<td><img src=\""+loc+"zandje_left.gif\" alt=\"\" width=\"84\" height=\"46\"></td>");
	writeButton(loc,"../index.php?action=lokatie","zandje_b1",134,46,"Lokatie","",0);
	writeButton(loc,"../index.php?action=tijden","zandje_b2",134,46,"Tijden","",0);
	writeButton(loc,"../index.php?action=faciliteiten","zandje_b3",134,46,"Faciliteiten","",0);
	document.write("<td><img src=\""+loc+"zandje_right.gif\" alt=\"\" width=\"84\" height=\"46\"></td>");
	document.write("</tr></table>");
}

function ShowAanmelden()
{
	document.write("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>");
	document.write("<td><img src=\""+loc+"aanmelden_left.gif\" alt=\"\" width=\"84\" height=\"46\"></td>");
	tr(false);
	writeButton(loc,"../index.php?action=contributie","aanmelden_b1",165,46,"Contributie","",0);
	writeButton(loc,"../index.php?action=benodigdheden","aanmelden_b2",165,46,"Benodigdheden","",0);
	tr(true);
	document.write("<td><img src=\""+loc+"aanmelden_right.gif\" alt=\"\" width=\"84\" height=\"46\"></td>");
	document.write("</tr></table>");
}



function SetDirection(TheDirection)
{
	dir=TheDirection;
}


function tr(b)
{
	if (dir=="ver")
	{
		if (b)
		{
			document.write("<tr>");
		}
		else 
		{
			document.write("</tr>");
		}
	}
}

function turn_over(name) {
	if (document.images != null && clicked != name) {
		document[name].src = document[name+"_over"].src;
	}
}

function turn_off(name) {
	if (document.images != null && clicked != name) {
		document[name].src = document[name+"_off"].src;
	}
}

function reg(gname,name)
{
if (document.images)
	{
	document[name+"_off"] = new Image();
	document[name+"_off"].src = loc+gname+gtype;
	document[name+"_over"] = new Image();
	document[name+"_over"].src = loc+gname+"_over"+gtype;
	}
}

function evs(name)
{ 
	return " onmouseover=\"turn_over('"+ name + "')\" onmouseout=\"turn_off('"+ name + "')\"";
}

function writeButton(urld, url, name, w, h, alt, target, hsp)
{
	gname = name;
	while(typeof(document[name])!="undefined") name += "x";
	reg(gname, name);
	tr(true);
	document.write("<td>");
	if (alt != "") alt = " alt=\"" + alt + "\"";
	if (target != "") target = " target=\"" + target + "\"";
	if (w > 0) w = " width=\""+w+"\""; else w = "";
	if (h > 0) h = " height=\""+h+"\""; else h = "";	
	if (url != "") url = " href=\"" + urld + url + "\"";
	
	document.write("<a " + url + evs(name) + target + ">");	
	
	if (hsp == -1) hsp =" align=\"right\"";
	else if (hsp > 0) hsp = " hspace=\""+hsp+"\"";
	else hsp = "";
	
	document.write("<img src=\""+loc+gname+gtype+"\" name=\"" + name + "\"" + w + h + alt + hsp + " border=\"0\" /></a></td>");
	tr(false);
}




var step=8 
var stepbasic=8
var numberofimages=8
var spacebetweenimgs=60
var x,y
var flag=0
var xpos=new Array()

var ns6=document.getElementById&&!document.all?1:0

for (i=0;i<=8;i++) {
	xpos[i]=-100
}

var ypos=new Array()
for (i=0;i<=numberofimages;i++) {
	ypos[i]=-100
}

function handlerMM(e) {
	x = (document.layers || ns6) ? e.pageX : document.body.scrollLeft+event.clientX
	y = (document.layers || ns6) ? e.pageY : document.body.scrollTop+event.clientY
	flag=1
}

function initiatetracker() {
	if (document.all) {
		for (i=0; i<numberofimages; i++) {
    		var thisspan=eval("span"+(i)+".style")
			thisspan.posLeft=xpos[i]
			thisspan.posTop=ypos[i]
    		thisspan.visibility="visible"
    	}
		makesnake()
	}
    
   if (ns6) {
		for (i=0; i<numberofimages; i++) {
			document.getElementById("span"+i).style.left=xpos[i]
			document.getElementById("span"+i).style.top=ypos[i]
    		document.getElementById("span"+i).style.visibility="visible"
    	}
		makesnake()
	}
	if (document.layers) {
		for (i=0; i<numberofimages; i++) {
    		var thisspan=eval("document.span"+i)
			thisspan.left=xpos[i]
			thisspan.top=ypos[i]
			thisspan.visibility="visible"
		}

    	makesnake()
	}
}

function makesnake() {
	if (flag==1 && document.all) {
    	for (i=numberofimages; i>=1; i--) {
   			xpos[i]=xpos[i-1]+spacebetweenimgs
			ypos[i]=ypos[i-1]
    	}
		xpos[0]=x+stepbasic
		ypos[0]=y
	
		for (i=0; i<numberofimages; i++) {
    		var thisspan = eval("span"+(i)+".style")
    		thisspan.posLeft=xpos[i]
			thisspan.posTop=ypos[i]
    	}
	}
    
    if (flag==1 && ns6) {
    	for (i=numberofimages; i>=1; i--) {
   			xpos[i]=xpos[i-1]+spacebetweenimgs
			ypos[i]=ypos[i-1]
    	}
		xpos[0]=x+stepbasic
		ypos[0]=y
	
		for (i=0; i<numberofimages; i++) {
    		document.getElementById("span"+i).style.left=xpos[i]
			document.getElementById("span"+i).style.top=ypos[i]
    	}
	}
	
	else if (flag==1 && document.layers) {
    	for (i=numberofimages; i>=1; i--) {
   			xpos[i]=xpos[i-1]+spacebetweenimgs
			ypos[i]=ypos[i-1]
    	}
		xpos[0]=x+stepbasic
		ypos[0]=y
	
		for (i=0; i<numberofimages; i++) {
    		var thisspan = eval("document.span"+i)
    		thisspan.left=xpos[i]
			thisspan.top=ypos[i]
    	}
	}
		var timer=setTimeout("makesnake()",30)
}

if (document.layers){
	document.captureEvents(Event.MOUSEMOVE);
}



