window.currMenuId = 0; //Hier houden we bij op welk element is geklikt.
window.currStatusId = 0;

function menu(menuId,newMenuId, status){
//Als het element dat wordt aangeroepen gelijk is aan het element waarop geklikt is, dan doen we helemaal niks. Dit is
//nodig zodat er geen mouse-out wordt uitgevoerd waardoor het element weer een neutrale positie krijgt.
	if (menuId != currMenuId){  															
		//Als het huidige id gelijk is aan het id waarin het element veranderd moet worden,
		//dan weten we dat er op het element wordt geklikt. We vullen nu de var currMenuId 
		//met het id van het element dat wordt aangeroepen.
		
		if (menuId == newMenuId){ //CLICK
			
			
			//Als we op een nieuwe knop clicken zetten we de eerder geclickte knop op passief.
			if( (status != currStatusId) && (currStatusId != 0) ) { 
				document.getElementById(currMenuId).id = currStatusId;
			}
			//Hier bewaren we de waardes van de nieuw geclickte knop.
			currMenuId 		= menuId; //Dit is het active Id.
			currStatusId 	= status; //Dit is het passieve Id.
		
		} else { //Als het gaat om een mouse-over en mouse-out van een element, dan voeren we onderstaand uit.
			if(document.getElementById(menuId)){
				document.getElementById(menuId).id = newMenuId;	
			}	
			if(document.getElementById(status+"SubMenu")){
				if(document.getElementById(status+"SubMenu").style.display == "block"){
					document.getElementById(status+"SubMenu").style.display = "none";
				}else{
					document.getElementById(status+"SubMenu").style.display = "block";
				}
			}		
		}
		

	}
}

window.currCreto = "michiel";

function creto(cretoId){
	document.getElementById(currCreto + "Creto").style.display = "none";
	document.getElementById(cretoId + "Creto").style.display = "block";
	document.getElementById(currCreto).className = "";
	document.getElementById(cretoId).className = "active";
	
	currCreto = cretoId;
}


/**
* de volgende functies hebben te maken met Google Maps:
*/

var vdbergMap;
var vdbergMarker;
function load() {
	if (GBrowserIsCompatible()) {
		vdbergMap = new GMap2(document.getElementById("map"));
		vdbergMap.setCenter(new GLatLng(52.173000,5.417718), 15);
		vdbergMap.enableScrollWheelZoom();
		vdbergMap.addControl(new GSmallMapControl());
				
		var vdbergIcon = new GIcon(G_DEFAULT_ICON);
    	vdbergIcon.image = "http://eva.provident.nl/vandenbergverhuizers.nl/images/googleflag.png";
		vdbergIcon.iconSize = new GSize(162, 52);
		vdbergIcon.shadowSize = new GSize(0, 0);
				
		var latlng = new GLatLng(52.174150,5.414100);
		markerOptions = { icon:vdbergIcon };
		
		vdbergMarker = new GMarker(latlng, markerOptions);
        vdbergMap.addOverlay(vdbergMarker);

	

		//route...
		gdir = new GDirections(vdbergMap, document.getElementById("directions"));
		GEvent.addListener(gdir, "load", onGDirectionsLoad);
        GEvent.addListener(gdir, "error", handleDirectionsErrors);
	}
}

	function setDirections(fromAddress, toAddress, locale) {
      gdir.load("from: " + fromAddress + " to: " + toAddress,
                { "locale": locale });
    }
	function onGDirectionsLoad(){ 
      // Use this function to access information about the latest load()
      // results.

      // e.g.
      // document.getElementById("getStatus").innerHTML = gdir.getStatus().code;
	  // and yada yada yada...
		vdbergMap.removeOverlay(vdbergMarker)
	}

    function handleDirectionsErrors(){
	   if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
	     alert("No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.\nError code: " + gdir.getStatus().code);
	   else if (gdir.getStatus().code == G_GEO_SERVER_ERROR)
	     alert("A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.\n Error code: " + gdir.getStatus().code);
	   
	   else if (gdir.getStatus().code == G_GEO_MISSING_QUERY)
	     alert("The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.\n Error code: " + gdir.getStatus().code);

	//   else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS)  <--- Doc bug... this is either not defined, or Doc is wrong
	//     alert("The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.\n Error code: " + gdir.getStatus().code);
	     
	   else if (gdir.getStatus().code == G_GEO_BAD_KEY)
	     alert("The given key is either invalid or does not match the domain for which it was given. \n Error code: " + gdir.getStatus().code);

	   else if (gdir.getStatus().code == G_GEO_BAD_REQUEST)
	     alert("A directions request could not be successfully parsed.\n Error code: " + gdir.getStatus().code);
	    
	   else alert("An unknown error occurred.");
	   
	}








window.currTabId= "tabWoonkamer-active"; //Hier houden we bij op welk element is geklikt.
window.currTabStatusId = "tabWoonkamer";

//"formTabs('tabWoonkamer', 'tabWoonkamer-active', 'tabWoonkamer')"
function formTabs(tabId,newTabId, status){
	
//Als het element dat wordt aangeroepen gelijk is aan het element waarop geklikt is, dan doen we helemaal niks. Dit is
//nodig zodat er geen mouse-out wordt uitgevoerd waardoor het element weer een neutrale positie krijgt.
	if (tabId != currTabId){  															
		//Als het huidige id gelijk is aan het id waarin het element veranderd moet worden,
		//dan weten we dat er op het element wordt geklikt. We vullen nu de var currMenuId 
		//met het id van het element dat wordt aangeroepen.
		
		if (tabId == newTabId){ //CLICK
	
			
					document.getElementById(status+"Content").style.display = "";
				
					document.getElementById(currTabStatusId+"Content").style.display = "none";
					document.getElementById(currTabStatusId+"-active").id = currTabStatusId;		
				
			//Hier bewaren we de waardes van de nieuw geclickte knop.
			currTabId 		= tabId; //Dit is het active Id.
			currTabStatusId 	= status; //Dit is het passieve Id.
		
		} else { //Als het gaat om een mouse-over en mouse-out van een element, dan voeren we onderstaand uit.
		if(document.getElementById(tabId)){
			document.getElementById(tabId).id = newTabId;	
		}
		
		}
		

	}
}