function showDiv(DivId, bShow)
{
	document.getElementById(DivId).style.display = 'block';
}

function hideDiv(DivId)
{
	document.getElementById(DivId).style.display = 'none';
}	

function changeImage(imgId, imgSrc)
{
	if(imgId != "")
	{
		document.getElementById(imgId).src = imgSrc;
	}
}

function popp(RedirectUrl){
	var counter = 0;
	for (i=0; i<aItems.length; i++) {
		
		counter++;
		var rndom_left = Math.round(Math.random() * boxwidth);
		var rndom_top = Math.round(Math.random() * boxheight);
		if(!ValidateBox(rndom_left, rndom_top)) {
			i = i - 1;
		} else {
			if ((rndom_left + subboxheight) > boxwidth) {
				i = i - 1;	
			} else if ((rndom_top + subboxheight) > boxheight) {
				i = i - 1;	
			} else {
				aLeftPos[i] = rndom_left;
				aTopPos[i] = rndom_top;
				var BoxId = 'coverup' + i;
				var BalloonId = 'balloon' + i; 
			
				if(aItems[i]["photo"] == "")
				{
					aItems[i]["photo"] = "http://repos.imanager.nl/transparent.gif";
				}
			
				document.getElementById('content').innerHTML += "<div class=\"persoon\"><div id='" + BoxId + "' class=\"bol\" onmouseover=\"switchStyle(this.id, true);showDiv('"+ BalloonId +"');changeImage('person','" + aItems[i]["photo"] + "')\" onmouseout=\"switchStyle(this.id, false);hideDiv('" + BalloonId + "');\"   onclick=\"parent.location.href='" + RedirectUrl + "';\" style='visibility:visible;position:absolute;left:"+rndom_left+"px; top:"+rndom_top+"px; width: "+subboxwidth+"px; height: "+subboxheight+"px; display: block;'>"+ aItems[i]["name"] +"</div>";
				document.getElementById('content').innerHTML += "<div id='" + BalloonId + "' class=\"ballon\" onmouseover=\"showDiv(this.id);\" onmouseout=\"hideDiv(this.id);\" style=\"position:absolute;left:"+(rndom_left)+"px; top:"+(rndom_top+65)+"px; \"><div class=\"ballon_txt\">"+ aItems[i]["text"] +"</div></div></div>";
			}	
		}			
	}		
	return counter;
}

function ValidateBox(bleft, btop)
{
	for(var i = 0; i < aLeftPos.length; i++) {
		if(((bleft >= aLeftPos[i]) && (bleft <= (aLeftPos[i] + subboxwidth))) || (((bleft + subboxwidth) >= aLeftPos[i]) && ((bleft + subboxwidth) <= (aLeftPos[i] + subboxwidth)))) {
			if(((btop >= aTopPos[i]) && (btop <= (aTopPos[i] + subboxheight))) || (((btop + subboxheight) >= aTopPos[i]) && ((btop + subboxheight) <= (aTopPos[i] + subboxheight)))) {
				return false;
			}
		}
	}
	return true;
}


