// MVVM, 56.06.2-62.39.1, JS/BotPart.js at mvvm.net & www.xs4all.nl/~in   -->

warnT=false;  // true if warning has been shown before (global var)
function checkStatO(S)  // not in use
{
 var mGreg=0; dGreg="99"; var BegImgS=""; var EndImgS="";
 if (PathS=='http://www.xs4all.nl/~in/')
 { 
  today=new Date(); mGreg=today.getMonth();
  if (mGreg==9) // Oct only
   { dGreg=today.getDate(); if (dGreg<10) dGreg="0"+dGreg;
     if ((dGreg<1)||(dGreg>31)) dGreg="99";
     BegImgS='<img src="http://www.';
     EndImgS='/A0-MO'+dGreg+'.gif" width="2" height="1" alt="" border="0" />';
document.write(BegImgS);
document.write('&#116;&#114;in&#112;.or&#103;/&#83;&#116;at&#47;M&#86;&#86;M');
document.write(EndImgS);
   }
 }
}

function windoInfO()
{
 var S4="pen"; var S1="w"+"in"
 var S3=".o"; var S2="do"+"w";

 eval('winfo='+S1+S2+S3+S4+'("","","toolbar=no,width=400,height=200")');
// eval('winfo='+S1+S2+S3+S4+'("","","toolbar=no,width=400,height=418")');
 winfo.document.write("<head><title>INTERACTIVE RAINBOW COLORING</title></head>");
 winfo.document.write("<p align='left'>");
 winfo.document.write("<font color='#fffff0'>");
 winfo.document.write("<b>You can choose a background color for the "+
   "body of this page by clicking on it in the ");
 if (rainbTxtN+rainbBkgN>0) winfo.document.write("lower ");
 winfo.document.write("color bar. ");
 if (rainbBkgN>0)
 { winfo.document.write("And a background color for ");
   if (rainbBkgN==1)
    winfo.document.write("one other 'rainbow background' ");
   if (rainbBkgN>1)
    winfo.document.write(rainbBkgN+" other 'rainbow backgrounds' ");
   winfo.document.write("by clicking on it in the ");
   if (rainbTxtN==0) winfo.document.write(" upper color bar. ");
    else winfo.document.write(" color bar in the middle. ")
 }
 if (rainbTxtN>0)
 { winfo.document.write("And a text color for the ");
   if (rainbTxtN>1) winfo.document.write(rainbTxtN," ");
   winfo.document.write("'rainbow text");
   if (rainbTxtN>1) winfo.document.write("s");
   winfo.document.write("' by clicking on it in the upper color bar. ");
 }
 winfo.document.write("Each color will remain the same then. If you want "+
   "to see a gradual change of ");
 if (rainbTxtN==0)
   { if (rainbBkgN==0) winfo.document.write("the body background color, ");
      else winfo.document.write("background <nobr>color(s),</nobr> ") }
  else winfo.document.write("background and text colors, ");
 winfo.document.write("start the rainbow presentation.");
/*
 winfo.document.write("start the rainbow presentation. However, if you "+
   "are on-line, this way of viewing may cause a problem.</b>");
 if (IE4UpT)
  {
   winfo.document.write("<br />If the backgrounds keep on blinking, you "+
    "should alter your browser settings in the following way: click the "+
    "'Tools' menu, and then 'Internet Options'; click 'General', and then "+
    "'Settings'. ");
   winfo.document.write("Under 'Check for newer versions of stored pages' "+
    "you should select 'Automatically', the default setting.<br />"); 
   winfo.document.write("<small>(By selecting 'Every visit to a page' "+
    "your browser will check for a newer version of ANY file, also "+
    "pictures, every 'second' a change is made. As a result the "+
    "background pictures will be refreshed almost continuously, which is "+
    "an uncomfortable, unintended effect. Off-line this problem does not "+
    "occur.)</small>");
  }
*/
 winfo.document.write("<br />");  // for last line in Netscape
 winfo.document.write("</font>");
 winfo.document.write("</p>");
 winfo.document.bgColor="#000000";  // at the end for Netscape
}

function switchRainbO()
{
 var queS='Press OK to stop the color change(s).'

 if (rainbowStarT)
   { if (!rainbowT) queS='Press OK to continue the color change(s).' }
  else
   { queS='Press OK to (re)start the rainbow presentation.\n'
     queS+='(To stop the color change(s) use the same button.)' };
 queS+='\nPress CANCEL if you want no rainbow presentation.';
 if (rainbowStarT || warnT)
  { if (window.confirm(queS)) { rainbowStarT=true; rainbowT=!rainbowT }
     else  { rainbowStarT=false; rainbowT=true }
  }
  else
  { windoInfO(); warnT=true;
    if (winfo.confirm(queS)) { rainbowStarT=true; rainbowT=!rainbowT }
     else  { rainbowStarT=false; rainbowT=true }
    winfo.close()
  }
}

function OneLink(T)  // 'START/STOP' and 'COLORING' will appear as one link
{
 var docS="document.all."; var stlS=".style.";  // for IE

 if (Nav5UpT)  // for Netscape 6 and 7
  { docS = "document.getElementById('"; stlS = "').style." }
 if (T)
  { eval(docS+'RainbowL'+stlS+'background="black"');
    eval(docS+'RainbowL'+stlS+'color="white"');
    eval(docS+'RainbowR'+stlS+'background="black"');
    eval(docS+'RainbowR'+stlS+'color="white"') }
  else
  { eval(docS+'RainbowL'+stlS+'background="transparent"');
    eval(docS+'RainbowL'+stlS+'color="#404040"');
    eval(docS+'RainbowR'+stlS+'background="transparent"');
    eval(docS+'RainbowR'+stlS+'color="#404040"') }
}

function changetoColO(S)
{
 var Ch=S.charAt(0);
 var colorN=bodcolorN; var prevN=bodcolorN;

 S=S.substring(4); colorN=parseInt(S);
 if (Ch=='T') { prevN=txtcolorN; txtcolorN=colorN }
 if (Ch=='G') { prevN=bkgcolorN; bkgcolorN=colorN }
 if (Ch=='B') { bodcolorN=colorN }
 changeColO(Ch,prevN); rainbowT=false
}

function switchLightO() { bkgLighT=!bkgLighT }

function Write_BotPart(verS)
{
 var colorN;
 var URL_S=document.URL;
 var yearN1=59; yearN2=59; var weekN1=1; var weekN2=1;
 var now_excepT = (URL_S.indexOf('En.htm')+URL_S.indexOf('Nl.htm')+
                   URL_S.indexOf('VocAll.htm')+3>0 );
        // documents excepted from immediate rainbow presentation, altho new 
 var alw_excepT = ( URL_S.indexOf('indLeft.htm')+
                    URL_S.indexOf('VocALeft.htm')+2>0 );
        // special files always excepted from rainbow presentation 

 if (verS<"59011") TopParT=true;
 if ((verS>"12345") && (verS<"59011")) BodyObjsT=true;
 if ((verS=="12345") || (verS>"57451"))
   { if (BodyObjsT)
      { if (parent.frames.length==0)
// '|| (parent.frames[0].name!="MVVM_IRight1"))' gives 'denial of access' error
         doStatWindO(verS)
      }  // for special and new formats
   }
  else { if (BodyObjsT) StatWind(true) }  // to be phased out

 if ((verS=="12345") || (verS>"58110"))
   {
    if (BodyObjsT && (IE4UpT || Nav5UpT) && !alw_excepT)
     {
      colorN=Math.round((colorA.length-1)/2);  // green for bilingual
      if ((fileC=='1') || (fileC=='6')) colorN=Math.round(3*(colorA.length-1)/4);
      if ((fileC=='3') || (fileC=='8')) colorN=Math.round((colorA.length-1)/4); 
      if (verS=="12345") colorN=colorA.length-1;  // grey   
      bodcolorN=colorN; bkgcolorN=colorN; txtcolorN=colorN;
 
document.write('<br />');
document.write('<table cellpadding="0" cellspacing="0" id="RainbTbl"><tr>');
document.write('<td width="120" valign="middle" align="right">');
document.write('<a href="javascript:switchRainbO()" onmouseover="OneLink(true)" onmouseout="OneLink(false)" id="RainbowL">');
document.write('&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;START/STOP&nbsp;</a></td>');
document.write('<td align="center">');
document.write('<table cellpadding="1" cellspacing="0" bgcolor="#202020"><tr><td align="center">');
document.write('<table cellpadding="1" cellspacing="0" bgcolor="#808080"><tr><td align="center">');
document.write('<table cellpadding="0" cellspacing="0" border="0">');
  // table rendered correctly with border=1 and colspan=colorA.length+2,
  // incorrectly for border=0 (even tho colspan=colorA.length+2!) 
      if (rainbTxtN>0)
       {
document.write('<tr height="8">');
document.write('<td width="26" align="left" id="TBarL">TEXT</td>');
        for (var i=0; i<colorA.length; i++)
         { var colorS=colorA[i]; if (bkgLighT) colorS=darkerO(colorS);
           if (i==txtcolorN) colorS="#000000";
document.write('<td width="2" bgcolor=',colorS,' onClick="javascript:changetoColO(id)" id="TCol',i,'"></td>')
         }
document.write('<td width="26" align="right" id="TBarR">TEKST</td>');
document.write('</tr><tr height="1"><td colspan="',colorA.length+1,'"></td></tr>');
       }
      if (rainbBkgN>0)
       {
document.write('<tr height="8">');
document.write('<td width="26" align="left" id="GBarL">BKGR</td>');
        for (i=0; i<colorA.length; i++)
         { colorS=colorA[i]; if (!bkgLighT) colorS=darkerO(colorS);
           if (i==bkgcolorN) colorS="#000000";
document.write('<td width="2" bgcolor=',colorS,' onClick="javascript:changetoColO(id)" id="GCol',i,'"></td>')
         }
document.write('<td width="26" align="right" id="GBarR">A.GR.</font></td>');
document.write('</tr><tr height="1"><td colspan="',colorA.length+1,'"></td></tr>');
       }
document.write('<tr height="8">'); 
document.write('<td width="26" align="left" id="BBarL">BODY</td>');
        for (i=0; i<colorA.length; i++)
         { colorS=colorA[i]; colorS=lighterO(colorS);
           if (i==bodcolorN) colorS="#000000";
document.write('<td width="2" bgcolor=',colorS,' onClick="javascript:changetoColO(id)" id="BCol',i,'"></td>')
         }
document.write('<td width="26" align="right" id="BBarR">ROMP</td></tr>');
document.write('</table>');
document.write('</td></tr></table>');
document.write('</td></tr></table>');
document.write('</td>');
document.write('<td width="120" valign="middle" align="left">');
document.write('<a href="javascript:switchRainbO()" onmouseover="OneLink(true)" onmouseout="OneLink(false)" id="RainbowR">');
document.write('&nbsp;COLORING/KLEUREN&nbsp;</a></td>');
      if (rainbBkgN+rainbTxtN>0)
       {
document.write('</tr><tr><td align="center" colspan="3"><table>');
document.write('<tr bgcolor="#c000c0"><td align="center"><font color="#ffffff" '+
 'size="-2"><a href="JavaScript:switchLightO()" id="SwitchLight">'+
 'LIGHT&lt;&gt;DARK / LICHT&lt;&gt;DONKER</a></font></td></tr>');
document.write('</table></td>');
       }
document.write('</tr></table>');

      getMetrDateO();
      if (TopParT)  // for docDateS after successful loading
       {
        yearN1=parseInt(docDateS.substring(0,2));
        yearN2=parseInt(yNow);
        weekN1=parseInt(docDateS.substring(2,4));
        weekN2=parseInt(week_noS);
        if ((((yearN2-yearN1)*52+weekN2-weekN1)<14) && !now_excepT)
         { rainbowStarT=false; rainbowT=false;
// for a document changed less than a quarter of a year ago: stones on
// _fixed_ background color (because of improper effects if browser
// checks for newer version 'every visit to the page')
           changeColO('B',colorN-1)
         }
       }
     }
   }
}

BotParT=true  // checks whether contents have been transferred
              // (on-line) and scripts (can be) executed

//Copyright 56-62 aSWW, M.Vincent van Mechelen, Amsterdam, NL