// JavaScript Document
function hideIMG(){
   var d=$('movingImg')
   if (d){
     d.style.display='none'
     d.style.left='-400px'
    }
  if (!savedTarget) document.onmousemove=''

}
function imgOnload() { 
   document.imgL.width=document.curW
   document.imgL.height=document.curH
 }
function toonIMG(w,h,img,id) { if (w==0 || savedTarget) return
    var img_src='http://www.fotografie.nl/'+img
    document.curW=w; document.curH=h; document.fotoId=id
    var div=$('movingImg')
    if  (!div) return
    document.imgL=div.getElementsByTagName('img')[0]
    if (document.imgL.src!=img_src){
	   document.imgL.src=img_src;
       document.imgL.width=1
       document.imgL.height=1
	   }
    document.imgL.onload=imgOnload
  	document.onmousemove=followmouse;
}
function followmouse(e){
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight)+100 : Math.max(document.body.offsetHeight, window.innerHeight)
    docheight=getDocHeight()
    var dx=30
    var dy=-150
	if (typeof (e) != "undefined"){
			xcoord = e.pageX +dx; 
			if (xcoord+document.curW+20>docwidth) xcoord=e.pageX-document.curW-dx
			ycoord = e.pageY +dy
			if (ycoord+document.curH>docheight) ycoord=e.pageY-document.curH-dy
		}
	else if (typeof (window.event) != "undefined"){
			xcoord = event.clientX +dx;
            if (xcoord+document.curW+20>docwidth) xcoord = event.clientX-document.curW -dx
			ycoord = event.clientY+truebody().scrollTop +dy;
            if (ycoord+document.curH+40-truebody().scrollTop>docheight) ycoord=docheight-document.curH-40+truebody().scrollTop
	}
var xc0=xcoord

	var div=$('movingImg')
	div.style.left=xcoord+"px"
	div.style.top=ycoord+"px"
    div.style.display='block';
}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function getDocHeight(){
	return (document.all? Math.min(getTrueBody().scrollHeight, getTrueBody().clientHeight) : Math.min(window.innerHeight));
}

function getTrueBody(){
	return ( (!window.opera && document.compatMode && document.compatMode!="BackCompat") || window.opera)? document.documentElement : document.body
}


