// Original script: Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
// Courtesy of SimplytheBest.net - http://simplythebest.net/scripts/
// Improvements: Copyright (c) 2008 Ralph Sickinger, WILLCOR, Inc.

var caution = false
var nodecnt = 0
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "")
  if (!caution || (name + "=" + escape(value)).length <= 4000)
    document.cookie = curCookie
  else
    if (confirm("Cookie exceeds 4KB and will be cut!"))
      document.cookie = curCookie
}
function getCookie(name) {
  var prefix = name + "="
  var cookieStartIndex = document.cookie.indexOf(prefix)
  if (cookieStartIndex == -1)
    return null
  var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
  if (cookieEndIndex == -1)
    cookieEndIndex = document.cookie.length
  return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT"
  }
}
function fixDate(date) {
  var base = new Date(0)
  var skew = base.getTime()
  if (skew > 0)
    date.setTime(date.getTime() - skew)
}
function item(parent, caption, file, id, depth) {
  if (parent) { nodecnt++ }

  this.parent = parent
  this.text = caption
  this.id = id
  this.file = file
  this.depth = depth
}
function makeArray(length) {
  this.length = length
}
function makeDatabase() {
  var ix = 0
  outline = new makeArray(147)

//        outline[0] = new item(false, "<i>Summary</i>","summary","",0)

        outline[ix] = new item(true, "Corrosion Prevention and Control Guidebook","index","1",0)
        ix++
        outline[ix] = new item(false, "Foreward","11","",1)
        ix++
        outline[ix] = new item(true, "1.0 Scope and Application","12","2",1)
        ix++
        outline[ix] = new item(false, "1.1 Scope","121","",2)
        ix++
        outline[ix] = new item(false, "1.2 Intended Use","122","",2)
        ix++
        outline[ix] = new item(false, "1.3 Applicability","123","",2)
        ix++
        outline[ix] = new item(false, "1.4 Policy/Guidance","124","",2)
        ix++
        outline[ix] = new item(false, "2.0 Applicable Documents","13","",1)
        ix++
        outline[ix] = new item(true, "3.0 Definitions","14","3",1)
        ix++
        outline[ix] = new item(false, "3.1 Acronyms","141","",2)
        ix++
        outline[ix] = new item(false, "3.2 Definitions","142","",2)
        ix++
        outline[ix] = new item(true, "4.0 General Requirements","15","4",1)
        ix++
        outline[ix] = new item(false, "4.1 General Program Management Structure","151","",2)
        ix++
        outline[ix] = new item(false, "4.2 General Design and Technical Guidance","152","",2)
        ix++
        outline[ix] = new item(true, "5.0 Detailed Requirements","16","5",1)
        ix++
        outline[ix] = new item(true, "5.1 Program/Project Management for Acquisition...","161","6",2)
        ix++
        outline[ix] = new item(true, "5.1.1 DoD Corrosion Performance Specification Issues","1611","7",3)
        ix++
        outline[ix] = new item(false, "5.1.1.1 Programmatic Issues","16111","",4)
        ix++
        outline[ix] = new item(false, "5.1.1.2 Technical Issues","16112","",4)
        ix++
        outline[ix] = new item(true, "5.1.2 DoD Acquisition Process","1612","8",3)
        ix++
        outline[ix] = new item(false, "5.1.2.1 Initial Capabilities Document","16121","",4)
        ix++
        outline[ix] = new item(false, "5.1.2.2 Capability Development Document...","16122","",4)
        ix++
        outline[ix] = new item(true, "5.1.2.3 Request for Proposal/Specifications","16123","9",4)
        ix++
        outline[ix] = new item(false, "5.1.2.3.1 Request for Proposal","161231","",5)
        ix++
        outline[ix] = new item(true, "5.1.2.3.2 Specifications","161232","@",5)
        ix++
        outline[ix] = new item(false, "5.1.2.3.2.1 Performance Specification","1612321","",6)
        ix++
        outline[ix] = new item(false, "5.1.2.3.2.2 Process/Finish Specification","1612322","",6)
        ix++
        outline[ix] = new item(true, "5.1.3 DoD Construction Process","1613","A",3)
        ix++
        outline[ix] = new item(false, "5.1.3.1 Requirement Definition","16131","",4)
        ix++
        outline[ix] = new item(false, "5.1.3.2 Conceptual Design","16132","",4)
        ix++
        outline[ix] = new item(false, "5.1.3.3 Final Design Plans and Specification","16133","",4)
        ix++
        outline[ix] = new item(false, "5.1.3.4 Request for Proposal","16134","",4)
        ix++
        outline[ix] = new item(false, "5.1.3.5 Specifications","16135","",4)
        ix++
        outline[ix] = new item(true, "5.1.4 Corrosion Prevention and Control Planning","1614","B",3)
        ix++
        outline[ix] = new item(true, "5.1.4.1 Corrosion Prevention Advisory Team (CPAT)","16141","C",4)
        ix++
        outline[ix] = new item(false, "5.1.4.1.1 Establishment and Scope","161411","",5)
        ix++
        outline[ix] = new item(false, "5.1.4.1.2 Membership","161412","",5)
        ix++
        outline[ix] = new item(false, "5.1.4.1.3 CPAT Duties","161413","",5)
        ix++
        outline[ix] = new item(true, "5.1.4.2 Contractor Corrosion Team (CCT)","16142","D",4)
        ix++
        outline[ix] = new item(false, "5.1.4.2.1 Membership","161421","",5)
        ix++
        outline[ix] = new item(false, "5.1.4.2.2 CCT Duties","161422","",5)
        ix++
        outline[ix] = new item(true, "5.1.5 Corrosion Prevention and Control Planning Documentation","1615","E",3)
        ix++
        outline[ix] = new item(false, "5.1.5.1 Corrosion Prevention and Control Plan (CPCP)","16151","",4)
        ix++
        outline[ix] = new item(false, "5.1.5.2 Process/Finish Specification or Equivalent Document in Acquisition","16152","",4)
        ix++
        outline[ix] = new item(false, "5.1.5.3 System Verification Plan in Acquisition","16153","",4)
        ix++
        outline[ix] = new item(false, "5.1.5.4 Construction Inspection Plan for Facilities","16154","",4)
        ix++
        outline[ix] = new item(false, "5.1.5.5 Corrosion Technical Manual Guidance and Corrosion Maintenance","16155","",4)
        ix++
        outline[ix] = new item(false, "5.2 Design of Facilities","162","",2)
        ix++
        outline[ix] = new item(true, "Appendices","17","F",1)
        ix++
        outline[ix] = new item(false, "Appendix A","171","",2)
        ix++
        outline[ix] = new item(true, "Appendix B","172","G",2)
        ix++
        outline[ix] = new item(false, "Section 1: Introduction","1721","",3)
        ix++
        outline[ix] = new item(true, "Section 2: Organization and Responsibilities","1722","H",3)
        ix++
        outline[ix] = new item(false, "2.1 Team Coordination of Corrosion Control","17221","",4)
        ix++
        outline[ix] = new item(true, "2.2 Contractor Corrosion Teams (CCT)","17222","I",4)
        ix++
        outline[ix] = new item(false, "2.2.1 Contractor Corrosion Team Responsibilities","172221","",5)
        ix++
        outline[ix] = new item(true, "2.2.2 Corrosion Control Team Functional Tasks","172222","J",5)
        ix++
        outline[ix] = new item(false, "2.2.2.1 Materials and Processes","1722221","",6)
        ix++
        outline[ix] = new item(false, "2.2.2.2 Design","1722222","",6)
        ix++
        outline[ix] = new item(false, "2.2.2.3 Reliability, Maintainability, and Supportability","1722223","",6)
        ix++
        outline[ix] = new item(false, "2.2.2.4 Production Operations","1722224","",6)
        ix++
        outline[ix] = new item(true, "2.2.2.5 Quality Assurance","1722225","K",6)
        ix++
        outline[ix] = new item(false, "2.2.2.5.1 Process Control","17222251","",7)
        ix++
        outline[ix] = new item(false, "2.2.2.5.2 Quality Control","17222252","",7)
        ix++
        outline[ix] = new item(false, "2.2.2.6 Manufacturing (Planning)","1722226","",6)
        ix++
        outline[ix] = new item(false, "2.2.2.7 Hazardous Materials","1722227","",6)
        ix++
        outline[ix] = new item(true, "Section 3: Corrosion Prevention and Control Processes","1723","L",3)
        ix++
        outline[ix] = new item(true, "3.1 General Requirements","17231","M",4)
        ix++
        outline[ix] = new item(false, "3.1.1 The Primary Engineering Document...","172311","",5)
        ix++
        outline[ix] = new item(true, "3.1.2 Material Limitations","172312","N",5)
        ix++
        outline[ix] = new item(false, "3.1.2.1 Aluminum Alloys","1723121","",6)
        ix++
        outline[ix] = new item(false, "3.1.2.2 Corrosion Resistant Steel Alloys","1723122","",6)
        ix++
        outline[ix] = new item(false, "3.1.2.3 Magnesium alloys","1723123","",6)
        ix++
        outline[ix] = new item(true, "3.2 Material Surface Treatments","17232","O",4)
        ix++
        outline[ix] = new item(false, "3.2.1 Aluminum Alloys","172321","",5)
        ix++
        outline[ix] = new item(false, "3.2.2 Titanium Alloys","172322","",5)
        ix++
        outline[ix] = new item(true, "3.2.3 Non-corrosion Resistant Alloy Steels","172323","P",5)
        ix++
        outline[ix] = new item(false, "3.2.3.1 Non-corrosion resistant steel...","1723231","",6)
        ix++
        outline[ix] = new item(false, "3.2.3.2 Non-corrosion resistant steel alloys...","1723232","",6)
        ix++
        outline[ix] = new item(false, "3.2.3.3 Non-corrosion resistant steel alloys whose...","1723233","",6)
        ix++
        outline[ix] = new item(false, "3.2.3.4 When a wear-resistant coating...","1723234","",6)
        ix++
        outline[ix] = new item(false, "3.2.3.5 Exceptions to the above requirements...","1723235","",6)
        ix++
        outline[ix] = new item(false, "3.2.4 Corrosion Resistant Steel Alloys","172324","",5)
        ix++
        outline[ix] = new item(false, "3.2.5 Graphite Reinforced Composites","172325","",5)
        ix++
        outline[ix] = new item(false, "3.2.6 Other Coatings","172326","",5)
        ix++
        outline[ix] = new item(false, "3.3 Sealing","17233","",4)
        ix++
        outline[ix] = new item(true, "Section 4: Operational Environment","1724","Q",3)
        ix++
        outline[ix] = new item(false, "4.1 General","17241","",4)
        ix++
        outline[ix] = new item(false, "4.2 Breathing and Condensation","17242","",4)
        ix++
        outline[ix] = new item(false, "4.3 Atmosphere Salt","17243","",4)
        ix++
        outline[ix] = new item(false, "4.4 Sulfur Oxides","17244","",4)
        ix++
        outline[ix] = new item(false, "4.5 Firefighting Agents","17245","",4)
        ix++
        outline[ix] = new item(false, "4.6 Soot","17246","",4)
        ix++
        outline[ix] = new item(false, "4.7 Sand and Dust","17247","",4)
        ix++
        outline[ix] = new item(false, "4.8 Rainfall","17248","",4)
        ix++
        outline[ix] = new item(false, "4.9 Volcanic Ash","17249","",4)
        ix++
        outline[ix] = new item(false, "4.10 Solar Radiation","1724a","",4)
        ix++
        outline[ix] = new item(false, "4.11 Runway Deicing Materials","1724b","",4)
        ix++
        outline[ix] = new item(false, "4.12 Chemicals","1724c","",4)
        ix++
        outline[ix] = new item(false, "4.13 Damage by Personnel","1724d","",4)
        ix++
        outline[ix] = new item(false, "4.14 Chemical Warfare Agents","1724e","",4)
        ix++
        outline[ix] = new item(false, "Section 5: References","1725","",3)
        ix++
        outline[ix] = new item(true, "Appendix C","173","R",2)
        ix++
        outline[ix] = new item(false, "1.0 Objectives","1731","",3)
        ix++
        outline[ix] = new item(false, "2.0 Scope","1732","",3)
        ix++
        outline[ix] = new item(true, "3.0 Responsibilities.","1733","S",3)
        ix++
        outline[ix] = new item(false, "3.1 Headquarters Air Force Civil Engineer Support Agency","17331","",4)
        ix++
        outline[ix] = new item(false, "3.2 Major Commands","17332","",4)
        ix++
        outline[ix] = new item(false, "3.3 Corrosion Prevention Advisory Team (CPAT) will:","17333","",4)
        ix++
        outline[ix] = new item(false, "3.4 The Contractor Corrosion Team (CCT) will:","17334","",4)
        ix++
        outline[ix] = new item(true, "4.0 Requirements:","1734","T",3)
        ix++
        outline[ix] = new item(true, "4.1 Environmental","17341","U",4)
        ix++
        outline[ix] = new item(false, "4.1.1 The primary environmental impact...","173411","",5)
        ix++
        outline[ix] = new item(false, "4.1.2 The primary environmental concern...","173412","",5)
        ix++
        outline[ix] = new item(false, "4.1.3 The following environmental laws...","173413","",5)
        ix++
        outline[ix] = new item(false, "4.1.4 Do not use chromates in...","173414","",5)
        ix++
        outline[ix] = new item(false, "4.1.5 The environmental concerns of...","173415","",5)
        ix++
        outline[ix] = new item(false, "4.2 Safety","17342","",4)
        ix++
        outline[ix] = new item(false, "4.3 Design","17343","",4)
        ix++
        outline[ix] = new item(false, "4.4 Maintenance","17344","",4)
        ix++
        outline[ix] = new item(true, "5.0 Recordkeeping.","1735","V",3)
        ix++
        outline[ix] = new item(false, "5.1 Cathodic protection recordkeeping...","17351","",4)
        ix++
        outline[ix] = new item(false, "5.2 Industrial water treatment records...","17352","",4)
        ix++
        outline[ix] = new item(false, "5.3 Maintain records following...","17353","",4)
        ix++
        outline[ix] = new item(false, "6.0 Forms Prescribed.","1736","",3)
        ix++
        outline[ix] = new item(true, "Attachment 1 (to Appendix C)","1737","W",3)
        ix++
        outline[ix] = new item(true, "References","17371","X",4)
        ix++
        outline[ix] = new item(false, "Public Laws","173711","",5)
        ix++
        outline[ix] = new item(false, "DoD Publications","173712","",5)
        ix++
        outline[ix] = new item(true, "Additional References","17372","Y",4)
        ix++
        outline[ix] = new item(false, "Public Laws (Add Ref)","173721","",5)
        ix++
        outline[ix] = new item(false, "Air Force Publications","173722","",5)
        ix++
        outline[ix] = new item(false, "Army Publications","173723","",5)
        ix++
        outline[ix] = new item(false, "Navy Publications","173724","",5)
        ix++
        outline[ix] = new item(false, "NACE International Recommended Practices...","173725","",5)
        ix++
        outline[ix] = new item(false, "Abbreviations and Acronyms","17373","",4)
        ix++
        outline[ix] = new item(true, "Appendix D","174","Z",2)
        ix++
        outline[ix] = new item(false, "1.0 Introduction","1741","",3)
        ix++
        outline[ix] = new item(false, "2.0 Purpose","1742","",3)
        ix++
        outline[ix] = new item(false, "3.0 Membership","1743","",3)
        ix++
        outline[ix] = new item(true, "4.0 Responsibilities","1744","a",3)
        ix++
        outline[ix] = new item(false, "4.1 The PM Chairperson...","17441","",4)
        ix++
        outline[ix] = new item(false, "4.2 Service Program Office members will...","17442","",4)
        ix++
        outline[ix] = new item(false, "4.3 User members will...","17443","",4)
        ix++
        outline[ix] = new item(false, "4.4 Test and Evaluation Organization members will...","17444","",4)
        ix++
        outline[ix] = new item(false, "5.0 Procedure","1745","",3)
        ix++
        outline[ix] = new item(false, "Appendix E","175","",2)
        ix++

  setStates()
  setImages()
}

function resetStates() {
  setCookie("cpc guidebook_outline", "-")
}

function setStates() {
  var storedValue = getCookie("cpc guidebook_outline")
  var parentExpanded = true
  var lastExp = 0
  var text = ""
  var k = 0

  storedValue += "-"
  for (var i = 0; i < outline.length; ++i) {
    if (outline[i].parent) {
      text = "-" + outline[i].id + "-"
      if (storedValue.indexOf(text) != -1)
        outline[i].state = true
      else
        outline[i].state = false
    }
  }

  for (var i = 0; i < outline.length; ++i) {
    if (outline[i].parent) {
      if ((outline[i].depth == 0) || (outline[i].depth <= lastExp) || (parentExpanded)) {
        outline[i].visible = true
        if (outline[i].state)
          lastExp = outline[i].depth + 1
        else
          if (outline[i].depth < lastExp)
            lastExp = outline[i].depth
      } else
        outline[i].visible = false
      parentExpanded = (outline[i].state && outline[i].visible)
    } else {
      if (parentExpanded)
        outline[i].visible = true
      else
        outline[i].visible = false
    }
  }
}
function setImages() {
  for (var i = 0; i < outline.length; ++i) {
    if (outline[i].visible)
      if (outline[i].parent)
        if (((outline[i+1].parent) && (outline[i+1].depth <= outline[i].depth)))
          outline[i].pic = '<IMG SRC="../../minus.gif" BORDER=0>'
        else
          if (outline[i].state)
            outline[i].pic = '<A HREF="javascript:toggle(' + i + ')"><IMG SRC="../../minus.gif" BORDER=0></A>'
          else
            outline[i].pic = '<A HREF="javascript:toggle(' + i + ')"><IMG SRC="../../plus.gif" BORDER=0></A>'
      else
        outline[i].pic = '<IMG SRC="../../leaf.gif" BORDER=0>'
  }
}
function toggle(num) {
  outline[num].state = !outline[num].state

  setStorage()
  history.go(0)
}
function setStorage() {
  var text = "-"
  for (var i = 0; i < outline.length; ++i) {
    if ((outline[i].parent) && (outline[i].state)) {
      text += (outline[i].id)
      text += '-'
    }
  }

  setCookie("cpc guidebook_outline", text)
}
function drawTree(myname) {
  document.write('<table>');
  for (var i = 0; i < outline.length; ++i) {
    if (outline[i].visible) {
      document.write('<tr><td align=right valign=top colspan=',(outline[i].depth + 1),'>')
      document.write(outline[i].pic, ' ')
      document.write('</td><td colspan=',(8-outline[i].depth))
      if (myname == outline[i].file)
        document.write(' class="boldredtxt"><b>', outline[i].text, '</b>')
      else
        document.write('><a href="',outline[i].file,'.html">', outline[i].text, '</a>')
      document.write('</td></tr>')
    } else {
      var previous = i
      for (var k = i + 1; k < outline.length && outline[k].depth >= outline[previous].depth; ++k) {
        ++i
      }
    }
  }
  document.write('<tr>');
  for (var j = 0; j < 12; ++j) { document.write('<td width=12>&nbsp;</td>') }
  document.write('</tr></table>');
}
makeDatabase()


