﻿
//
//Change fontsize.
//
function ChangeFontSize(size)
{
    //alert(size);
    var masterBody = document.getElementById("ctl00_MasterBody");
    masterBody.style.fontSize = size + "px";
    return true;
}

function GoBack()
{
    // Back button
    history.go(-2); return true;
}

//// Functies gekopieerd uit icmlib.js - en daarna verbouwd  ////

function setHeightMain(topRoom, bottomRoom) {
    if (topRoom == null) {
        topRoom = 0;
    }
    if (bottomRoom == null) {
        bottomRoom = 0;
    }
    var _content = mdlGet("maincontent");
    var height = mdlInt(mdlGetClientHeight() - topRoom - bottomRoom);
    if (_content != null) {
        if (height > 200) { _content.style.height = height + "px"; }
        AdjustWidth(); 
    }
    else { alert('No `maincontent` was found.') }
    return true;
}

function setHeightRight(topRoom, bottomRoom) {
    if (topRoom == null) {
        topRoom = 0;
    }
    if (bottomRoom == null) {
        bottomRoom = 300;
    }
    var _content = mdlGet("maincontentright");
    var height = mdlInt(mdlGetClientHeight() - topRoom - bottomRoom);
    if (_content != null) {
        if (height > 200) {
            _content.style.height = height + "px";
        }
    }
    else { alert('No `maincontentright` was found.') }
    return true;
}

function mdlGetClientHeight() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myHeight = document.body.clientHeight;
    }
    return myHeight;
}

function mdlGetClientWidth() {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) == 'number') {
        //Non-IE
        myWidth = window.innerWidth;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
    }
    return myWidth;
}

//by using Masterpages
function mdlGet(object) {
    var clientIdMasterPage  = "ctl00_";

    //var contentobject = clientIdContentPage + object;  //object in de contentPage
    var masterobject  = clientIdMasterPage + object;     //Object in de masterPage
    var contentobject = object;
    
    if (document.all) {
        if (document.all[contentobject]) {
            return (document.all[contentobject]);
        }
        else if (document.all[masterobject]) {
            return (document.all[masterobject]);         
        }
        else {
            return (document.all[object]);
        }
        
    } else if (document.layers) {
        return (document.layers[object])
    } else {
        return (document.getElementById(object))
    }
}

function mdlInt(d_x, d_y) {
    return isNaN(d_y = parseInt(d_x)) ? 0 : d_y;
}

function AdjustWidth() {
    var _content = document.getElementById("mainFrame");
    if (_content != null) {
        var min_width = 900;
        var width = mdlInt(mdlGetClientWidth());
        var mainLft = "10%";
        var mainWdt = "80%";
        var mainRgt = mainLft;

        if (width < min_width) {
            /* indien echt te smal: mainframe fixeren, krijgen we hor.schuifbalken */
            mainLft = "0px";
            mainWdt = min_width + "px";
        } else {if (width < 1200) {
            /* indien niet al te smal: omringende randen versmallen */
            mainLft = ((width - min_width)/2);
            mainRgt = (width - mainLft) + "px";
            mainWdt = (width - 2 * mainLft) + "px";
            mainLft = mainLft + "px";
            }
        }

        if ((_content.style.width != mainWdt) || (_content.style.left != mainLft)) {
            _content.style.left = mainLft;
            _content.style.right = mainRgt;
            _content.style.width = mainWdt;
        }
    }
    return true;
}



