// Toon een verborgen element
function showDiv(id) {
	document.getElementById(id).style.display = "inline";
	}

// Verberg een element
function hideDiv(id) {
	document.getElementById(id).style.display = "none";
	}

function hideDivbyEvent(e) {
	//eventPhase = 2 => AT_TARGET : l'event est sur un élément.
	if ( e.eventPhase == 2 && (e.relatedTarget == e.currentTarget.parentNode || e.relatedTarget == document.body || e.relatedTarget == document.documentElement) ) {
		
	}
	else {
		e.preventDefault();
	}
}	
	
function hidediv_ie(event) {
	if ( event.toElement == zediv.parentNode ) {
		
	}
	else {
		event.returnValue=false;
	}
}

function theMouseOutTimer(delay) {
	timout = setTimeout('dropDownMenu(\'\', \'hideall\')', delay);
}

function resetTimer () {
	if (window.timout)	{
		clearTimeout(timout);
		timout = null;
	}
}
	
function dropDownMenu(id, action) {

	if (action == "show") {
		resetTimer();
		
		counter = 1;
		zediv=document.getElementById(id);
			if (window.addEventListener) {
				zediv.addEventListener('onmouseout',hideDivbyEvent,false);
			} else if (window.attachEvent) {
				zediv.attachEvent('onmouseout', hidediv_ie);
			} else {
				alert('Your browser does not support DOM addEventListener or IE\'s proprietary attachEvent.\nImpossible to detect onmouseout for the DIV element.\nPlease let me know if this happens : marcoledingue at.a@t.at free.fr');
			}
		
		while (counter < 5) {
			divName = "dropdown_" + counter;
			if (id == divName) {
				showDiv(id);
			} else {
				hideDiv(divName);
			}
			counter = counter + 1;
		}
	} else if (action =="hide") {
		hideDiv(id);
	} else if (action =="hideall") {
		counter = 1;
		while (counter < 5) {
			divName = "dropdown_" + counter;
			hideDiv(divName);
			counter = counter + 1;
		}
	}
}

function printLayer(id, image) { 
	var txt = document.getElementById(id).innerHTML; 
	var wnd = window.open('','','width=600,height=500,toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=no, resizable=no'); 
	wnd.document.write('<html>');
	wnd.document.write('<head>');
	wnd.document.write('<link rel=\'stylesheet\' href=\'http://www.restaurantgoesting.nl/wp-content/themes/restaurant-goesting/print.css\' type=\'text/css\' />');
	wnd.document.write('</head>');
	wnd.document.write('</body>');
	wnd.document.write('<center><img src=\'images/print_beeldmerk.gif\' border=\'0\'></center><br />');
	wnd.document.write('<center>veeartsenijpad 150 | 3572DH Utrecht | 030 2733346</center><br />');
	if (image == 'route') {
		wnd.document.write('<center><img src=\'images/print_kaart.gif\' border=\'0\'></center><br />');
	}
	wnd.document.write('<hr noshade size=\'1\' color=\'#666666\' width=\'100%\'><br /><br />');
	wnd.document.write(txt); 
	wnd.document.write('</body>');
	wnd.document.write('</html>');
	wnd.document.close(); 
	wnd.window.print(); 
} 

