
var x,y,mgals,url;
var id = 1;

document.onscroll=getMousePos;
document.onmousemove=getMousePos;
document.onkeyup=getMousePos;

function getDir(){
	num = (Math.floor((id)/1000))*1000;
	return num.toFixed(0);
}

function show_mini(obj,n,u){
  	if(mgals){
		change('http://old.sexaben.dk/images/wait.gif','mimg');
		url=u;
		id=n;
		change('http://old.sexaben.dk/tb/'+getDir()+'/m'+n+'.jpg','mimg');

		if ((x + 250) > document.body.clientWidth) {
			mgals.left = document.body.clientWidth-250;
		}
		else {
			mgals.left = x;
		}
		mgals.top = y+20;
		mgals.display="inline";
	}
  	return false;
}

function show_mini1(obj,n,u){
  	if(mgals){
		change('http://old.sexaben.dk/images/wait.gif','mimg');
		url=u;
		id=n;
		change('http://old.sexaben.dk/tb/'+getDir()+'/m'+n+'.jpg','mimg');

		if ((x + 250) > document.body.clientWidth) {
			mgals.left = document.body.clientWidth-250;
		}
		else {
			mgals.left = x;
		}
		mgals.top = y;
		mgals.display="inline";
	}
}

function getMousePos(e){
	if (navigator.appName == "Microsoft Internet Explorer") {
		x=event.x+document.body.scrollLeft;
		y=event.y+document.body.scrollTop;	
		document.getElementById(comdiv).style.top = document.body.scrollTop+5; // commercial scroll
	} else {
		x=e.pageX;y=e.pageY;	
		document.getElementById(comdiv).style.top = window.pageYOffset +5; // commercial scroll
	}
}

function change(picurl, field){
	if(document.getElementById){
		obj = document.getElementById(field);
	}
	else if(document.all){
		obj = document.all[field];
	}
	else{
		obj = null;
	}
	if(obj != null){
		obj.src = picurl;
	}
}

function load(){
	mgals=document.getElementById('mgals').style;
}

function open_gal(){
	window.open(url);
}

function close_gal(){
  	if(mgals){
  		change('http://old.sexaben.dk/images/wait.gif','mimg');
		mgals.display="none";
	}
}