//*******************
// SET BANNER HEIGHT
//*******************

function SetBannerHeight(){
	var height = Math.floor(document.getElementById('mid').offsetHeight / 3);
	document.getElementById('banner1').style.height = height +'px';
	document.getElementById('banner2').style.height = height +'px';
	document.getElementById('banner3').style.height = height +'px';
}


function inpFocus(obj, stdText) {
 if (obj.value == stdText) {
    obj.value = '';
 }
}

function inpBlur(obj, stdText) {
 if (obj.value == '') {
    obj.value = stdText;
 }
} 


/************************
            * 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.top = '0px';
    tmp.style.left = '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.body.clientHeight - boxh) / 2);    
    ymargin = (ymargin > 0 ? ymargin : 0);
    
    var tmp2 = document.createElement('div');
    tmp2.id = 'overlayDivContent';
    tmp2.style.top = ((window.pageYOffset || document.documentElement.scrollTop || 0) + ymargin) + "px";
    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=no></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!');
    }
}
