/*
window.onload = function() {

LoadNotablok();
getMouseXY(); 
}

var xPosit;
var yPosit;
var xEnd;
var yEnd;
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page*/

function getX(obj) {
	var xPos = obj.offsetLeft;
	var tempEl = obj.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
  		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getY(obj) {
    var yPos = obj.offsetTop;
    tempEl = obj.offsetParent;
    while (tempEl != null) { 
	    yPos += tempEl.offsetTop;
	    tempEl = tempEl.offsetParent;
    }
    return yPos;
}

function AddToNoteblok(ide) {

	var strdivname = 'titel' + ide;
	var strFotoname = 'img' + ide; 
	
	document.getElementById('floatdiv').innerHTML =  document.getElementById(strFotoname).innerHTML + '<br/>' + document.getElementById(strdivname).innerHTML;

	document.getElementById('floatdiv').style.display = '';
	

	xPosit = getX(document.getElementById(ide));
	yPosit = getY(document.getElementById(ide));


	document.getElementById(ide).innerHTML = 'Toegevoegd';
	document.getElementById(ide).onclick = function() {alert('Dit zoekertje is al toegevoegd aan uw notablok.');}
	
	
	yPosit = yPosit - 50;
	xPosit = xPosit - 50;
	document.getElementById('floatdiv').style.left =  xPosit + 'px';
	document.getElementById('floatdiv').style.top =  yPosit + 'px';
	
	xEnd = getX(document.getElementById('notainhoud'));
	yEnd = getY(document.getElementById('notainhoud'));

	var sp = xPosit + ":" + yPosit;
	var ep = xEnd + ":" + yEnd;

	the_coords = new Array(sp,ep);
	getAnchors(0); 

	
	var url    = '/controls/ucAjaxNoteblokhandler.aspx';
	var rand   = Math.random(9999);
	var pars   = '?ide=' + ide + '&rand=' + rand;
	var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoadNotablok, onComplete: addedtonotablok} );

	//return false;
   			
}

function moveDiv() {
	var xPosit = 300;
	var xEnd = 700;
	while (xPosit <= xEnd) {
		xPosit = xPosit - 1;
		document.getElementById('floatdiv').style.left =  xPosit + 'px';
		
	}

}

function showLoadNotablok() {

}

function addedtonotablok(originalRequest) {
    var resp = originalRequest.responseText;	
    document.getElementById('notablokloading').style.display = '';
    LoadNotablok();
    //alert(resp);
}

function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}

function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}
var errorLoadingImage = false;
var obj;
var img;
var mouseLeaveOnImage = false;
var imagebla = null;
var maxWidth = 400;
var maxHeight = 300;
function preloadImage() {
    errorLoadingImage = false;
    var checkimg = img.toLowerCase().indexOf('no_pict_kl');
    if (checkimg == -1) {
        checkimg = img.toLowerCase().indexOf('logo_');
    }
    if (checkimg == -1) {
        checkimg = img.toLowerCase().indexOf('but_film_klein');
    }
    if (checkimg <= -1) {
        img = img.replace('/thumbnail', '');
        img = img.replace('_thumb', '');
        img = img.replace('/thumb', '/1');
        imagebla = document.createElement("img");
        imagebla.onerror = function(evt) {
            errorLoadingImage = true;
        }
        imagebla.src = img;
        setTimeout('showPicAfterPreload()', 300);
    }
}
function showpic(mObj, mImg) {
    mouseLeaveOnImage = false
    obj = mObj;
    img = mImg;
    preloadImage();
}
function getImageSizeString() {
    var sizeString = '';
    if ((imagebla.height > 0 && imagebla.width > 0) && (imagebla.height >= maxHeight || imagebla.width >= maxWidth)) {
        var myAspectRatio = imagebla.height / imagebla.width;
        var myHeight = imagebla.height;
        var myWidth = imagebla.width;
        if (myHeight >= maxHeight) {
            if (myWidth >= maxWidth) {
                if (myAspectRatio >= 1) {
                    myHeight = maxHeight;
                    myWidth = myHeight / myAspectRatio;
                }
                else {
                    myWidth = maxWidth;
                    myHeight = myWidth * myAspectRatio;
                }
            }
            else {
                myHeight = maxHeight;
                myWidth = myHeight / myAspectRatio;
            }
        }
        else {
            if (myWidth >= maxWidth) {
                myWidth = maxWidth;
                myHeight = myWidth * myAspectRatio;
            }
        }
        imagebla.height = myHeight;
        imagebla.width = myWidth;
        sizeString = ' height ="' + myHeight + '" width="' + myWidth + '"';
    }
    return sizeString;
}
function showPicAfterPreload() {
    if (!errorLoadingImage && !mouseLeaveOnImage) {
        
        document.getElementById('picdiv').innerHTML =
                '<TABLE cellSpacing=0 cellPadding=0 border=0>' +
                '<TBODY>' +
                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/ballonboven.gif); WIDTH: 50px;BACKGROUND-REPEAT: no-repeat;background-position:right bottom; HEIGHT: 30px" ></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/topborder.gif); background-position:bottom;BACKGROUND-REPEAT: repeat-x; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RTC.gif); BACKGROUND-REPEAT: no-repeat;background-position:left bottom;WIDTH: 20px; HEIGHT: 20px"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/leftborder.gif); background-position:right top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '<TD background-color:#ffffff;><IMG id="popuppic" src="' + img + '"' + getImageSizeString() + '></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/rightborder.gif); background-position:left top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/LBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:right top; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/bottomborder.gif);background-position:top; BACKGROUND-REPEAT: repeat-x; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:left top; HEIGHT: 10px"></TD>' +
                        '</TR>' +
                    '</TBODY>' +
                '</TABLE>';
        xPosit = getX(document.getElementById(obj));
        yPosit = getY(document.getElementById(obj));

        yPosit += 30;
        xPosit += 80;
        document.getElementById('picdiv').style.display = 'block';
        document.getElementById('picdiv').style.zIndex = 100002;

        var w = document.getElementById('popuppic').offsetWidth;
        var h = document.getElementById('popuppic').offsetHeight;
        if (imagebla.height > 0 && imagebla.width > 0) {
            w = imagebla.width;
            h = imagebla.height;
        }
        var div = document.getElementById('divDebug');

        if ((yPosit + h) > (f_scrollTop() + f_clientHeight())) {
            repositionpopuppic(img);
        }
        if ((xPosit + w) > (f_scrollLeft() + f_clientWidth())) {
            repositionpopuppic(img);
        }
        if (h == 0 || h == 24 || h == 30) { //24 FF, 30 IE is the size of the standard loading image
            setTimeout('repositionpopuppic(\'' + img + '\',0)', 5);
        }
        /* debug messages */
        //div.innerHTML += 'h='+h+'<br/>';
        //div.style.top = f_scrollTop() + 100;

        document.getElementById('picdiv').style.left = xPosit + 'px';
        document.getElementById('picdiv').style.top = yPosit + 'px';
    }
    else {
        hidePicWithoutMouse();
    }
}
function repositionpopuppic(img, attempts) {
    if(attempts>200){return;}//don't try for more than 201 times = 1000 milliseconds for the image to load
    var div = document.getElementById('divDebug');
    var w = document.getElementById('popuppic').offsetWidth;
    var h = document.getElementById('popuppic').offsetHeight;
    if (imagebla.height > 0 && imagebla.width > 0) {
        w = imagebla.width;
        h = imagebla.height;
    }
    /* debug messages */
    //div.innerHTML += 'called reposition where h='+h+'<br/>';
    //div.style.top = f_scrollTop() + 100;

    if(h==0 || h==24 || h==30){
        setTimeout('repositionpopuppic(\''+img+'\',\''+(attempts*1+1)+'\')',5);
    }
    var boven = false;
    var links = false;
    var inset = w + 50 + 30 + 20 + 50; //50px voor ballon,30px voor thumbnail, 20px voor border,50 px correctie(waarom?)
    if ((xPosit + inset) > (f_scrollLeft() + f_clientWidth())) {
        if (xPosit >= inset) {
            xPosit -= inset;
            links = true;
        }
    }
    if ((yPosit + h) > (f_scrollTop() + f_clientHeight())) {
        if (yPosit - h - 30 > 0) {
            yPosit -= h + 30;
            boven = true;
        }
    }
    if (links && boven) {
        document.getElementById('picdiv').innerHTML =
        '<TABLE cellSpacing=0 cellPadding=0 border=0>'+
            '<TBODY>' +
                '<TR>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/LTC.gif);BACKGROUND-REPEAT: no-repeat;background-position:right bottom; WIDTH: 20px; HEIGHT: 20px"></TD>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/topborder.gif);background-position:bottom; BACKGROUND-REPEAT: repeat-x; HEIGHT: 20px"></TD>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/RTC.gif); BACKGROUND-REPEAT: no-repeat;background-position:left bottom;WIDTH: 20px; HEIGHT: 20px"></TD>' +
                '</TR>' +

                '<TR>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/leftborder.gif); background-position:right top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                '<TD background-color:#ffffff;><IMG id="popuppic" src="' + img + '"' + getImageSizeString() + '></TD>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/rightborder.gif); background-position:left top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                '</TR>' +

                '<TR>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/LBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:right top; HEIGHT: 10px"></TD>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/bottomborder.gif); background-position:top; BACKGROUND-REPEAT: repeat-x; HEIGHT: 10px"></TD>' +
                '<TD style="BACKGROUND-IMAGE: url(/Images/ballononderrechts.gif); WIDTH: 50px;BACKGROUND-REPEAT: no-repeat;background-position:left top; HEIGHT: 30px" ></TD>' +
                '</TR>' +

            '</TBODY>' +
        '</TABLE>';
    }
    else {
        if (links) {
            document.getElementById('picdiv').innerHTML =
                '<TABLE cellSpacing=0 cellPadding=0 border=0>'+
                    '<TBODY>' +
                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/LTC.gif);BACKGROUND-REPEAT: no-repeat;background-position:right bottom; WIDTH: 20px; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/topborder.gif); BACKGROUND-REPEAT: repeat-x; background-position:bottom; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/ballonbovenrechts.gif); WIDTH: 50px;BACKGROUND-REPEAT: no-repeat;background-position:left bottom; HEIGHT: 30px" ></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/leftborder.gif); background-position:right top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '<TD background-color:#ffffff;><IMG id="popuppic" src="' + img + '"' + getImageSizeString() + '></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/rightborder.gif); background-position:left top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/LBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:right top; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/bottomborder.gif); background-position:top;BACKGROUND-REPEAT: repeat-x; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:left top; HEIGHT: 10px"></TD>' +
                        '</TR>' +

                    '</TBODY>' +
                '</TABLE>';
        }
        else {
            if (boven) {
                document.getElementById('picdiv').innerHTML =
                '<TABLE cellSpacing=0 cellPadding=0 border=0>'+
                    '<TBODY>' +
                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/LTC.gif);BACKGROUND-REPEAT: no-repeat;background-position:right bottom; WIDTH: 20px; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/topborder.gif); background-position:bottom; BACKGROUND-REPEAT: repeat-x; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RTC.gif); BACKGROUND-REPEAT: no-repeat;background-position:left bottom;WIDTH: 20px; HEIGHT: 20px"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/leftborder.gif); background-position:right top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '<TD background-color:#ffffff;><IMG id="popuppic" src="' + img + '"' + getImageSizeString() + '></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/rightborder.gif); background-position:left top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/ballononder.gif); WIDTH: 50px;BACKGROUND-REPEAT: no-repeat;background-position:right top; HEIGHT: 30px" ></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/bottomborder.gif); background-position:top;BACKGROUND-REPEAT: repeat-x; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:left top; HEIGHT: 10px"></TD>' +
                        '</TR>' +
                    '</TBODY>' +
                '</TABLE>';
            }
            else {
                '<TABLE cellSpacing=0 cellPadding=0 border=0>'+
                '<TBODY>' +
                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/ballonboven.gif); WIDTH: 50px;BACKGROUND-REPEAT: no-repeat;background-position:right bottom; HEIGHT: 30px" ></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/topborder.gif); background-position:bottom;BACKGROUND-REPEAT: repeat-x; HEIGHT: 20px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RTC.gif); BACKGROUND-REPEAT: no-repeat;background-position:left bottom;WIDTH: 20px; HEIGHT: 20px"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/leftborder.gif); background-position:right top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '<TD background-color:#ffffff;><IMG id="popuppic" src="' + img + '"' + getImageSizeString() + '></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/rightborder.gif); background-position:left top;WIDTH: 20px; BACKGROUND-REPEAT: repeat-y"></TD>' +
                        '</TR>' +

                        '<TR>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/LBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:right top; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/bottomborder.gif);background-position:top; BACKGROUND-REPEAT: repeat-x; HEIGHT: 10px"></TD>' +
                        '<TD style="BACKGROUND-IMAGE: url(/Images/RBC.gif); WIDTH: 20px; BACKGROUND-REPEAT: no-repeat;background-position:left top; HEIGHT: 10px"></TD>' +
                        '</TR>' +
                    '</TBODY>' +
                '</TABLE>';
            }
        }
    }
    document.getElementById('picdiv').style.left =  xPosit + 'px';
    document.getElementById('picdiv').style.top =  yPosit + 'px';
}

function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
function hidePicWithoutMouse() {
    document.getElementById('picdiv').style.display = 'none';
}
//This function is called upon the mouseleave of the img.
function hidepic() {
    mouseLeaveOnImage = true
    hidePicWithoutMouse();
}

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function getH() {

alert('ja');

}


var mousex = 0;
var mousey = 0;



function getMouseXY(e) // works on IE6,FF,Moz,Opera7
{ 
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)

  if (e)
  { 
    mousey = e.clientY;
    mousex = e.clientX;
  }
}

