	
	var topleft = new Array();
	var topright = new Array();
	var bottomleft = new Array();
	var bottomright = new Array();

	var x = 0;
	var y = 0;
	var activeId = 0;
	var activeType = '';

	function closeOthers()
    {
        var elements = document.getElementsByTagName("DIV");

        for(i=0;i<elements.length;i++)
        {
            if(elements[i].id.indexOf("popupContainer")!=-1)
                elements[i].style.display = 'none';
        }
		activeId=0;
		activeType='';
    }



    function showPopup(id,width,height,type)
    {
		
		if(id!="")
        {
			//Stel actieve div in
			activeId = id;
			activeType = type;

			width = width+10;

			// Zoek popup element
            var popup = document.getElementById("popupContainer"+type+id);

			// Zoek popupText div binnen popup en stel de breedte bij om pixel verschil met IE te compenseren.
            if(document.all)
            {
                var popupText = popup.childNodes[1];
                popupText.style.width = (width-2)+'px';
				var textDiv = popupText.childNodes[0];
            }
            else
            {
                var popupText = popup.childNodes[3];
                popupText.style.width = (width)+'px';
				var textDiv = popupText.childNodes[1];
            }

			// Initialiseer container
            popup.style.display = 'block';
            popup.style.width = width+'px';	
            popup.style.height = height+'px';
            popupText.style.height = (height-50)+'px';
			textDiv.style.height = (height-66)+'px';
      
			// Bepaal left en top positie van div box 
            var left = (screen.width/2) - (width/2);
            var top = document.body.scrollTop + (height/2);
            popup.style.left = left+'px';
            popup.style.top = top+'px';

			// Bepaal coordinaten van div box
			topleft["x"] = left;
			topleft["y"] = top;
			topright["x"] = left + width;
			topright["y"] = top;
			bottomleft["x"] = left;
			bottomleft["y"] = (topleft["y"] + height);
			bottomright["x"] = (top + height)+width;
			bottomright["y"] = (top + height);
			//alert(topleft["x"]+','+topleft["y"]+' '+topright["x"]+','+topright["y"]+' '+bottomleft["x"]+','+bottomleft["y"]+' '+bottomright["x"]+','+bottomright["y"]);
        }
    }

    function closePopup(id,type)
    {
        var popup = document.getElementById("popupContainer"+type+id);
        popup.style.display = 'none';
		activeId=0;
		activeType='';
    }

	function getCoords(event)
	{
		x = event.clientX;
		y = event.clientY;
	}

	function closeOthersBounds(event)
	{
			if(document.all)
			{
				x = event.screenX;
				y = event.screenY;
			}
			else
			{
				x = event.pageX;
				y = event.pageY;
			}

			//alert(topleft["x"]+','+topleft["y"]+' '+topright["x"]+','+topright["y"]+' '+bottomleft["x"]+','+bottomleft["y"]+' '+bottomright["x"]+','+bottomright["y"]);
			if(x<topleft["x"] || y>bottomleft["y"] || y<topleft["y"] || y<topright["y"] || x>topright["x"])
			{
				var elements = document.getElementsByTagName("DIV");

				for(i=0;i<elements.length;i++)
				{
					if(elements[i].id.indexOf("popupContainer")!=-1)
					{
						if(elements[i].id!=("popupContainer"+activeType+activeId))
						{
							elements[i].style.display = 'none';
						}
					}

				}
			}
		

		activeId=0;
	}