/***************************** 
	ROLLOVER MENU 
*****************************/
function doOver(id,url){
	object = document.getElementById(id);
	object.src=url ;

	}
/***************************** 
	BOOKMARK 
*****************************/
function bookmark(url,title){
	if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) {
	window.external.AddFavorite(url,title);
	} else if (navigator.appName == "Netscape") {
	window.sidebar.addPanel(title,url,"");
	} else {
	alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
	}
}

/***************************** 
	LIGHTBOX FUNCTIES 
*****************************/

function addOverlay(boxw, boxh) {
    var body = document.getElementsByTagName("body")[0];
    var tmp = document.createElement('div');
    tmp.id = 'overlayDiv';
    tmp.onclick = function() {
        removeLightbox();
    };
    tmp.style.left = '0px';
    tmp.style.top = '0px';
    tmp.style.cursor = 'pointer';
    tmp.style.position = 'absolute';
    tmp.style.height = getPageHeight() + "px";
    tmp.style.width = '100%';
    tmp.style.backgroundColor = '#000';
    tmp.style.zIndex = 200;
    body.appendChild(tmp);
    changeOpac(70, 'overlayDiv');

    var ymargin = Math.floor((document.documentElement.clientHeight - 300) / 2);    
    ymargin = (ymargin > 0 ? ymargin : 0);
    var tmp2 = document.createElement('div');
    tmp2.id = 'overlayDivContent';
    tmp2.style.top = '100px';

    tmp2.style.left = (((window.pageXOffset || document.documentElement.scrollWidth || 0) - boxw) / 2) + "px";
    tmp2.style.position = 'absolute';
    tmp2.style.width = boxw + "px";
    tmp2.style.backgroundColor = '#fff';
    tmp2.style.height = boxh + "px";
    tmp2.style.border = '0px';
    tmp2.style.zIndex = 210;
    body.appendChild(tmp2);
}
function removeLightbox() {
    var body = document.getElementsByTagName("body")[0];
    body.removeChild(getElement('overlayDiv'));
    body.removeChild(getElement('overlayDivContent'));
}
function lightbox(boxw, boxh, url, data) {
    addOverlay(boxw, boxh); // divs dr in stoppen
    var content = (url ? "<iframe src='" + url + "' width='"+boxw+"px' height='"+boxh+"px'  border='' style='border:0px;' FRAMEBORDER=0 SCROLLING=auto></iframe>": data);
    getElement('overlayDivContent').innerHTML = "<div id='overlayDivClose'><a onclick='removeLightbox();'></a></div><div id='overlayDivInnerContent'></div>";
    getElement('overlayDivInnerContent').innerHTML = content;
    return false;
}

function getPageHeight() {
    if (window.innerHeight && window.scrollMaxY) { // Firefox
        yWithScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac
        yWithScroll = document.body.scrollHeight;
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
        yWithScroll = document.body.offsetHeight;
    }
    return yWithScroll;
}

function changeOpac(opacity, id) {
    var object = getElement(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function getElement(id) {
    if (document.getElementById(id)) {
        return document.getElementById(id);
    } else {
        alert('Element ' + id + ' is niet gevonden!');
    }
}

