/*
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  NETSCAPE READY MAKEN VAN DE LEERMETHODE
  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  1.
    Mozilla/netscape compatibel maken navigatie

    Gebruik in "incBrand.js in de functie go2IntroScreen() & go2LearningUnit(GUID)

       fr = document.getElementById('groupsAndContent');  // OPLETTEN OF ER NOG PARENT. GEBRUIKT MOET WORDEN
       fr.cols = g_strGroupsMenuWidth + ',*,0';

      IPV

          parent.frames.groupsAndContent.cols = g_strGroupsMenuWidth + ',*,0';

    Dan werkt de navigatie ook in Netscape en Mozilla. Nog een klein detail om ook
    de cursor te wijzigen in een handje niet alleen "cursor:hand;" maar daarbij in
    ook zetten "cursor: hand; cursor: pointer;"  --> hand voor IE en pointer voor
    Netscape.

  2.
    Gebruik bij de EMBED tag van de flash player de property swliveconnect.
    Deze zorgt een connectie vanuit script met het flash object.

  3.
    <!-- PREVENT CACHING IN NETSCAPE. VERY IMPORTANT CAUSE NETSCAPE TENDS TO MANGLE CACHED CODE -->
    <META http-equiv="expires" content="0">
    <META http-equiv="Pragma" content="no-cache">

  4.
    Bij resizen in Netscape wordt pagina opnieuw geladen, maar niet de CSS.
    Oplossing is te vinden in een Javascript-scriptje (vraag Tobias)

  5.
    http://browsercomparison.esmartweb.com/
*/

  var RGB = new Array(256);
  var k = 0;
  var hex = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");

  for (i = 0; i < 16; i++) {
    for (j = 0; j < 16; j++) {
      RGB[k] = hex[i] + hex[j];
      k++;
    }
  }


  function HexToR(h) { return parseInt((cutHex(h)).substring(0,2),16) }
  function HexToG(h) { return parseInt((cutHex(h)).substring(2,4),16) }
  function HexToB(h) { return parseInt((cutHex(h)).substring(4,6),16) }
  function cutHex(h) { return (h.charAt(0)=="#") ? h.substring(1,7) : h}

  // function to make a table background white with an opacity of 50%
  function setBackGColor(strObj) {
    // get values of red, green and blue from the current background
    var docscreen = document.frames['screens'].document;
    var r_bg = HexToR(docscreen.bgColor);
    var g_bg = HexToG(docscreen.bgColor);
    var b_bg = HexToB(docscreen.bgColor);

    var obj = docscreen.getElementById(strObj);

    if (obj == null)  return;

    var opc =0.5;

    // calculate new values of red, green, and blue
    r_bg = Math.floor(((255 - r_bg) * opc) + r_bg);
    g_bg = Math.floor(((255 - g_bg) * opc) + g_bg);
    b_bg = Math.floor(((255 - b_bg) * opc) + b_bg);

    var bgcolor = "#" + RGB[r_bg] + RGB[g_bg] + RGB[b_bg];
    obj.bgColor = bgcolor;
  }

  function writeRoundedBox(content, xCoor, yCoor, width, height) {
    var str = '';
    str += '<DIV style="position:absolute; left:' + xCoor + 'px; top:' + yCoor + 'px;' +
                      ' width:' + width + 'px; height:' + height + 'px;">' +
           '  <TABLE border="0" cellpadding="0" cellspacing="0">' +
           '    <TR>' +
           '      <TD><IMG src="' + g_rootSCOPix + 'round_left_top.gif" width="17" height="17"></TD>' +
           '      <TD class="resultBoxTop">' + spacer(1, 1) + '</TD>' +
           '      <TD><IMG src="' + g_rootSCOPix + 'round_right_top.gif" width="17" height="17"></TD>' +
           '    </TR>' +
           '    <TR>' +
           '      <TD class="resultBoxLeft">' + spacer(1, 1) + '</TD>' +
           '      <TD>' + content + '</TD>' +
           '      <TD class="resultBoxRight">' + spacer(1, 1) + '</TD>' +
           '    </TR>' +
           '    <TR>' +
           '      <TD><IMG src="' + g_rootSCOPix + 'round_left_bottom.gif" width="17" height="17"></TD>' +
           '      <TD class="resultBoxBottom">' + spacer(1, 1) + '</TD>' +
           '      <TD><IMG src="' + g_rootSCOPix + 'round_right_bottom.gif" width="17" height="17"></TD>' +
           '    </TR>' +
           '  </TABLE>' +
           '</DIV>';
    return str;
  }


  function writeRectangleBox(content, xCoor, yCoor, width, height) {
    var str = '';
    str += '<DIV style="position:absolute; left:' + xCoor + 'px; top:' + yCoor + 'px;' +
                      ' width:' + width + 'px; height:' + height + 'px;">' +
           '  <TABLE border="0" cellpadding="0" cellspacing="0">' +
           '    <TR>' +
           '      <TD class="resultBoxRectangle">' + content + '</TD>' +
           '    </TR>' +
           '  </TABLE>' +
           '</DIV>';
    return str;
  }


  function createDiv(id, left, top, width, height, zindex, CSSclass, content, vis, overflow) {
    id       = (id)           ? 'id="'        + id + '"'       : '';
    width    = (width)        ? 'width:'      + width + 'px;'  : '';
    height   = (height)       ? 'height:'     + height + 'px;' : '';
    strClass = (CSSclass)     ? 'class="'     + CSSclass + '"' : '';
    vis      = (vis)          ? vis                            : 'visible';
    strVis   = 'visibility:' + vis + ';';
    overflow = (overflow)     ? 'overflow:'   + overflow + ';' : '';
    zindex   = (zindex != '') ? 'z-index:'    + zindex + ';'   : '';

    var str = '';
    str += '<DIV ' + id + ' ' + strClass + ' style="position:absolute; left:' + left + 'px;' +
                 ' top:' + top + 'px; ' + width + ' ' + height +
                 ' ' + zindex + ' ' + strVis + ' ' + overflow + '"> ' + content +
           '</DIV>';
    return str;
  }


// MATH FUNCTIONS
  Number.seperator = '.';
  Number.prototype.round = function(n) {
    if(!n) return Math.round(this.valueOf());
    for(var i = 0, len = 1; i < n;i++) len *= 10;
    if(!this.valueOf()) var res = len.toString().replace(/1/,'0');
    else var res = Math.round(this.valueOf() * len).toString();
    res = res.slice(0,res.length-n) + Number.seperator + res.slice(res.length-n, res.length);
    if (res.length == n + 1) res = '0' + res;
    return res;
  }
  function round(value, dec) {
    var tmp = new Number();
    tmp = value;
    return tmp.round(dec);
  }


// MISCELLANEOUS
  function generateRandom(seed) {
    return Math.round(Math.random() * seed);
  }


  function getArgs(strURL) {
    var args   = [];
    var strURL = (strURL) ? strURL : self.location.search;
    var query  = strURL.substring(1);
    var pairs  = query.split('&');
    for(var i = 0; i < pairs.length; i++) {
      var pos       = pairs[i].indexOf('=');
      if(pos == -1) continue;
      var argname   = pairs[i].substring(0, pos);
      var val       = pairs[i].substring(pos + 1);
      args[argname] = unescape(val);
    }
    return args;
  }


// DELETES ALL NON ALPHA-NUMERIC CHARACTERS (INCLUDING '_' & '-')
  function makeFScompatible(str) {
    str = str.replace(/[\W\-\_]/g, '');
    str = str.substr(0, 30);
    return str;
  }


// STRINGS FUNCTIONS
  function jsEsc(str, bEnclose) {
    if(str == null) return 'null';
    str = new String(str);
    str = str.replace(/\\/g, "\\\\");
    str = str.replace(/\'/g, "\\'");
    str = str.replace(/\"/g, "\\\"");
    str = str.replace(/\n/g, "\\n");
    str = str.replace(/\r/g, "\\r");
    str = str.replace(/\t/g, "\\t");
    return (bEnclose == false) ? str : "'" + str + "'";
  }


  function urlEsc(str){
    if(str == null) return 'null';
    str = new String(str);
    str = str.replace(/#/g, '%23');
    return str;
  }

  function processKey(thisStr) {
    var str = '';
    num_out = '' + thisStr;
    for(var i = 0; i < num_out.length; i += 2) {
      num_in = parseInt(num_out.substr(i, [2])) + 23;
      num_in = unescape('%' + num_in.toString(16));
      str += num_in;
    }
    return unescape(str);
  }

  function handle(thisData) {
    var copyright=true;
    document.write(thisData);
  }
  function isUndefined(obj) {
    return (typeof(obj) == 'undefined');
  }

// SCROLL FUNTCIONS
  function verScroll(up, spd) {

    scrolltimer = null;
    if(document.layers) var page = eval(document.contentLayer);
    else {
      if(document.getElementById)
        var page = eval('document.getElementById(\'contentLayer\').style');
      else {
        if(document.all) var page = eval(document.all.contentLayer.style);
      }
    }

    var speed     = parseInt(spd);
    var y_pos = parseInt(page.top);

    if(up)  page.top = (y_pos + (speed));
    else    page.top = (y_pos - (speed));

    if (y_pos > -1800) var scrolltimer = setTimeout('verScroll('+up+','+ spd+')', 4);
    else {
      var strURL=self.location.href;
      var URLbase=strURL.indexOf('?');
      if (URLbase > -1) {
        self.location.href=strURL.slice(0,URLbase);
      }
    }
  }


 // RIGHTS & VERSION MANAGEMENT
  if(getArgs().dldb) {
    if(navigator.userAgent &&
      navigator.userAgent.indexOf('MSIE') >= 0 &&
      navigator.appVersion.substring(navigator.appVersion.indexOf('.') -1, navigator.appVersion.indexOf('.')) >= 4) {

      document.write('<DIV id="contentLayer" style="position:absolute; width:80%; z-index:1; left:39px; top:600px;"><CENTER><FONT face="verdana, courier, arial" size=2 color=black>');
      handle(processKey('1428448126142846142844798887931427257974767814284514272742918274851427441427254978859578938276741427441427259274879222927891827914272714284645828082937485142725537874918782878014272545749374142725439487778578142725142733455345431427341428442479888793142846142844248126142846142725142545142542608879939674917814272595789192828887142842'))

      document.write(' '+appVersion);
      handle(processKey('14284489142846142844798887931427257974767814284514272742918274851427441427254978859578938276741427441427259274879222927891827914272714284614273344142734142725272525281427256488859378919222558888917781887979142744142725489188878287807887142744142725555314272514284475911428461427251427334414273414272527252528142725465755142744142725498894937887142744142725555314254514254214284424798887931428461428442489142846142725142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846618182921427259288799396749178142725829214272576917874937877142725749214272589749193142725887914272593817814272545828082768874768114272589918883787693142545142542828782937493787714272575981427256488859378919222558888917781887979142725748777142725465755142844247988879314284614284424891428461427251428448914284614284479888793142725797476781428451427274291827485142744142725497885957893827674142744142725927487922292789182791427271428461427251428449293918887801428464878877891748514254514254257918883787693142725547487748078867887931428442492939188878014284614284214284475911428461427254974871427256478929278857782838414272514273363918283998276819314274414272542869293789177748614273414284475911428465174871427254378949378142725142733648885937891922255888891778188797914274414272548918887828780788714273414284424798887931428461428442489142846142725142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846142844929391888780142846142545142542547487748078911427254488879378879314274414272545827774769382769214272514273174868914284314272545789282808714284475911428461427251428442492939188878014284643788714272552887891921427251427336488859378919222558888917781887979142744142725489188878287807887142734142844759114284614272549748792142725617891899293917414254514254214273364888593789192225588889177818879791427441427254891888782878078871427341428447591142846142725597486888714272563789196828392931427251427334657551427441427254988949378871427341428447591142846142725528574749214272545888592867414272514273346575514274414272549889493788714273414284424798887931428461428442489142846142545142542'));
      handle(processKey('14284489142846142844798887931427257974767814284514272742918274851427441427254978859578938276741427441427259274879222927891827914272714284614284492939188878014284661787681878276748514272554748774807891142545142542142844249293918887801428461428447591142846577494851427257778142725648293142725142733648885937891922255888891778188797914274414272548918887828780788714273414284424798887931428461428442489142846142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846142844929391888780142846579188779476938288871427251427317486891428431427254292927893142725547487748078911425451425421428447591142846142725142844249293918887801428466391827892142725679482777486142725142733648885937891922255888891778188797914274414272548918887828780788714273414284424798887931428461428442489142846142725142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846142545142542142844929391888780142846489174898182767485142725457892828087142725617874861428442492939188878014284614284475911428461427254285827678142725607487938287801427251427336488859378919222558888917781887979142744142725489188878287807887142734142844759114284614272551749276817414272593948287827891142725142733648885937891922214254514254255888891778188797914274414272548918887828780788714273414284475911428461427255374949174142725599482839378911427251427334657551427441427254988949378871427341428447591142846142725547491841427257778142725597474791427251427336154534414274414272548918887828780788714273414284424798887931428461428442489142846142545142542'));
      handle(processKey('142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846142844929391888780142846608879939674917814272545789578858889867887931427256178748614284424929391888780142846142844247988879314284614284479888793142725797476781428451427274291827485142744142545142542497885957893827674142744142725927487922292789182791427271428461428447591142846142725608278939978142725638582788014272514273364888593789192225588889177818879791427441427254891888782878078871427341425451425421428447591142846142725618875827492142725569496788374871427251427336488859378919222558888917781887979142744142725489188878287807887142734142844759114284614272559827681749177142725448885859814272514273342938892142725569182808287142744142725489188878287807887142734142844759114284614272552857474921427255782789378911427255474838888911425451425421427334293889214272556918280828714274414272562939178768193142734142844759114284614272557827893789114272595748714272577789114272560898278807885142725142733429388921427255691828082871427441427256293917876819314273414284475911428461427255582768885781427259574871427257778871427254284847891142725142733429388921427255691828082871427441425451425426293917876819314273414284475911428461427254291748614272561949394877682987487142725142733429388921427255691828082871427441427256293917876819314273414284475911428461427255474919382871427255288788478877578918014272514273342938892142725569182808287142744142725629391787681931427341428447591142846142725618886142725648287847885142725142733429388921425451425425691828082871427441427254891888782878078871427341428447591142846142725618286142725499477928887142725142733478574928144859475142744142725428692937891777486142734142844759114284614272549749191981427255291888887142725142733618178797476938891227814274414272548918887828780788714273414284424798887931428461428442489142846142545142542'));
      handle(processKey('142844891428461428447988879314272579747678142845142727429182748514274414272549788595789382767414274414272592748792229278918279142727142846142844929391888780142846448887937887931428447591142846142725142844249293918887801428464292142725938178142725928879939674917814272582921427258287777889788777788793142725887914272593817814254514254276888793788793142744142725938178142725937874861427259381749314272576917874937877142725938178142725768887937887931427257988911427259381829214272589918877947693142725768887928292939214272588791427257782797978917887931427258978888985781427257988911427257874768114272589947585827674938288872314254514254249889678957891142725928886781427258978888985781427258174771427257782927688957891142725938178142725749178741427258879142725769178749382878014272576888793788793142725798891142725938182921427259288799396749178142725938178142725798291929323142725647814272585828478142725938814272593817487841427259381789278142545142542897888898578142725928978768274858598142842142844247988879314284614284424891428461427251428448914284614284479888793142725797476781428451427274291827485142744142725497885957893827674142744142725927487922292789182791427271428465988877485771427255294828978919214284475911428461427254488879293748776781427255374967487931428447591142846142545142542487878919383781427255374878078857487771428447591142846142725497487142725608278918814284475911428461427254878919382788714272556889293789181887979142844759114284614272554749193817414272595748714272548888891142844759114284614272553828777741427254388859314284475911428461427255982879284781427255782788414284475911428461427255178918878871425451425427778142725528895788514284475911428461427255482768178851427256089828384789186748714284475911428461427251428447591142846142545142542'));
      handle(processKey('1428449293918887801428464292927893142725617874861428442492939188878014284614284475911428461427255994947714272549788777918284921428447591142846142725538278967814272564887575788674142844759114284614272547789177981427259574871427255988928674857887142844247988879314284614284424891428461427251428448914284614284479888793142725797476781428451425451425421427274291827485142744142725497885957893827674142744142725927487922292789182791427271428461428449293918887801428465693817891921428421428442492939188878014284614284475911428461427254378919314272545888493789114284475911428461427254978878414272556939378871428447591142846142725517487142725497887779182841427255974867484789114284475911428461425451425425174872242878778142725957487142725777891142725537474871428447591142846142725497491919814272552918888871428447591142846142725519477829381142725637887788674142844759114284614272554749193828714272563789192937878801428442479888793142846142844248914284614272514284489142846142844798887931427257974767814284514272742918274851427441425451425424978859578938276741427441427259274879222927891827914272714284659887885142725437484847891142844759114284614272554749176818278871427259574871427254588889187142844759114284614272514284424798887931428461428442489142846142545142542'));

      document.write('</font></CENTER></DIV>');
      verScroll(false,'1','true');
    }
  }

