

var i=1;
var boxOpen=false;

function hoi(){






var embeded = document.getElementsByTagName("a");
for (var i=0,l=embeded.length,parent,embed,before,after; i<l; i++)
{
  if(embeded[i].rel=="lightbox"){

//    embeded[i].Attributes.Add("onClick", "jaj()");[

embeded[i].onclick = function a(){
//alert(pageWidth+'x'+pageHeight);

//alert('nikka');
iLoad(embeded[i].href);
var pageHeight = (document.height || document.body.offsetHeight);
var pageWidth = (document.width || document.body.offsetWidth);

//clientWidth=document.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth);
//clientHeight=document.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);

//alert(pageWidth+'x'+pageHeight);


var backgroundDiv= document.createElement("div");
//backgroundDiv.id = "backgroundDiv"+elementid;
//divTag.setAttribute("align","center");
//divTag.style.margin = "0px auto";
//backgroundDiv.className = styleclass+"Menu";
 
//backgroundDiv.style.zIndex = zindex;

backgroundDiv.style.left="0px";
backgroundDiv.style.top="0px";
backgroundDiv.style.backgroundColor="#000000";
backgroundDiv.style.opacity=0.5;
backgroundDiv.style.filter="alpha(opacity=50)";

backgroundDiv.style.width=pageWidth+"px";
backgroundDiv.style.height=pageHeight+"px";

backgroundDiv.style.position="absolute";



document.body.appendChild(backgroundDiv);




return false;
}

  }

}

}

function hideFlash()
{
var embeded = document.getElementsByTagName("embed");
for (var i=0;i<embeded.length; i++)
{
embeded[i].style.visibility = 'hidden';

}

var embeded = document.getElementsByTagName("object");
for (var i=0;i<embeded.length; i++)
{
embeded[i].style.visibility = 'hidden';

}

}


function showFlash()
{
var embeded = document.getElementsByTagName("embed");
for (var i=0;i<embeded.length; i++)
{
embeded[i].style.visibility = 'visible';

}

var embeded = document.getElementsByTagName("object");
for (var i=0;i<embeded.length; i++)
{
embeded[i].style.visibility = 'visible';

}

}


function iLoad(isrc) {
var oImg = new Image();
oImg.src = isrc;
if (oImg.complete) {
window.alert(oImg.src + ' ' + oImg.width + ' x ' + oImg.height);
}
else {
window.setTimeout('iLoad(imgsrc)', 1000);
}
}


function jaj(a){
alert(a);

}

function showYoutube(videoid){

var pageHeight = (document.height || document.body.offsetHeight);
var pageWidth = (document.width || document.body.offsetWidth);
hideFlash();

var backgroundDiv= document.createElement("div");
backgroundDiv.id="backgroundDiv";
backgroundDiv.style.left="0px";
backgroundDiv.style.top="0px";
backgroundDiv.style.backgroundColor="#000000";
backgroundDiv.style.opacity=0.5;
backgroundDiv.style.filter="alpha(opacity=50)";

backgroundDiv.style.width=pageWidth+"px";
backgroundDiv.style.height=pageHeight+"px";

backgroundDiv.style.position="absolute";






document.body.appendChild(backgroundDiv);


text='<div style="margin-left: 8px;"><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/'+videoid+'&hl=nl&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+videoid+'&hl=nl&fs=1&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div>';



showBox(480,385,'Video',text);

}

function imgshow(imgobj,description){
if(!boxOpen){
hideFlash();
boxOpen=true;
pageHeight = (document.height || document.body.offsetHeight);
pageWidth = (document.width || document.body.offsetWidth);


var backgroundDiv= document.createElement("div");
backgroundDiv.id="backgroundDiv";
backgroundDiv.style.left="0px";
backgroundDiv.style.top="0px";
backgroundDiv.style.backgroundColor="#000000";
backgroundDiv.style.opacity=0.5;
backgroundDiv.style.filter="alpha(opacity=50)";

backgroundDiv.style.width=pageWidth+"px";
backgroundDiv.style.height=pageHeight+"px";

backgroundDiv.style.position="absolute";







document.body.appendChild(backgroundDiv);


var img = document.createElement('img');
img.src=imgobj.href;
if(!img.width){
img.onload = function () { 

//alert(img.width);
//alert(img.src);
imgurl=img.src;
text='<a href="#" onclick="closeBox('+i+');return false;"><img src="'+img.src+'" style="border:0px; margin-left:8px;"></a>';
showBox(img.width,img.height,imgobj.title,text,description);

};
}else{

imgurl=img.src;
text='<a href="#" onclick="closeBox('+i+');return false;"><img src="'+img.src+'" style="border:0px; margin-left:8px;"></a>';
showBox(img.width,img.height,imgobj.title,text,imgobj.alt);


}



}

}



function showBox(width, height, title, text, description){
//alert(width+' '+height);


pageHeight = (document.height || document.body.offsetHeight);
pageWidth = (document.width || document.body.offsetWidth);

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

clientHeight=document.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight);

var imgDiv= document.createElement("div");
imgDiv.id="boxDiv";
imgDiv.style.left=(pageWidth-width)/2+"px";

imgDivTop=yScroll+(clientHeight-(height+74))/2;

if(imgDivTop<yScroll)
imgDivTop=yScroll;

if(imgDivTop<10)
imgDivTop=10;

imgDiv.style.top=imgDivTop+"px";

imgDiv.style.backgroundColor="#ffffff";


imgDiv.style.width=(width+16)+"px";
imgDiv.style.height=(height+54)+"px";

imgDiv.style.position="absolute";
imgDiv.innerHTML='<h2 style="margin-top:0px; padding-left:8px;">'+title+'</h2><a href="#" onclick="closeBox('+i+');return false;"><img src="/close.gif" style="position: absolute; left:'+(width-8)+'px; top: 8px;" border=0></a>'+text;

document.body.appendChild(imgDiv);

if(description){
var descriptionDiv= document.createElement("div");
descriptionDiv.id="descriptionDiv";
descriptionDiv.style.left=(pageWidth-width)/2+"px";
descriptionDiv.style.top=imgDivTop+(height+54)+"px";
descriptionDiv.style.position="absolute";
descriptionDiv.style.backgroundColor="#ffffff";
descriptionDiv.style.width=(width)+"px";
descriptionDiv.style.paddingLeft="8px";
descriptionDiv.style.paddingRight="8px";
descriptionDiv.style.paddingBottom="8px";

descriptionDiv.innerHTML=description;
document.body.appendChild(descriptionDiv);
i++;
}

return true;
}

function closeBox(){
//  var d = document.getElementById('backgroundDiv');
 // var olddiv = document.getElementById('backgroundDiv'+j);
  document.body.removeChild(document.getElementById('backgroundDiv'));
if(dd=document.getElementById('descriptionDiv')) 
 document.body.removeChild(dd);
  document.body.removeChild(document.getElementById('boxDiv'));
boxOpen=false;
showFlash();

}

function showMap(latitude,longitude,zoom){

if(!boxOpen){
hideFlash();
boxOpen=true;
pageHeight = (document.height || document.body.offsetHeight);
pageWidth = (document.width || document.body.offsetWidth);


var backgroundDiv= document.createElement("div");
backgroundDiv.id="backgroundDiv";
backgroundDiv.style.left="0px";
backgroundDiv.style.top="0px";
backgroundDiv.style.backgroundColor="#000000";
backgroundDiv.style.opacity=0.5;
backgroundDiv.style.filter="alpha(opacity=50)";

backgroundDiv.style.width=pageWidth+"px";
backgroundDiv.style.height=pageHeight+"px";

backgroundDiv.style.position="absolute";







document.body.appendChild(backgroundDiv);
    var map;


text='<div id="gmap" style="width:800px; height: 500px; margin-left: 8px;"></div>';
if(showBox(800,500,"kaartje",text)){


      map = new GMap2(document.getElementById("gmap"));




	//map.enableScrollWheelZoom();
//	map.enableGoogleBar();
//	map.enableInfoWindow();
	map.addControl(new GLargeMapControl());
if(!latitude)
latitude=41.405317;

if(!longitude)
longitude=2.176829;

if(!zoom)
zoom=6;

map.setCenter(new GLatLng(latitude,longitude),zoom);


}




}

}