//JavaScript cMajor

/***SET MORE GLOBAL VARIABLES***/
FilenameCurrentRecord="";
SiFiUserInput="";
ListLinkInfo="";
ThisPageStem=FilenameStem;

FilenameOfList=GetListRef(dlistNumber);
if (FilenameInitial=="f" && SeriesCode!="Defns") {ListLinkInfo=SeriesTitle+SP+LB+SeriesTally+SP+KEY[48]+RB;}
    KEY[2]=ListLinkInfo;//remove mid 2012
//FilenameOfImgSq=GetIsq(FilenameStem);
LessonOrServiceNumber=GetLessonNum(FilenameStem);
   KEY[5]=LessonOrServiceNumber;//remove mid 2012
FilenameOfNext=ww+FilenameInitial+NextPageStem+FilenameExtension;
  KEY[7]=FilenameOfNext;//remove mid 1012
  if (FilenameOfNext==ww+"dindex.htm")  {FilenameOfNext=ww+"index.htm";}
  if (FilenameOfNext==ww+"dnotfound.htm")  {FilenameOfNext=ww+"dhome.htm";}
  if (FilenameOfNext==ww+"dnew.htm")  {FilenameOfNext=ww+"dhome.htm";}
KEY[76]=ww+FilenameInitial+PrevPageStem + FilenameExtension;
  if (KEY[76]==ww+"dindex.htm")  {KEY[76]=ww+"index.htm";}
  if (KEY[76]==ww+"dnotfound.htm")  {KEY[76]=ww+"dnew.htm";}
  if (KEY[76]==ww+"dhome.htm")  {KEY[76]=ww+"dnew.htm";}
KEY[78]=GetLessonNum(PrevPageStem);//prev
NumberOfNext=LB+GetLessonNum(NextPageStem)+RB;//next
KEY[79]=LB+KEY[78]+RB;//prev
KEY[10]=LB+LessonOrServiceNumber+RB;//curr
PageTitle=GetTitle(FilenameStem);
   KEY[11]=PageTitle;//Remove mid 2012 (defunct KEY)
SubTitle=GetSubTitle(FilenameStem); KEY[12]=SubTitle
AuthorLine='<span class="tiny italic"><a href="dauthor.htm" title="Author&rsquo;s biography">By Ron Graham</a></span>'; 
ByLine=AuthorLine;
KEY[13]="";
KEY[14]=GetAlt(FilenameStem);
KEY[15]="";
KEY[22]="";
QuizRandomNumberString="000"//initialise quiz question selector
KEY[71]=GetFslotKeyWds(FilenameStem); if(KEY[71]=="blank"){KEY[71]="";}
NextTabAlt="Next "+PageDescr("")+" ~&nbsp;"+NumberOfNext+SP+GetAlt(NextPageStem);
KEY[92]=NextTabAlt;
KEY[85]="Previous "+PageDescr("")+" ~&nbsp;"+KEY[79]+SP+GetAlt(PrevPageStem);
KEY[99]="1";//spin buttons
KEY[98]=GetUsage(FilenameStem);//GetUsage function is in the cMinor script
KEY[43]=Uz(KEY[98]);//Uz function in Library converts data string to notice
KEY[41]+=GetCopyrightYears(FilenameStem);
KEY[59]=Ppdf;
MentalityString=""; 
SimpleModeSrchresEntry="";
SearchIconSlot="";

/***PAGE BANNER PRINT VERSION***/
if (Psimple=="OFF"){new printtitle()}
function printtitle() {
document.write('<p class="bprt">'+minimizedtitle()+'</p>');
}

/***PAGE BANNER SIMPLE***/
if (Psimple=="ON"){new simpletitle()}
function simpletitle() {
document.write('<p>'+PageHeaderSimple()+'</p>');
}

/***PAGE BANNER ONELINE***/
function onelinebanner() {
document.write('<p>'+AssembleFinderPageTop()+'</p>');
}

/***TITLE LINE***/
function TitleLine()
{
var a="";
if (Prange>=3 && SeriesCode!="Defns") {a='<br /><span class="keyword">THIS PAGE:</span> <span class="purple italic">'+PageTitle+' &mdash;'+SubTitle+'</span><br />'};
return a
}

/***MINIMIZED TITLE (SUBROUTINE)***/
function minimizedtitle() {
var a,b,c,d,e;
a='<span class="minimtitle"><span class="pvhead">'+PageTitle+'</span>';
b='<span class="nb"> &mdash;Part '+PartNumber+CS+B1;
c='<span class="green italic">'+SeriesTitle+CS+B1;
d=ByLine+B1;
e=WW+CS;
return a+b+c+d+e
}


/***OPEN PAGETOP***/
if (Psimple=="OFF" && Printpv=="OFF") {new ptopopen()}
function ptopopen() {
var a='<div class="header2" id="Top">'
document.write(a);
}//end ptopopen

/***PAGE TOP MENU***/
if (Psimple=="OFF" && Printpv=="OFF") {new ptopmenu()}
function ptopmenu() {
var c,d,e,f,g,h,i,j,n,s,t
a='<span class="topmenubtn"><a href="';
b='</a></span> ';
c=a+ww+'dhome.htm">HOME'+b;
d=a+'#PageEnd"><span class="nb">PICK-A-BOX</span>'+b;
e=a+ww+'dalpha.htm"><span class="nb">INDEX A-Z</span>'+b;
f=a+ww+'dglossary.htm">WORDS'+b;
g=a+ww+'dcontents.htm">STUDIES'+b;
h=a+ww+'dinfo.htm">ABOUT&nbsp;US'+b;
i=a+ww+'dhub.htm">THE&nbsp;HUB'+b;
j=a+ww+'f517.htm">TRAINING'+b;
n="";
if (Prange==5 && XFNI!=1) {n='&nbsp;&nbsp;&nbsp;<span class="small white">'+NFNI;
n+="&mdash;"+YFNI+"</span>";}
document.write('<div id="topmenu">'+c+d+e+f+g+h+i+j+n+'</div>');
}

/***PAGE TOP LOADING***/
if (Psimple=="OFF" && Printpv=="OFF") {new ptoploading()}
function ptoploading() 
{
var a='<img src="imgpageload.jpg" alt="page loading" title="page loading" />';
KEY[21]='<div id="loading">'+a+'</div>'; document.write(KEY[21]); 
}

/***PAGE BANNER 1.***/
if (Psimple=="OFF" && Printpv=="OFF" && Prange==1) {new banner1();}
function banner1() {
var a,b,c,d,e;
a='<p><a href="#PageEnd"><img src="imglogo.gif" class="logo" alt="logo" title="'+LT+'" width="191" height="58" /></a></p>';
b='<p class="center simpletitle">'+minimizedtitle()+'</p>';
c=AssembleFinderPageTop();
document.write(a+b+c);
new ptopclose()
}

/***PAGE BANNER 2.***/
if (Psimple=="OFF" && Printpv=="OFF" && Prange==2) {new banner2();}
function banner2() {
var a,b,c,d,e,f;

a='<p class="center">';
b='<a href="#PageEnd"><img src="imglogo.gif" class="logo" alt="logo" title="'+LT+'" width="213" height="64" /></a>';
c='<span class="small">'+ptopisq()+'</span></p>';
d='<p class="center"><span class="btpi">'+SeriesTitle+'</span><br />';
e='<span class="green italic">'+SubTitle+'</span></p>';
f=AssembleFinderPageTop();
document.write(a+b+c+d+e+f);
new ptopclose()
}

/***PAGE BANNER 3.***/
if (Psimple=="OFF" && Printpv=="OFF" && Prange>=3) {document.write(AssembleFinderPageTop()); new ptopclose();}

/***BANNER SQUARE and IMAGE MAP***/
function ptopisq() 
{
var I="<img src='"+FilenameOfImgSq+"' alt='NEXT' class='imgyb' width='100' height='100' title='Top of the Tree' usemap='#SwitchPge' />";
if (SeriesCode=="TreeT") {return I}
var m1="<map id='SwitchPge' name='SwitchPge'>",m2="<area shape='rectangle' href='",m3="' coords='0,0,100,50' />";
var m4="' alt='"+KEY[92]+"' title='"+KEY[92],m5="' alt='"+ListLinkInfo+"' title='"+GetListInfo(),m6="' coords='0,50,100,100' /></map>";
KEY[23]='<span id="isqtop">'+I+m1+m2+FilenameOfNext+m4+KEY[13]+m3+m2+FilenameOfList+m5+m6+'</span>'; return KEY[23];
}


/***CLOSE PAGETOP***/
function ptopclose() {
document.write('</div>');
}

/***FIX-PAGE & ACCESSIBILITY BUTTON***/

new FixPage()
//Library.  Called again on dsrchres.htm to pick up SimpleModeSrchresEntry

/***SIDEBAR***/

if (Sidebar=="ON" && Psimple=="OFF" && Prange >=4) {new sidebaropen()}
function sidebaropen() {
document.write('<div id="sidebar2">'+SideBar()+'</div>');
}


/***OPEN CONTENT***/
if (Psimple=="OFF" && Printpv=="OFF" && Prange>=4) {new contentopen()}
function contentopen() {
var n="1"; if (Sidebar=="ON"){n="2";} 
document.write('<div id="content'+n+'">');
}

/***PARTS TABS***/
new showparts()
function showparts() {
document.write(PartsTabs());
}

/***POINT HEADINGS (SUBROUTINE)***/
function Point(n) {
if (Printpv=="ON") {return "";}
new DownArrow(n);
}

/***PAGE END (called on page)***/
if (Psimple=="OFF")
{
new peMPSButtons(); new peFinder(); new mPickBoxHd(); new mTopBox(); new mPartBox(); new mPrevBox();
new mNextBox(); new mListBox(); new mPrintvBox(); new mPrintpBox(); new mThreadBox(); new mChartBox(); new mReadmeBox();
new mOnlineBibleBox(); new mAlphaBoxes(); new mServiceBoxes(); new peplate(); new KangaKorna();
}

function peMPSButtons() {return MPSButtons();}
function peFinder() {KEY[47]=AssembleFinderPageEnd();}
function mPickBoxHd() {KEY[29]=B1+"<a name='PageEnd' id='PageEnd' href='#PageEnd'><span class='bold italic'>Pick a box...</span></a>"+B1}
function mTopBox(){KEY[29]+="<a href='#Top'><img src='ztop.jpg' alt='Top' title='Top of this page ~&nbsp;"+GetTabTi(AliasStem)+"' /> </a>";}
function mPartBox() {KEY[29]+=GetPartBox();}
function mPrevBox(){KEY[30]=" <a href='"+KEY[76]+"'><img src='zprev.jpg' alt='"+KEY[85]+KEY[15]+"' title='"+KEY[85]+KEY[15]+"' /></a>";}
function mNextBox(){KEY[31]=" <a href='"+FilenameOfNext+"'><img src='znext.jpg' alt='"+KEY[92]+KEY[13]+"' title='"+KEY[92]+KEY[13]+"' /></a>";}
function mListBox(){KEY[32]=" <a href='"+FilenameOfList+"'><img src='zlist.jpg' alt='"+ListLinkInfo+"' title='"+GetListInfo()+"' /></a> ";}
function mPrintvBox(){KEY[32]+=GetPdfBox(Alias);}
function mPrintpBox(){KEY[32]+=GetPrintpBox(Alias);}
function mThreadBox(){KEY[93]=GetThreads(FilenameStem); if (KEY[93]!="") {KEY[33]=GetThreadArray(KEY[93]);}}
function mChartBox(){KEY[94]=GetChartFiles(); KEY[34]=GetCharts(KEY[94]);}
function mReadmeBox(){KEY[95]=GetReadMe(FilenameStem); KEY[35]=GetReadMeBoxes(KEY[95])}
function mOnlineBibleBox(){KEY[96]=GetBibleBkCh(FilenameStem); KEY[36]=GetBibleBoxes(KEY[96]);}
function mAlphaBoxes(){KEY[37]="<center>"+AssembleAlphaBoxes();}
function mServiceBoxes(){KEY[38]=AssembleSvceBoxes();}
function peplate(){KEY[40]=AssembleEndPlate();}

function PrintPageEnd()
{
if (Psimple=="ON"){new SimpleFooter(AliasStem)}
//nextline: open normal footer div (nested inside content div) 
var i=0; var x=""; var d1 ="<div id='footer2' class='center noprint'>"; 
document.write(d1+peMPSButtons()+'<center>'+KEY[47]);//finder
for (i=29; i<=38; i++) {x+=(KEY[i]);
document.write(KEY[i])}//next i (loop displays boxes)
if (Prange==2 || Prange==3) {KEY[40]+=PageData()}
document.write(KEY[40]);//endplate

new validate()
new closefooter();
new closecontent();
}

/***CLOSE FOOTER (SUBROUTINE)***/

function closefooter(){
document.write("</div>");
}

/***CLOSE CONTENT (SUBROUTINE)***/
function closecontent(){
if (Printpv=="ON") {document.write(PrintVersionStripe("bot"));}
if (Psimple=="OFF" && Printpv=="OFF") {document.write("</div>");}
}



/***XHTML VALIDATION***/
function ValidationURLfrag()
{
var H=location.href;
if (H.indexOf("simplybible.com.au")>=0) {return "www.simplybible.com.au%2F"}
if (H.indexOf("datafast.net.au")>=0) {return "members.datafast.net.au%2Fsggram%2F"}
if (H.indexOf("net-tech.com.au")>=0) {return "members.datafast.net.au%2Fsggram%2F"}
return "members.datafast.net.au%2Fsggram%2F"
}

function validate(){
var a,b,c,d;
w='';
a='<p class="center"><a href="http://validator.w3.org/check?uri=http%3A%2F%2F';
b=ValidationURLfrag();
c=Alias;
d='"><span class="white">.</span></a></p>';

document.write(w+a+b+c+d);
}

/***STATS ANALYSIS***/

function GoogleStatsRef()
{
var H=location.href;
if (H.indexOf("simplybible.com.au")>=0) {return "UA-25628597-1"}
if (H.indexOf("datafast.net.au")>=0) {return "UA-3155848-1"}
if (H.indexOf("net-tech.com.au")>=0) {return "UA-3155848-1"}
return "localhost"
}

document.write('<script type="text/javascript">'+"var _gaq = _gaq || [];_gaq.push(['_setAccount', '"    +"UA-25628597-1"+   "']);_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);  })();</script>");


/***DEBUG***/

//LIST ALL KEYS
//for (x=0; x<=99; x++) {document.write("<br /> "+x+" "+KEY[x]); if (KEY[x]=="") {document.write(" null");}}

/***END OF SCRIPT (cMajor.js)***/
