﻿
$$('.vestigingsdot').each(function(dotli) {
		
		var coords = dotli.getElement('.data .coords').innerHTML.split(',');
		dotli.data = [];
		dotli.data.x = coords[0];
		dotli.data.y = coords[1];
		dotli.data.img = dotli.getElement('.data .img').innerHTML;
		dotli.data.straat = dotli.getElement('.data .straat').innerHTML;
		dotli.data.telefoonnummer = dotli.getElement('.data .telefoonnummer').innerHTML;
		dotli.data.titel = dotli.getElement('.data .titel').innerHTML;
		dotli.data.link = dotli.getElement('.data .link').innerHTML;
		
		dotli.onmouseover=function() {
			showVestigingInfo(dotli.data.y, dotli.data.x, dotli.data.titel, dotli.data.straat, dotli.data.telefoonnummer, dotli.data.img, dotli.data.link);
		}; 
		
		dotli.onmouseout = function() {
			document.getElementById('vestiging_info').fuse = setTimeout('document.getElementById(\'vestiging_info\').style.display = \'none\'',1000);
		};
});

function showVestigingInfo(x, y, titel, straat, telefoonnummer, img, link) {

	var div = document.getElementById('vestiging_info');
	div.style.display = 'block';
	var a = document.getElementById('vestiging_link');

	if (div.fuse) clearTimeout(div.fuse);
	a.onmouseover = function() { if (div.fuse) clearTimeout(div.fuse); };
	a.onmouseout = function() { div.fuse = setTimeout('document.getElementById(\'vestiging_info\').style.display = \'none\'', 1000);	}
	
	xStart = -198; /* Width of entire left-hand popup */
	yStart = -25; /* heigt diferrence of the top of the left-hand popup */
	div.style.marginTop = yStart + parseInt(y) + "px";
	div.style.marginLeft = xStart + parseInt(x) + "px";

	$("vestiging_link").href = link;

	span = document.getElementById('vestigingen_contact');
	span.innerHTML = "Vestiging " + titel + "<br />" + straat + "<br />TEL. " + telefoonnummer;

	if (null != img) {
		document.vestiging_img.src = img;
		document.vestiging_img.alt = titel;
		document.vestiging_img.border = 0;
	}
}