var chapterCount=0
var currentChapter=1;
var amInChapter=false;
chaptersDefined=true;
// Are we being called with a placement instruction
var loc=document.location.toString();
var iHash = loc.indexOf("#");
if (iHash>-1)
{
var locator = loc.substr(iHash+1);
currentChapter = parseInt(locator);
if (isNaN(currentChapter) || currentChapter<0) currentChapter=1;
if (is.ie) location.hash="";
if (amLoaded)
{
JumpToChapter(currentChapter);
}
}
function BeginChapter()
{
var out;
var top;
if (is.major<4) return;
if (is.ie || is.nn)
{
var thedoc;
if (is.ie) thedoc=document;
else thedoc=document.layers["outer"].document;
chapterCount++;
//out = "
"
out = "
\r\n";
thedoc.write(out);
amInChapter=true;
}
}
function ChapterBack()
{
JumpToChapter(currentChapter-1)
return;
}
function ChapterNext()
{
JumpToChapter(currentChapter+1)
return;
}
function EndChapter()
{
var out;
if (is.major<4 || !amInChapter) return;
amInChapter=false
out = "
\r\n";
var chapter = "chapter" + chapterCount;
if (is.ie) thedoc=document;
else thedoc=document.layers["outer"].document[chapter].document;
thedoc.write(out);
}
function DeclareChapters()
{
if (is.major<4 || chapterCount>0) return;
if (is.ie)
{
document.write("
\r\n");
}
}
function StopChapters()
{
if (is.major<4) return;
if (is.ie)
{
document.write("
");
}
}
function JumpToChapter(newChapter)
{
if (is.major<4 || newChapter<1 || newChapter>chapterCount) return;
var chapter = "chapter" + currentChapter;
if (is.ie)
{
if (newChapter != currentChapter) document.all[chapter].style.visibility="hidden";
/*if (currentChapter==1)
{
document.all["btnBack"].style.visibility="visible";
}
else if (currentChapter==chapterCount)
{
document.all["btnNext"].style.visibility="visible";
}*/
}
else if (is.nn)
{
if (newChapter != currentChapter) document.layers["outer"].document[chapter].visibility="hidden";
/*if (currentChapter==1)
{
document.layers["lbtnBack"].visibility="visible";
}
else if (currentChapter==chapterCount)
{
document.layers["lbtnNext"].visibility="visible";
}*/
}
currentChapter=newChapter;
chapter = "chapter" + currentChapter;
if (is.ie)
{
document.all[chapter].style.visibility="visible";
if (currentChapter==chapterCount)
{
document.all["btnNext"].style.visibility="hidden";
}
else
{
document.all["btnNext"].style.visibility="visible";
}
if (currentChapter==1)
{
document.all["btnBack"].style.visibility="hidden";
}
else
{
document.all["btnBack"].style.visibility="visible";
}
}
else if (is.nn)
{
document.layers["outer"].document[chapter].visibility="visible";
if (currentChapter==chapterCount)
{
document.layers["lbtnNext"].visibility="hidden";
}
else
{
document.layers["lbtnNext"].visibility="visible";
}
if (currentChapter==1)
{
document.layers["lbtnBack"].visibility="hidden";
}
else
{
document.layers["lbtnBack"].visibility="visible";
}
}
return false;
}