// TRINPsite, 57.25.4-66.33.1, JS/HeadObjs.js at TRINP = www.trinp.org      -->
/*
For JavaScript objects and files to be used inside the HTML head statement.

WARNING: UC version DIFFERS from ANSI version in that HeadObjs_UC.js must
         call for the UC versions of 3 CSS files and 8 other JS files:
         AllPages_UC.css, GenNodal_UC.css, GenBasic_UC.css,
         ContTRNP_UC.js, BodyObjs_UC.js, PrePage_UC.js, TopPart_UC.js,
         MidPart_UC.js, FramSub_UC.js, BotPart_UC.js and PostPage_UC.js!
*/

function writeIncompletO(verS)  // verS not (yet) used
{
 var alertS="This page is not complete, due to a bad connection, an illicit "+
            "address, (an) external file(s) missing or a system failure! "+
            "Please, try again at www.trinp.org/ .";
 alert(alertS);
document.write('<br /><br /><font color="#000000">&nbsp;['+alertS+']&nbsp;</font>');
}

function Get_PathS()
{
 var URL_S=document.URL; var urlS=''; var endS='';
 var n=0;
// contacT=false; 
 PathS='';  // three global variables
 TRINPathS='http://www.trinp.org/';
 FTPPathS='http://ftptr025.home.xs4all.nl/';
   // used to be 'http://www.xs4all.nl/~ftptr025/' until 66.23.5

 for (n=0;n<URL_S.length;n++)
 { if (URL_S.charAt(n)=="\\")
   URL_S=URL_S.substring(0,n)+"/"+URL_S.substring(n+1) }
 urlS=URL_S.toLowerCase();
 if ((urlS.indexOf('http://')>-1) ||
  ((urlS.indexOf('www.')>-1) || (urlS.indexOf('.home.xs4all.')>-1)))
  {
   if (urlS.indexOf('.xs4all.nl')>-1) PathS=FTPPathS; else PathS=TRINPathS;
  }
  else  // off-line
  {
   n=urlS.length-1
   while (n>-1)
   {
    endS=urlS.substring(n);
    if (endS.indexOf('/trinp/')>-1)
      { PathS=URL_S.substring(0,n+1)+'TRINP/'; n=-1 }
        // (TRIN)PathS works only if using TRINP directory
     else { n-- }
   } 
   if (PathS=='')
    alert('JavaScript links such as those in the floating menus will only '+
          'work for files in the top directory, because of a change in '+
          'the off-line directory structure or name(s). (Make sure all '+
          'TRINPsite files and subdirectories are in a top directory '+
          'called "TRINP".)'); 
   FTPPathS=PathS;
  }
 TRINPathS=PathS  // used for TRINPsite files shared with other sites,
                  // where PathS has a different value
}

function defineBaseO()
{
 var localI=document.URL.toLowerCase().indexOf("~ftptr025");
 var movI=10;

 if (localI==-1)
  { localI=document.URL.toLowerCase().indexOf("ftptr025.home.xs4all.nl");
    movI=24 }
 if (localI>-1)  // 'contacT' at this stage still (always) false
document.write('<base href="http://www.trinp.org/',document.URL.substring(localI+movI),'">')
  // for relative links (which do not make use of a variable such as 'PathS')
  // absolute links with PathS will be taken care of in BodyObjs.js
}

function Get_FileChar()
 { // not the same as in BodyFnct.js
  var urlS=document.URL;
  fileC="0"; 
  if (urlS.indexOf("MNI")>0)
   { if (urlS.indexOf(".HTM")>0) fileC="8"; else fileC="3" };
  if (urlS.indexOf("Tong")>0)
   { if (urlS.indexOf(".HTM")>0) fileC="7"; else fileC="2" };
  if (urlS.indexOf("Valu")>0)  // temporary assignment for own ikon
   { fileC="10" };  // see Write_HeadObjs() below (nodal only)
  if ((urlS.indexOf("Dict")>0) || (urlS.indexOf("VocA")>0))  // temporary assignments
   { if (urlS.indexOf(".HTM")>0) fileC="9"; else fileC="4" };
  if (fileC=="0")  // rest (in BodyFnct.js also "Poet/VocA")
   { if (urlS.indexOf(".HTM")>0) fileC="6"; else fileC="1" };
 }

/*
function adjustTitlO()
 {  // discontinued (in the beginning the name of the browser used to follow
    // the name of the document immediately in the same font, type and case)
  var titleS=document.title;  // should end with '&nbsp;' for spaces
  var lenI=2;  // max 2 bracketed phrases not capitalized
  var leftBrI=-1; var rightBrI=-1;
  var beginS=''; var bracketS=''; var endS='';

  if ((titleS.substring(0,11)=='TRINPsite: ')
       && (document.URL.indexOf('Valu')==-1)) titleS=titleS.substring(11);
  if (titleS.substring(0,28)=='Vocabulary of Alliteration: ')
   titleS=titleS.substring(28);
    // name site/Vocabulary and lower case for search engines,
    // not for site itself, except for Valu(e) documents

  beginS=titleS; endS=titleS; titleS='';
  for (var I=1; I<lenI+1; I++ ) 
  {
   leftBrI=endS.indexOf(' ('); rightBrI=endS.indexOf(') ');
    // bracketed parts of words will still be capitalized
   if ((leftBrI>0) && (rightBrI>0) && (rightBrI<leftBrI))
    rightBrI=leftBrI+endS.substring(leftBrI).indexOf(') ');
   bracketS=''; 
   if (leftBrI>0)
     {
      bracketS=endS.substring(leftBrI+1,rightBrI+1);
      beginS=endS.substring(0,leftBrI+1);
      endS=endS.substring(rightBrI+1);
      titleS=titleS+beginS.toUpperCase()+bracketS;
     }
    else I=lenI+1
  }
  titleS=titleS+endS.toUpperCase();
  document.title=titleS;
 }
*/

function show_in_whole_windO()
 {
  var URL_S=document.URL;
  var n=URL_S.indexOf('VocALeft.htm');
  if (n>-1) URL_S=URL_S.substring(0,n)+'VocAll.htm';

  if (window.parent.frames.length==0) 
    window.location.href=URL_S;
   else window.parent.expandO(URL_S)
 }

function Write_HeadObjs()
{
 var verS="00000";  // for old formats without VersDateS
 var CSSVarS=""; var iconS="";

 if (window.VersDateS) verS=VersDateS;  // for formats with VersDateS
 if (document.location.search.indexOf('hearT=true')>0) hearT=true;
  else hearT=false;
   // new variable in future F7 format (see 3GUestBk.HTM) [64.41.7]

 if (fileC=="1") { CSSVarS=PathS+"CSS/GenNodal.css"; iconS=PathS+"WhlTRT1.ico" };
 if (fileC=="10") { CSSVarS=PathS+"CSS/GenNodal.css";
      iconS=PathS+"WhlT1.ico"; fileC="1" }
 if (fileC=="2") { CSSVarS=PathS+"CSS/GenNodal.css"; iconS=PathS+"WhlTRT1.ico" };
 if (fileC=="3") { CSSVarS=PathS+"CSS/MNINodal.css"; iconS=PathS+"MNI/WhlTLT1.ico" };
 if (fileC=="4") { CSSVarS=PathS+"CSS/GenNodal.css";
      iconS=PathS+"Poet/VocAll/VoAT1.ico"; fileC="1" }
 if (fileC=="6") { CSSVarS=PathS+"CSS/GenBasic.css"; iconS=PathS+"WhlBRT1.ico" };
 if (fileC=="7") { CSSVarS=PathS+"CSS/GenBasic.css"; iconS=PathS+"WhlBRT1.ico" };
 if (fileC=="8") { CSSVarS=PathS+"CSS/MNIBasic.css"; iconS=PathS+"MNI/WhlBLT1.ico" };
 if (fileC=="9") { CSSVarS=PathS+"CSS/Dict.css";
     iconS=PathS+"Poet/VocAll/VoAT1.ico"; fileC="6" }

document.write('<link rel="Start" href="http://www.trinp.org/index.htm" />');
document.write('<link rel="stylesheet" href="',PathS,'CSS/AllPages.css" type="text/css" />');
document.write('<link rel="stylesheet" href="',CSSVarS,'" type="text/css" />');
document.write('<link rel="shortcut icon" href="',iconS,'">');

 contacT=false; 
document.write('<script src="http://www.trinp.org/JS/ContTRNP.js" type="text/javascript" language="JavaScript"></script>');
document.write('<script src="',PathS,'JS/BodyObjs.js" type="text/javascript" language="JavaScript"></script>');

 if ((window.MidParT)==false)  // else undefined; same as (verS>"65345")
document.write('<script src="',PathS,'JS/MidPart.js" type="text/javascript" language="JavaScript"></script>');

 if (!hearT)
 {
document.write('<script src="',PathS,'JS/PrePage.js" type="text/javascript" language="JavaScript"></script>');
document.write('<script src="',PathS,'JS/TopPart.js" type="text/javascript" language="JavaScript"></script>');
document.write('<script src="',PathS,'JS/BotPart.js" type="text/javascript" language="JavaScript"></script>');
document.write('<script src="',PathS,'JS/PostPage.js" type="text/javascript" language="JavaScript"></script>');
 }
 if ((verS!="12345") && (verS<"65346"))
   // before F7 separate FramSub,js, from F7 part of BotPart.js  
document.write('<script src="',PathS,'JS/FramSub.js" type="text/javascript" language="JavaScript"></script>');
}

Get_PathS(); GamePathS=PathS+"JS/GP/";
Get_FileChar();
//if (window.parent.frames.length==0) adjustTitlO();
defineBaseO();
Write_HeadObjs();
document.ondblclick=show_in_whole_windO;

HeadObjsT=true  // checks whether contents have been transferred
                // (on-line) and scripts (can be) executed

// Copyright 57-66 ASWW, M.Vincent van Mechelen, DNI Foundation, Netherlands
