document.writeln('<div id="minidiv" class="mapprofil" style="z-index:4; visibility: hidden; position: absolute;" onMouseOut="if (mLeave(this, event)) { hideminidiv();}"></div>');

var mini_div = document.getElementById("minidiv");

var maxWidth = 135;
var tekst;
var url;

var pl 	= null;
var pt	= null;

var obj;
var coors 		= new Array(2);
var element 	= null;
var popup_type 	= null;

function dsp(id, sex, username, picture, myobj)
{ 
	setMini(id, sex, picture, username); // make visible
}

function setMini(id, sex, picture, username, seen, age){
	
	if (picture.length <=1)
     picture = "nopicture" + sex;
	
	linkText = "<div onClick=\"javascript:window.open('visprofil.php?id=" + id + "','','toolbar=no,location=no,status=yes,scrollbars=yes,left=0,top=0,width=868,height=700');\" style=\"cursor: hand;\"\">";
	Text = linkText + "<img border='0' src='images/profiles/tiny/" + picture + ".jpg' alt='Åbn " + username + "&rsquo;s profil'></div>";
	s = "";
	if ( sex==0 )
	s = "s";

	mini_div.style.top 		=  posy - 34 + 'px'; // use mouse coordinates
	mini_div.style.left 		= posx - 34 + 'px';
	mini_div.innerHTML 		= "<center>" + Text + "</center>";
	mini_div.style.visibility 	= 'visible';
}


// bestemmer når div tag forlades med mus
function mLeave (element, evt) {
	if (typeof evt.toElement != 'undefined' && typeof element.contains != 'undefined') {
		return !element.contains(evt.toElement);
	} else if (typeof evt.relatedTarget != 'undefined' && evt.relatedTarget) {
		return !contains(element, evt.relatedTarget);
	}
}

function contains (container, containee) {
  while (containee) {
    if (container == containee) {
      return true;
    }
    containee = containee.parentNode;
  }
  return false;
}

// lukker popup hvis man kommer uden for visse koordinater
function check_coordinates(){
	
	if (popup_type == "profile_popup") {
		
		if ((posx + 27) < pl) {
			hideminidiv();
		}
		if ((posy + 12 ) < pt) {
			hideminidiv();
		}
		if (posx > (pl + 224)) {
			hideminidiv();
		}
		if (posy > (pt + 120)) {
			hideminidiv()
		}
	}	
}

// skjul div
function hideminidiv() {

	var element = document.getElementById("minidiv");
	if (element.style) {
		element.style.visibility = 'hidden';
	}
}




