//<SCRIPT LANGUAGE="JavaScript">
<!--


if (document.URL.split("coursewareobjects.com")[0] == "http://www.")
 { var domainRoot = 'http://www.coursewareobjects.com'; }
else if (document.URL.split("elsevier.com")[0] == "http://coursewareobjects.")
 { var domainRoot = 'http://coursewareobjects.elsevier.com'; }
var docRoot = '/objects/elr/common/';


	//Function to hack old top_panel.html on Evolve EICs and correct TD size and bg color.
function fixIEtop_panel(){
//array of TDs in top_panel.html. [0] and [6] cells need to be corrected.
var allTDs = self.frames[0].document.getElementsByTagName("td");
//alert("# of table cells: " + allTDs.length);
//alert (allTDs[0].bgColor)
allTDs[0].setAttribute("width","90%");
allTDs[0].setAttribute("bgColor","#D8E8F7");
allTDs[6].setAttribute("width","10%");
allTDs[6].setAttribute("bgColor","#D8E8F7");
}



	//Function used to populate frame elements
function build_select(formname,fieldname,type){
// Call to hack for old top_panel.html code. IE specific to correct table cell sizing and background.
if ((IE) && (self.frames[0].top_type == "EIC"))
	  {
fixIEtop_panel();
      }

 if(self.frames[0].top_type == "EIC") {
  newValue = '[' + self.frames[0].EnterSearch + ']';
    //fixes value if not default or overridden in EIC_language_*.js
  if(self.frames[0].document.search.query.value != newValue) {
    self.frames[0].document.search.query.value = newValue;
    if(!IE) { //IE isn't DOM-compliant and won't allow setAttribute
      for(i=0;i<self.frames[0].document.search.length;i++) {
        if(self.frames[0].document.search[i].name == 'query') {
          querybox = self.frames[0].document.search[i];
          querybox.setAttribute('onfocus', 'if (this.value == "[' + self.frames[0].EnterSearch + ']") { this.value=""; }');
          querybox.setAttribute('onblur', 'if (this.value == "") { this.value="[' + self.frames[0].EnterSearch + ']"; }');
        }
      }
    }
  }
 }

   //selectbox is used throughout subsequent functions
 eval("selectbox = frames[0].document.forms['" + formname + "']." + fieldname);

 selectbox.options.length = Items.length;
 optionNum = 0;
 chapter = 1;
 selectbox.options.length=1;
 for(i=0;i<Items.length;i++) {

    //types: default=asset name, CH=chapter, PCH=part & chapter

    /*POPULATE DISPLAY*/
    //FILENAMES ONLY
  if (!type) {
   if(Items[i] != "none") {
    if (Items[i] == "0") { selectbox.options[optionNum].text = dropClean(ItemNames[i]); } //eg, "Select Item"
    else if (ItemNames[i].split("|")[0] == "0") { selectbox.options.length++; selectbox.options[optionNum].text = dropClean(ItemNames[i].split("|")[1]); chapter = 1; } //eg, Appendix
    else if (ItemNames[i].indexOf("|") > 1) { selectbox.options.length++; selectbox.options[optionNum].text = dropClean(ItemNames[i].split("|")[0]); chapter = 1; } //eg, Appendix: foo
    else { selectbox.options.length++; selectbox.options[optionNum].text = dropClean(ItemNames[i]); chapter++; } //Chapter entry
    selectbox.options[optionNum].value = Items[i];
    optionNum++;
   }
  }
    //CHAPTERS
  else if (type == "CH") {
   if(Items[i] != "none") {
    if (Items[i] == "0") { selectbox.options[optionNum].text = dropClean(ItemNames[i]); } //eg, "Select Item"
    else if (ItemNames[i].split("|")[0] == "0") { selectbox.options.length++; selectbox.options[optionNum].text = dropClean(ItemNames[i].split("|")[1]); chapter = 1; } //eg, Appendix
    else if (ItemNames[i].indexOf("|") > 1) { selectbox.options.length++; selectbox.options[optionNum].text = dropClean(ItemNames[i].split("|")[0]); chapter = 1; } //eg, Appendix: foo
    else {
     selectbox.options.length++;
     if(Items[i] != "none" && window.sectionName && typeof(sectionName) != "string") {
      if (sectionName[0].indexOf("|") > 1) { selectbox.options[optionNum].text = dropClean(sectionName[0].split("|")[0] + " " + listNum(listType(sectionName[0]), chapter)); } //eg, Part I (new style)
      else { selectbox.options[optionNum].text = dropClean(sectionName[0] + " " + chapter); } //eg, Part (new style)
     } else { selectbox.options[optionNum].text = dropClean("Chapter " + chapter); }
     if(document.param == "ch=" + chapter) { document.param = optionNum; }
     chapter++;
    } //Chapter entry
    selectbox.options[optionNum].value = Items[i];
    optionNum++;
   } else if (ItemNames[i].split("|")[0] != "0") { chapter++;
   } else { } // eg, "0|..." for Introductions/Appendices
  }
    //PARTS-CHAPTERS
  else if (type == "PCH") { //either all of a level will be [i][0] or all [i][1..n]
   if (Items[i][0] == "0") { selectbox.options.length = 0; sectionNameNAV0 = ItemNames[i][0]; } //eg, "Select Item"
   else if(ItemNames[i][0].indexOf("|") > 1) { //eg, "Appendices"
    sectionNameNAV0 = ItemNames[i][0].split("|")[0];
    if(ItemNames[i][0].split("|").length > 2) { sectionNameNAV0 = sectionNameNAV0 + "|" + ItemNames[i][0].split("|",3)[2]; }
   } else if(ItemNames[i][0].indexOf("|") > 0) { sectionNameNAV0 = "0"; }
   else if(Items[i][0] != "none" && Items[i][0] != "1" && sectionName[0] && typeof(sectionName) != "string" && sectionName[0] != " ") { sectionNameNAV0 = sectionName[0]; } //eg, Part (new style); "1" added to support chapters preceding sections
   else if(Items[i][0] != "none" && sectionName && typeof(sectionName) == "string") { sectionNameNAV0 = sectionName; } //eg, Part (old style)
   else if (typeof(sectionName) != "string") { sectionNameNAV0 = sectionName[1]; } //name from array
   else { sectionNameNAV0 = "Chapter"; } //no array, default for lowest level
   if(!window.sectionNameNAV || sectionNameNAV != sectionNameNAV0) { sectionNameNAV = sectionNameNAV0; chapter=1; }
   if(Items[i][0] == "none" || Items[i][0] == "1") { //display chapter
    selectbox.options.length = selectbox.options.length + (Items[i].length - 1);
    for(j=1;j<Items[i].length;j++) {
     if(Items[i][j] != "none" && Items[i][j].split("|")[0] != "2") {
      if(sectionNameNAV == "0" || sectionNameNAV.indexOf("none") == 0) {
       if(ItemNames[i][j].indexOf("|") > 0) { selectbox.options[optionNum++].text = dropClean(ItemNames[i][j].split("|")[1]); }
       else { selectbox.options[optionNum++].text = dropClean(ItemNames[i][j]); }
      } else {
       selectbox.options[optionNum++].text = dropClean(sectionNameNAV.split("|")[0] + " " + listNum(listType(sectionNameNAV), chapter));
       if(document.param == "ch=" + chapter) { document.param = optionNum - 1; }
       chapter++;
      }
      selectbox.options[optionNum - 1].value = Items[i][j];
     } else { selectbox.options.length--; chapter++; }
    }
   } else { //display part
    selectbox.options.length++;//create space for single entry
    if (Items[i][0] == "0") { selectbox.options[optionNum].text = dropClean(sectionNameNAV.split("|")[0]); } //"Select Item"
    else if (sectionNameNAV == "0") { selectbox.options[optionNum].text = dropClean(ItemNames[i][0].split("|")[1]); } //"Title of Appendix"
    else if (ItemNames[i][0].indexOf("|") > 0) { selectbox.options[optionNum].text = dropClean(ItemNames[i][0].split("|")[0]); } //"Appendix"
    else { //Foo: 1..N
     selectbox.options[optionNum].text = dropClean(sectionNameNAV.split("|")[0] + " " + listNum(listType(sectionNameNAV), chapter));
     if(document.param == "ch=" + chapter) { document.ch = true; document.param = optionNum; }
     chapter++;
    }
    selectbox.options[optionNum].value = Items[i][0];
    optionNum++;
   }
  }//END PCH
    //UNITS-PARTS-CHAPTERS
  else if (type == "UPCH") {
   if (Items[i][0][0] == "0") { selectbox.options[optionNum].text = dropClean(ItemNames[i][0][0]); selectbox.options[optionNum].value = Items[i][0][0]; optionNum++; } //eg, "Select Item"
   else if (Items[i][0][0] == "none" || Items[i][0][0] == "1") { //UPCH--parts only || "Prefix"
    if(ItemNames[i][0][0].indexOf("|") > 1) { sectionNameNAV = ItemNames[i][0][0].split("|")[0]; }
    else if(ItemNames[i][0][0].indexOf("|") > 0) { sectionNameNAV = "0"; }

    for(j=1;j<Items[i].length;j++) { //skips Unit level
     if(ItemNames[i][j][0].indexOf("|") > 1 && Items[i][j][0] != "1") { sectionNameNAV0 = ItemNames[i][j][0].split("|")[0]; }
     else if(ItemNames[i][j][0].indexOf("|") > 0 && Items[i][j][0] != "1") { sectionNameNAV0 = "0"; }
     else if(ItemNames[i][0][0].indexOf("|") > 0 && Items[i][j][0] == "1" && Items[i][0][0] != "1") { sectionNameNAV0 = sectionNameNAV; if(j==1){ chapter=1; } }
     else if(sectionName[1] && Items[i][j][0] != "none" && Items[i][j][0] != "1") { sectionNameNAV0 = sectionName[1]; }
     else if(sectionName[2]) { sectionNameNAV0 = sectionName[2]; } //eg, Chapter
     else { sectionNameNAV0 = "Chapter"; }

     if(!window.sectionNameNAV || sectionNameNAV != sectionNameNAV0) { sectionNameNAV = sectionNameNAV0; chapter=1; }

     if (Items[i][j][0] == "none" || Items[i][j][0] == "1") {
      /*if(ItemNames[i][j][0].indexOf("|") > 1) { sectionNameNAV0 = ItemNames[i][j][0].split("|")[0]; }
      else if(ItemNames[i][j][0].indexOf("|") > 0) { sectionNameNAV0 = "0"; }
      else if(sectionName[1] != undefined) { sectionNameNAV0 = sectionName[1]; }
      else if(sectionName[2] != undefined) { sectionNameNAV0 = sectionName[2]; } //eg, Chapter
      else { sectionNameNAV0 = "Chapter"; }

      if(!window.sectionNameNAV || sectionNameNAV != sectionNameNAV0) { sectionNameNAV = sectionNameNAV0; chapter=1; }*/

      selectbox.options.length = selectbox.options.length + (Items[i][j].length - 1);

      for(k=1;k<Items[i][j].length;k++) {
       if(Items[i][j][k] != "none") {
        if(sectionNameNAV == "0") { selectbox.options[optionNum++].text = dropClean(ItemNames[i][j][k]); }
        else {
         if (sectionNameNAV.charAt(0) == "$") { theTitle = eval(sectionNameNAV.split("|")[0].substr(1)); }
          else { theTitle = sectionNameNAV.split("|")[0]; }
         if (sectionNameNAV.split("|")[1] == "*") { theName = "- " + ItemNames[i][j][k]; }
          else { theName = listNum(listType(sectionNameNAV), chapter); }

         if(theTitle == "none") { selectbox.options[optionNum++].text = dropClean(theName.substring(2)); } //removes "- "; must coordinate
         else { selectbox.options[optionNum++].text = dropClean(theTitle + " " + theName); }
         if(document.param == "ch=" + chapter) { document.param = optionNum - 1; }
         chapter++;
        }
        selectbox.options[optionNum - 1].value = Items[i][j][k];
       } else { selectbox.options.length--; chapter++; }
      }
     }
     else if (ItemNames[i][j][0].split("|")[0] == "0") { //eg, Appendix
      selectbox.options.length++;
      selectbox.options[optionNum].text = dropClean(ItemNames[i][j][0].split("|")[1]);
      selectbox.options[optionNum].value = Items[i][j][0];
      optionNum++;
     }
     else if (ItemNames[i][j][0].indexOf("|") > 0) { //eg, Appendix: Foo
      if (Items[i][j][0] != "1") { //item necessary for array, but not to be displayed
       selectbox.options.length++;
       selectbox.options[optionNum].text = dropClean(ItemNames[i][j][0].split("|")[0]);
       selectbox.options[optionNum].value = Items[i][j][0];
       sectionNameNAV = "0";
       optionNum++;
      }
     } else { //Parts
      //if (optionNum == 0) { optionNum = i; }
      //selectbox.options.length = selectbox.options.length + (Items[i][j].length - 1);
      selectbox.options.length++;
      if(Items[i][j][0] != "none") {
       //if(sectionName[1] != undefined) { sectionNameNAV = sectionName[1]; } //eg, Part
       //else { sectionNameNAV = "Part"; }
       selectbox.options[optionNum].text = dropClean(sectionNameNAV.split("|")[0] + " " + listNum(listType(sectionNameNAV), chapter));
       selectbox.options[optionNum].value = Items[i][j][0];
       optionNum++;
       chapter++;
      }
     }
    }
   }
   else if (ItemNames[i][0][0].split("|")[0] == "0") { selectbox.options[i].text = dropClean(ItemNames[i][0][0].split("|")[1]); optionNum++; } //eg, Appendix
   else if (ItemNames[i][0][0].indexOf("|") > 0) { selectbox.options[i].text = dropClean(ItemNames[i][0][0].split("|")[0]); sectionNameNAV = "0"; optionNum++; } //eg, Appendix: Foo
   else if (Items[i][0][0] != "0") { sectionNum = renumber(i); selectbox.options[i].text = dropClean(sectionName + " " + sectionNum); } //typical Section
  }//END UPCH

    /*POPULATE VALUES*/
  //if ((type == "PCH") && optionNum == 0) { selectbox.options[i].value = Items[i][0]; }
  //see above for PCH && optionNum != 0
  //else if (type != "CH" && !selectbox.options[i].value) { selectbox.options[i].value = Items[i]; }
 }
 disable_bn(0);
 tp_caller();
}


  //disables back/next buttons
function disable_bn(disvar){
 if (disvar=="1" || disvar=="0"){ frames[0].document.backbut.src=domainRoot+docRoot+"images/spacer.gif"; }
 else { frames[0].document.backbut.src=domainRoot+docRoot+"images/back.jpg"; }

 if (disvar==(selectbox.length-1)){ frames[0].document.nextbut.src=domainRoot+docRoot+"images/spacer.gif"; }
 else { frames[0].document.nextbut.src=domainRoot+docRoot+"images/next.jpg"; }
}


  //opens document in document frame
function go(){
 var filename, selected;
 selected=selectbox.selectedIndex;
 filename=selectbox.options[selected].value;

 if (filename!="0"){
  if (self.frames[0].top_type == "EIC") {
   self.frames[0].validate(filename);
   self.frames[0].document.search.query.value = '[' + self.frames[0].EnterSearch + ']';
  } else if(window.popups) { //opens link in popup
   popthingsup('top_panel',filename);
  } else { self.frames[1].location.href=filename; }
  //document.form1.page.options.value=myvar;
  selectbox.options[selected].selected=true;
 }

 disable_bn(selected);
}


  //goes to next document
function next(){
 var filename, selected;
 selected=selectbox.selectedIndex;

 if (selected!=(selectbox.length-1)){
  filename=selectbox.options[(eval(selected)+1)].value;
  /*if(typeof(Items[0]) == "string") { filename =Items[(eval(selected)+1)]; }
  else { filename=Items[(eval(selected)+1)][0]; }*/ //eg PCH
  if (self.frames[0].top_type == "EIC") {
   self.frames[0].validate(filename);
   self.frames[0].document.search.query.value = '[' + self.frames[0].EnterSearch + ']';
  } else if(window.popups) {
   popthingsup('top_panel',filename);
  } else { self.frames[1].location.href=filename; }

  nextvar=(eval(selected)+1);
  //document.form1.page.options.value=nextvar;
  selectbox.options[nextvar].selected=true;
  disable_bn(nextvar);
 }
}


  //goes to previous document
function back(){
 var filename, selected;
 selected=selectbox.selectedIndex;

 if ((selected!=1)&&(selected!=0)){
  filename=selectbox.options[(eval(selected)-1)].value;
  /*if(typeof(Items[0]) == "string") { filename =Items[(eval(selected)-1)]; }
  else { filename =Items[(eval(selected)-1)][0]; }*/ //eg PCH
  if (self.frames[0].top_type == "EIC") {
   self.frames[0].validate(filename);
   self.frames[0].document.search.query.value = '[' + self.frames[0].EnterSearch + ']';
  } else if(window.popups) {
   popthingsup('top_panel',filename);
  } else { self.frames[1].location.href=filename; }
  nextvar=(eval(selected)-1);
  selectbox.options[nextvar].selected=true;
  disable_bn(nextvar);
 }
}


function popthingsup(type,filename) {
 if(!popups.Target) { popups.Target = "somewindow"; }
 if(!popups.Width) { popups.Width = ""; }
 if(!popups.Height) { popups.Height = ""; }
 if(!popups.Type) { popups.Type = ""; }
 if(type == "href") { return 'popup(this,\'' + popups.Target + '\',\'' + popups.Width + '\',\'' + popups.Height + '\',\'' + popups.Type + '\'); return false;'; }
 else if(type == "top_panel") { popup(filename,popups.Target,popups.Width,popups.Height,popups.Type); }
}


  //build TOC.html
function buildTOC(type,frame,range) { //range would allow display of array subsets [08/02/04 JWS]
 if(!frame) { destination = eval("document"); }
 else { destination = eval("window.frames[\"" + frame + "\"].document"); }

 if(window.popups) { popupOC = popthingsup('href'); }
 else { popupOC = ""; }

 if (type == "UPCH") { buildTOClist("UPCH",destination);
 } else if (type == "PCH") { buildTOClist("PCH",destination);
 } else if (type == "CH") { buildTOClist("CH",destination);
 } else { buildTOClist("",destination); }
}

  //each list of the TOC is built separately here
function buildTOClist(type,destination) {
   //Units, parts & chapters
 if (type == "UPCH") {
  unitNum = 1;
  sectionNum = 1;
  chapter = 1;
  optionNum = 1;
  sectionNameTOC1 = sectionNameTOC = "dummy value";
  for(k=1;k<ItemNames.length;k++) {
   if (Items[k][0][0] != "0" && Items[k][0][0] != "1") {
    destination.writeln('<h2>');
    if (ItemNames[k][0][0].indexOf("|") > 0) {
     sectionTitle = ItemNames[k][0][0].split("|");
     if(sectionTitle[0] != sectionNameTOC1) { sectionNum = 1; chapterNum = 1; unitNum = 1; sectionNameTOC1 = sectionTitle[0]; }
     else { unitNum++; }

     if(!sectionTitle[2] || sectionTitle[2] == "") { sectionTitle[2] = "1"; }
     if(sectionTitle[0] != "0") { destination.write(sectionTitle[0] + " " + listNum(sectionTitle[2], unitNum) + ': '); }
     destination.write(sectionTitle[1]);
     chapter = 1;
    } else if (sectionName[0] != "none") {
     destination.write(sectionName[0].split("|")[0] + " " + listNum(listType(sectionName[0]), unitNum) + ': ' + ItemNames[k][0][0]); unitNum++;
    } else { destination.write(ItemNames[k][0][0]); }
    destination.write('</h2>');
   }
   for(j=1;j<ItemNames[k].length;j++) {
    if(ItemNames[k][j][0].indexOf("|") != -1 && Items[k][j][0] != "1") {
     if(!ItemNames[k][j][0].split("|")[2] || ItemNames[k][j][0].split("|")[2] == "") { numbering = "1"; }
     else { numbering = ItemNames[k][j][0].split("|")[2]; }

     if(ItemNames[k][j][0].split("|")[0] != "0" && ItemNames[k][j][0].split("|")[0] != sectionNameTOC) {
      sectionNameTOC = ItemNames[k][j][0].split("|")[0];
      sectionNum = 1;
      thisNum = " " + listNum(numbering, sectionNum) + ": ";
     } else if(ItemNames[k][j][0].split("|")[0] != "0") {
      thisNum = " " + listNum(numbering, sectionNum) + ": ";
      sectionNum++;
     } else { sectionNameTOC = thisNum = ""; }

     destination.write('<h3>' + sectionNameTOC + thisNum);
     if(Items[k][j][0] == "none") {
      destination.write(ItemNames[k][j][0].split("|")[1]);
     } else {
      destination.write('<a href="'+Items[k][j][0]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[k][j][0].split("|")[1]+'</a>');
      optionNum++;
     }
     if (ItemNames[k][j][0].indexOf("|") == 0) { sectionNum++; } //no name section
     else { sectionNum = 1; chapter = 1; } //reset for new section
     destination.writeln('</h3>');

    } else if (Items[k][j][0] == "none" || Items[k][j][0] == "1") { //no asset or no display
     if (!window.sectionNameTOC || !sectionNameTOC || sectionNameTOC != sectionName[1].split("|")[0])
      { sectionNameTOC = sectionName[1].split("|")[0]; chapter = 1; }
     //sectionNum = renumber(j);
     if (Items[k][j][0] != "1") {
      destination.writeln('<h3>');
      if(sectionNameTOC != "none") { destination.write(sectionNameTOC + ' ' + listNum(listType(sectionName[1]), sectionNum) + ': '); }
      destination.write(ItemNames[k][j][0]+'</h3>');
      sectionNum++;
     }
    } else {
     if (!window.sectionNameTOC || !sectionNameTOC || sectionNameTOC != sectionName[1])
      { sectionNameTOC = sectionName[1]; chapter = 1; }
     //sectionNum = renumber(j);
     destination.writeln('<h3>');
     if(sectionNameTOC != "none") { destination.write(sectionNameTOC.split("|")[0] + ' ' + listNum(listType(sectionNameTOC), sectionNum) + ': '); }
     destination.write('<a href="'+Items[k][j][0]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[k][j][0]+'</a></h3>');
     sectionNum++;
     optionNum++;
    }
    destination.writeln('<ol start="' + chapter + '" type="' + listType(sectionName[2],'TOC') + '">');
    for(i=1;i<Items[k][j].length;i++) {
     if (Items[k][j][i] != 0) { //ignore default value
/*      if (Items[k][j][0] == "none") { jumpto = chapter; }
      else { jumpto = j; }*/
      if(Items[k][j][0] != "none" && Items[k][j][0] != "1") { optionNum--; }
      if (Items[k][j][i] == "none")
       { destination.writeln('<li>'+ItemNames[k][j][i]+'</li>'); }
      else { destination.writeln('<li><a href="'+Items[k][j][i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[k][j][i]+'</a></li>'); if(Items[k][j][0] == "none") { optionNum++; } }
      if(Items[k][j][0] != "none") { optionNum++; }
     }
     chapter++;
    }
    destination.writeln('</ol>');
   }
  }

   //Parts & chapters
 } else if (type == "PCH") {
  sectionNum = 0;
  chapter = 1;
  optionNum = 1;
  for(j=1;j<ItemNames.length;j++) {
   if (Items[j][0] == "0") { selectbox.options.length = 0; sectionNameTOC0 = ItemNames[j][0]; } //eg, "Select Item"
   //else if(ItemNames[j][0].indexOf("|") > 1) { sectionNameTOC0 = ItemNames[j][0].split("|")[0]; }
   else if(ItemNames[j][0].indexOf("|") > 0) { sectionNameTOC0 = "0"; sectionNameTOC1 = ItemNames[j][0].substring(ItemNames[j][0].indexOf("|") + 1, ItemNames[j][0].length); }
   else if(sectionName[0] && typeof(sectionName) != "string") { sectionNameTOC0 = sectionName[0]; sectionNameTOC1 = sectionName[1]; if(Items[j][0] != "1") { sectionNum++; } } //eg, Part
   else if(sectionName && typeof(sectionName) == "string") { sectionNameTOC0 = sectionName; sectionNameTOC1 = "Chapter"; }
   else { sectionNameTOC0 = "Chapter"; }

   if((!window.sectionNameTOC || sectionNameTOC != sectionNameTOC0) && sectionNameTOC0 != "0") { sectionNameTOC = sectionNameTOC0; chapter=1;
    if(Items[j][0] != "1") { sectionNum=1; } //renumbers for chapters preceding Section 1
   } else if(sectionNameTOC0 == "0") { sectionNameTOC = " "; chapter=1; sectionNum=0; }

   if(ItemNames[j][0].indexOf("|") != -1) {
//    if(ItemNames[j][0].split("|")[0] != "0") { sectionNameTOC = ItemNames[j][0].split("|")[0] + ": "; }
//    else { sectionNameTOC = " "; }
    if(Items[j][0] != "1") { destination.write('<h3>'); }
    if(sectionNum != 0) { destination.write(sectionNameTOC.split("|")[0] + " " + listNum(listType(sectionNameTOC), sectionNum) + ": "); }
    //else if (sectionNameTOC.length > 1) { destination.write(": "); }
    else if(Items[j][0] == "none") { destination.write(ItemNames[j][0].split("|")[1]); }
    else if(Items[j][0] == "1") {  }
    else { destination.write('<a href="'+Items[j][0]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[j][0].split("|")[1]+'</a>'); optionNum++; }
    chapter = 1; //reset for new section
    if(Items[j][0] != "1") { destination.writeln('</h3>'); }
   } else if (Items[j][0] == "none") {
//    sectionNum = renumber(j);
    destination.write('<h3>');
    if(sectionNum != 0) { destination.write(sectionNameTOC.split("|")[0] + " " + listNum(listType(sectionNameTOC), sectionNum) + ": "); }
    //else if (sectionNameTOC.length > 1) { destination.write(": "); }
    destination.writeln(ItemNames[j][0]+'</h3>');
   } else if (Items[j][0] == "1") {
   } else {
//    sectionNum = renumber(j);
//    if(typeof(sectionName) != "string") { sectionName0 = sectionName[0]; }
//    else { sectionName0 = ""; }
    destination.write('<h3>');
    if(sectionNum != 0) { destination.write(sectionNameTOC.split("|")[0] + " " + listNum(listType(sectionNameTOC), sectionNum) + ": "); }
    //else if (sectionNameTOC.length > 1) { destination.write(": "); }
    destination.writeln('<a href="'+Items[j][0]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[j][0]+'</a></h3>');
    optionNum++;
   }
   if(ItemNames[j].length > 1) { //section may not have sub-items, esp if Intro
    if(ItemNames[j][1].indexOf("0|") == -1) { destination.writeln('<ol start="' + chapter + '" type="' + listType(sectionNameTOC1,'TOC') + '">'); }
    for(i=1;i<Items[j].length;i++) {
     if (Items[j][i] != 0) { //ignore default value
/*      if (Items[j][0] == "none") { jumpto = chapter; }
      else { jumpto = j; }*/
      if(ItemNames[j][1].indexOf("0|") == -1) { destination.writeln('<li>'); }
      else { destination.writeln('<h3>'); } //eg, Intro

       //link
      if (Items[j][i] != "none" && Items[j][i].split("|")[0] != "2") {
       destination.write('<a href="'+Items[j][i]+'" onclick="' + popupOC + 'return parent.jump(');
       if(Items[j][0] == "none" || Items[j][0] == "1" || Items[j].length == i) { destination.write(optionNum); }
       else { destination.write(optionNum - 1); }
       destination.write(');">');
      } else if (Items[j][i].split("|")[0] == "2") {
       destination.write('<a href="'+Items[j][i].split("|")[1]+'" onclick="' + popupOC + ');">');
      }
       //title
      if(ItemNames[j][i].indexOf("0|") == -1) { destination.write(ItemNames[j][i]); }
      else { destination.write(ItemNames[j][i].split("|")[1]); }
       //link end
      if (Items[j][i] != "none") {
       destination.write('</a>');
       if(Items[j][0] == "none" || Items[j][0] == "1" || Items[j].length == i) { optionNum++; }
      }

      if(ItemNames[j][1].indexOf("0|") == -1) { destination.write('</li>'); }
      else { destination.write('</h3>'); } //eg, Intro
     }
     chapter++;
    }
    if(ItemNames[j][1].indexOf("0|") == -1) { destination.writeln('</ol>'); }
   }
  }

   //Chapters
 } else if (type == "CH") {
  chapter = 1;
  optionNum = 1;
  for(i=0;i<Items.length;i++) {
   if (ItemNames[i].split("|")[0] == "0") { //eg, Appendix
    if (chapter > 1) { destination.writeln('</ol>'); }
    destination.write('<h3>');
    if (Items[i] != "none") { destination.write('<a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">' + ItemNames[i].split("|")[1] + '</a>'); optionNum++; }
    else { destination.writeln(ItemNames[i].split("|")[1]); }
    destination.writeln('</h3>');
    chapter = 1;
   }
   else if (ItemNames[i].indexOf("|") > 1) { //eg, Appendix: foo
    if (chapter > 1) { destination.writeln('</ol>'); }
    destination.write('<h3>');
    if (Items[i] != "none") { destination.write('<a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">' + ItemNames[i].split("|")[0] + '</a>'); optionNum++; }
    else { destination.writeln(ItemNames[i].split("|")[0]); }
    destination.writeln('</h3>');
    chapter = 1;
   }
   else if (Items[i] != 0) { //ignore default value
    if (chapter == 1) {
     destination.writeln('<ol start="' + chapter + '"');
     if(typeof(sectionName) == "object" && sectionName[0].indexOf("|") > 1)
      { destination.write('type="' + listType(sectionName[0],'TOC') + '"'); }
     else if(typeof(sectionName) == "string" && sectionName.indexOf("|") > 1)
      { destination.write('type="' + listType(sectionName,'TOC') + '"'); }
     destination.write('>');
    }
    if (Items[i] == "none") {
     destination.writeln('<li>'+ItemNames[i]+'</li>');
    } else {
     destination.writeln('<li><a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[i]+'</a></li>');
     optionNum++;
    }
    chapter++;
   }
  }


   //unordered
 } else {
  chapter = 1;
  optionNum = 1;
  for(i=0;i<Items.length;i++) {
   if (ItemNames[i].split("|")[0] == "0") { //eg, Appendix
    if (chapter > 1) { destination.writeln('</ul>'); }
    destination.write('<h3>');
    if (Items[i] != "none") { destination.write('<a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">' + ItemNames[i].split("|")[1] + '</a>'); optionNum++; }
    else { destination.writeln(ItemNames[i].split("|")[1]); }
    destination.writeln('</h3>');
    chapter = 1;
   }
   else if (ItemNames[i].indexOf("|") > 1) { //eg, Appendix: foo
    if (chapter > 1) { destination.writeln('</ul>'); }
    destination.write('<h3>');
    if (Items[i] != "none") { destination.write('<a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">' + ItemNames[i].split("|")[0] + '</a>'); optionNum++; }
    else { destination.writeln(ItemNames[i].split("|")[0]); }
    destination.writeln('</h3>');
    chapter = 1;
   }
   else if (Items[i] == "none") {
    if (chapter == 1) { destination.writeln('<ul>'); }
    destination.writeln('<li>'+ItemNames[i]+'</li>');
    chapter++;
   }
   else if (Items[i] != 0) { //ignore default value
    if (chapter == 1) { destination.writeln('<ul>'); }
    destination.writeln('<li><a href="'+Items[i]+'" onclick="' + popupOC + 'return parent.jump('+optionNum+');">'+ItemNames[i]+'</a></li>');
    chapter++;
    optionNum++;
   }
  }
 }
}


  //Returns a type for the list
function listType(sectionNameLT, usage) {
 if(sectionNameLT.indexOf("|") >= 1) {
  if (sectionNameLT.split("|")[1] == "I") {
   if(usage == "TOC") { return "\" STYLE=\"list-style-type:upper-roman"; }
   else { return sectionNameLT.split("|")[1]; }
  } else if (sectionNameLT.split("|")[1] == "*") {
   if(usage == "TOC") { return "\" STYLE=\"list-style-type:disc"; }
   else { return ""; }
  } else {
   if(usage == "TOC") { return sectionNameLT.split("|")[1] + "\" STYLE=\"list-style-type:upper-alpha"; }
   else { return sectionNameLT.split("|")[1]; }
  }
 }
 else { return "1"; }
}

function listNum(type, sectionNumX) { //FIX: this is ignored when sectionname is overridden
 if (type == 'I') {
  RomanNum = new Array (1,4,5,9,10,40,50,90,100,400,500,900,1000);
  RomanAlpha = new Array ("I","IV","V","IX","X","XL","L","XC","C","CD","D","CM","M");
  var Roman = "";
  while (sectionNumX > 0) {
   var iR = 12;
   while(RomanNum[iR] > sectionNumX) { iR--; }
   for (jR=1;jR<=Math.floor(sectionNumX / RomanNum[iR]);jR++) { Roman += RomanAlpha[iR]; }
   sectionNumX = sectionNumX % RomanNum[iR];
  }
  return Roman;
 } else if (type == 'spell') {
  tens = new Array ("", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety");
  units = new Array ("", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen");

  var Spell = "";
  last2 = sectionNumX % 100;
  last = sectionNumX % 10;

  if (sectionNumX > 0) {
   if (sectionNumX < 20) { Spell = units[sectionNumX]; }
   else if (last == 0) { Spell = tens[last2/10]; }
   else { Spell = tens[last2/10] + "-" + units[last]; }
  }
  return Spell;
 } else if (type == 'A') {
  var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

  var Alpha = "";
  last2 = Math.floor((sectionNumX-1) / 26);
  last = (sectionNumX - 1) % 26;

  if (sectionNumX > 0) {
   if(last2 <= 26) { Alpha = alphabet.charAt(last2 - 1) + alphabet.charAt(last); }
   else { Alpha = "NaN"; } //I'm lying, it's really just more than 702 and I don't care to deal with that
  }
  return Alpha;
 } else if (type == '*') {
  return "-";
 } else { //type == '1'
  return sectionNumX;
 }
}


  //Cleans up text for use in drop-downs
function dropClean(text) {
 re = /<[^>]+>/g;
   //Check for specific codes and deal with them here, eg, <SUP>2</SUP -> ^2.
 text = text.replace('&#151;', '--'); //mdash

 return text.replace(re, "");
}


  //opens requested file
function jump(jumper,top_type) {
 var filename;
 if(!top_type && self.frames[0].top_type) { top_type = self.frames[0].top_type; }
 else if (!top_type) { top_type = "normal"; }

   //ensure jumper is within range
 if (jumper >= 0 && jumper < selectbox.length) { filename=selectbox.options[jumper].value; }
 else { //error and default page
  if(jumper.indexOf('ch=') != 0 && jumper > selectbox.length - 1)
   { window.alert("Request is out of range."); }
  jumper = 0;
  filename = toc_link;
 }

 if (filename!="0") {
  selectbox.options[jumper].selected=true;
  disable_bn(jumper);
  if (top_type == "EIC") { self.frames[0].validate(filename); return false; } //ignores A HREF
  else if (window.popups) { popthingsup('top_panel',filename); self.frames[1].location.href=toc_link; return false; } //opens link in popup
  else { self.frames[1].location.href=filename; return true; } //executes A HREF as well
 }
}


  //grabs requested filenumber to use in tp_caller() (from url_cap.js)
function url_cap() {
 ch = grabParams("ch");
 if (ch == "" || ch == null) {
  // uurl parameter captures the complete URL address
  var uurl = location.href;
  // uurl is then converted to string
  uurl = uurl.toString();
  // uurl string is checked to find whether a parameter is passed.
  //This is checked by detecting ?
  var locate1 = uurl.indexOf('?');

  // if ? is located then the parameter after ? is captured.
  // This is stored in variable named param.
  // If there is no ? in uurl or ItemID is found (EIC.CFM) then the param is set to empty.
  if (locate1 != "-1" && uurl.indexOf('ItemID') == -1) {
   document.param = uurl.substring(locate1+1,uurl.length);
  } else { document.param = ""; }
 } else { document.param = "ch=" + ch; document.ch=ch; }
}


  //reloads index page w/o query string
function indexPage() {
 if (!window.topFrameName || window.topFrameName === undefined || window.topFrameName == ''){ topFrameName='topFrame'; }
 if (!window.bottomFrameName || window.bottomFrameName === undefined || window.bottomFrameName == ''){ bottomFrameName='bottomFrame'; }
 
 topFrame = eval("window.frames[\"" + topFrameName + "\"]");
 bottomFrame = eval("window.frames[\"" + bottomFrameName + "\"]");
 
 bottomFrame.filename = bottomFrame.location.pathname.substring(bottomFrame.location.pathname.lastIndexOf('/')+1);
 if (grabParams('ItemID') != "") { itemid = "?ItemID="+grabParams('ItemID'); } //for EIC.CFM
 else { itemid = ""; }
 if (bottomFrame.filename != toc_link) { location=location.protocol+'//'+location.host+location.pathname+itemid; }
 //else { alert(bottomFrame.filename + ' is the main TOC'); }
 return false;
}


    //(Taken from generalJS.js, 02/24/03)
function grabParams(Field){
 var mysearch = document.location.search; //for (un)framed sites with code on document
 window.onerror = locationError;  //if page is framed by other domain, next line creates error
   //will not look to parent for mysearch: buggy
 //if (mysearch.length < 1 && parent.document.domain == self.document.domain) { mysearch = parent.location.search; } //for framed sites with code on parent, if domain identical

 if (mysearch.length >= 1) {
  mysearch = mysearch.split("?");
  mysearch = mysearch[1].split(Field + "=");
  if (mysearch.length >= 2) { mysearch = mysearch[1].split("&",1); }
  else { mysearch[0] = ""; }
  mysearch = unescape(mysearch[0]);
  return mysearch;
 }
} //end grabParams()


  //handles errors generated by location checks across domains by stifling error;
  //add window.onerror = locationError; to problem-generating code
  //send name of broken function/location via window.foo = "bar";
  //(Taken from generalJS.js, 02/24/03)
function locationError(msg,url,line) { //params come from browser's onError event
   //error lines
 mysearch = ""; //grabParams (Message)

   //always do this
 return true;
}

  //creates frameset of index.html (from index_creator.js)
  //If Variable param is not empty, then frameset is written as described in "if" condition
function index_creator() {
 if (!window.frameheight || window.frameheight === undefined || window.frameheight == ''){ frameheight=30; }
 if (!window.topFrameName || window.topFrameName === undefined || window.topFrameName == ''){ topFrameName='topFrame'; }
 if (!window.bottomFrameName || window.bottomFrameName === undefined || window.bottomFrameName == ''){ bottomFrameName='bottomFrame'; }
 
 if (document.param != ""){
  document.writeln('<frameset rows="'+window.frameheight+',*" frameborder="no" border="0" framespacing="0">');
  document.write('<frame name="' + window.topFrameName + '" src="');
  document.write(top_panel);
  document.write('?');
  document.write(eval(document.param));
  document.writeln('" border="0" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" noresize>"');
  document.writeln('<frame name="' + window.bottomFrameName + '" src="'+domainRoot+docRoot+'js_files/preloader.html">');
 }

 // If Variable param is empty, then frameset is written as described in "else" condition
 else {
  //alert("writing the non correct frame");
  document.writeln('<frameset rows="'+window.frameheight+',*" frameborder="no" border="0" framespacing="0">');
  document.write('<frame name="' + window.topFrameName + '" src="');
  document.write(top_panel);
  document.writeln('" border="0" scrolling="no" marginheight="0" marginwidth="0" frameborder="0" noresize>"');
  document.writeln('<frame name="' + window.bottomFrameName + '" src="'+domainRoot+docRoot+'js_files/preloader.html">');
  //toc_link called by top_panel in ONLOAD
 }

 document.writeln('</frameset>');
 document.writeln('<noframes> ');
 document.writeln('<body bgcolor="#336699" text="#000000">');
 document.writeln('<p><em>This document requires a browser that can view frames.</em></p>');
 document.writeln('</body>');
 document.writeln('</noframes>');
}


  //opens requested document from drop-down: location.search=?n (from tp_caller.js)
function tp_caller() {
 // If Variable param is not empty, then jump function is called with the param available
 if (document.param != "" && !document.ch) { jump(document.param); return true; } //simple ?1 style
 else if (document.param != "" && document.ch != "") {
  if(!window.sectionName) { jump(document.param); return true;//just jump if old version
  } else if(typeof window.sectionName == "object" || typeof window.sectionName == "array") {
   //replicate TOC-building here
   for(var i=0;i<window.sectionName.length;i++) {
    if(document.ch && window.sectionName[i] == "Chapter") { jump(document.param); return true; }
   }
  }// else { frames[1].location=toc_link; } //no Chapters
 }
 frames[1].location=toc_link;
 //else { frames[1].location=toc_link; } //loads default page
}


  //renumbers sections & chapters when Intros and such are in TOC
function renumber(j) {
 if (window.sectionNameTOC && sectionNameTOC) {
  sectionNum = 1;
  chapter = 1;
  delete sectionNameTOC; //TRY FOR IE: sectionNameTOC = undefined;
  return 1;
 } else if (window.sectionNum && sectionNum) {
  sectionNum++;
  return sectionNum;
 }else { return j; }
}


  //builds title on html windows, allowing generic templates; requires generalJS.js
function buildTitle(frame) {
 if (!window.topFrameName || window.topFrameName === undefined || window.topFrameName == ''){ topFrameName='topFrame'; }
 if (!window.bottomFrameName || window.bottomFrameName === undefined || window.bottomFrameName == ''){ bottomFrameName='bottomFrame'; }
 
 if(!frame) { destination = eval("document"); }
 else {

  if (frame=='top_panel') { framename=window.topFrameName; }

  else if (frame=='toc') { framename=window.bottomFrameName; }
  else { framename=frametype; }
  destination = eval("window.frames[\"" + framename + "\"].document");

 }


 if(TitleInfo[1] != '' && TitleInfo[1]) {
  authorString = TitleInfo[1] + ': ';
 } else { authorString = ''; }

 if (TitleInfo[3] != '' && TitleInfo[3] != '1st' && !(TitleInfo[3] < 2) && TitleInfo[3]) {
  if(TitleInfo[0] == 'PflegeHeute') { suffix="."; editionText = 'Auflage'; }
  else { editionText = 'Edition'; }


  if (TitleInfo[3] > 1) { //actually checks if string or number
   if(window.suffix !== undefined) { //forced somewhere earlier
     edString = ', '+TitleInfo[3]+suffix+' ' + editionText;
   } else { edString = ', '+numberSuffix(TitleInfo[3])+' ' + editionText; }
  } else { edString = ', '+TitleInfo[3]+' ' + editionText; }
 } else { edString = ''; }

 fulltitle = TitleInfo[0] + ": " + authorString + TitleInfo[2] + edString + " - " + assetTitle;
 if(frame=='top_panel') { fulltitle = fulltitle + " Navigation"; }
 destination.title = fulltitle;

 if(frame=='toc' || window.TitleInfo[4]) { //eg, 'block'

  destination.getElementById('h1').innerHTML = authorString + TitleInfo[2] + edString;

  destination.getElementById('header').style.display = 'block';

  destination.getElementById('h2').innerHTML = assetTitle;

 }



 //NOT USEDif(window.Additional_B && typeof(window.Additional_B) == 'string' && window.Additional_B != '') { setTimeout("destination.getElementById('Additional_B').innerHTML = Additional_B;", 100); }
}

//-->
//</SCRIPT>