/*Script copyrighted 2002-2007, Andrew McCafferty, All rights reserved.*/

//Variables - eCO is the list of open folders,  eUC = true if using cookies, eGSTR -- used to store HTML code which is then written at one shot, eO[sec9] = true if folder with id = sec9 is open, eGN maps section number to name - only used for exposed functions, eFL is true on first load
var eCO='',eUC=true,eGSTR="",eO=new Object(),eGN=new Object(), eFL=false;
//Generic browser variables - fn is location to reload (must use a variable), ncf--number closed folders, ml-left margin--of next folder/pagelink
var eFN=document.location,eML=0,eNCF=0;
//Scroll variables
var eXOFF=false,eSTOP=false;
//Mouseover variables - eOSEC and its parents are the only open sections in mouse-over menu
var eOSEC="",eINTTIME,eINTTIME2;
//Browser snoop variables
var eAGT=navigator.userAgent.toLowerCase(),ePI=parseInt(navigator.appVersion);
var eIE=((eAGT.indexOf('msie')!=-1)&&(document.all));
var eW3C=false,eGB=false,eMAC=(eAGT.indexOf('mac')!=-1);
if(document.getElementById){eW3C=true};eGB=!eW3C;if(eGB){eUC=true};if(document.images){};
//write main folder
function eMF(eSECN9,eK,eNAME,eHREF,eWIDTH){eGN[eSECN9]=eNAME;if(eW3C){var t1,t2,t3,t;if(eWIDTH==''){t=''}else{t='width='+eWIDTH};if(eDROPDOWNMENU(eK)){t1="onMouseOut=eMO('"+eSECN9 +"','"+eK +"',event) onMouseOver=eMI('"+eSECN9 +"','"+eK +"',event)";t2="display:None;position:absolute";t3=" style='cursor:pointer'"}else{t1="";t2="display:None";t3=" style='cursor:pointer;margin-left:9px'"};var t4; if(eII(eK,'nf')){t4= 'a'}else{t4='span'};eDW("<div id='c"+eSECN9+"' "+t1+" class='MainFolderBox"+eCLASSNAME(eK)+"'"+t3+"><table "+t+"><tr><td>");if(eII(eK,'nl')){eDW(eNAME)}else{eDW("<"+t4+" ");eCCMF(eSECN9,eK,eNAME,eHREF);eDW("</"+t4+">")};eDW("</td></tr></table><div class='MainFolderPage' id='"+eSECN9 +"' style='"+t2+"'>")}else if(eGB){eDW("<p id='c"+eSECN9 +"' class='MainFolderBox"+eCLASSNAME(eK)+"' style='margin-left:9px'><a ");eCCMF(eSECN9,eK,eNAME,eHREF);eDW('</a></p>');if(eSIO(eCO,eSECN9)){eNCF=0;eML=18}else{eNCF=1}}}
//choose common main folder
function eCCMF(eSECN9,eK,eNAME,eHREF){if(eII(eK,'nf')){eCLK(eSECN9,eK,eNAME,eHREF)}else{eCMF(eSECN9,eK,eNAME,eHREF)}}
//write subfolder--eGB: write if father open, add one to ncf unless sf itself is open
function eSF(eSECN10,eK,eNAME,eHREF,eWIDTH){eGN[eSECN10]=eNAME;if(eW3C){var t1,t2,t3,t;if(eWIDTH==''){t=''}else{t='width='+eWIDTH}; if(eDROPDOWNMENU(eK)){t1="onMouseOut=eMO('"+eSECN10 +"','"+eK +"',event) onMouseOver=eMI('"+eSECN10 +"','"+eK +"',event)";t2="display:None;position:absolute";t3=""}else{t1="";t2="display:None";t3=" style='margin-left:9px'"};eDW("<div id='c"+eSECN10 +"' "+t1+" class='SubFolderBox"+eCLASSNAME(eK)+"'"+t3+"><table "+t+"><tr><td><span ");eCSF(eSECN10,eK,eNAME,eHREF);eDW("</span></td></tr></table><div class='SubFolderPage' id='"+eSECN10 +"' style='"+t2+"'>");}else if(eGB){if(eSIO(eCO,eGF(eSECN10))){eDW("<p id='c"+eSECN10 +"' class='SubFolderBox"+eCLASSNAME(eK)+"' style='margin-left: "+eML +"px'><a ");eCSF(eSECN10,eK,eNAME,eHREF);eDW('</a></p>')};if(eSIO(eCO,eSECN10)){eNCF=0;eML=eML+9}else{eNCF =eNCF +1}};}
//write link line--i,r,e:internal,rightframe,external link--nf:no folder-used when page-link used as mainfolder
function eLK(eSECN8,eK,eNAME,eHREF,eWIDTH){eSECN8='b'+eSECN8;eGN[eSECN8]=eNAME;if(eW3C){var t1,t2,t;if(eWIDTH==''){t=''}else{t='width='+eWIDTH};if(eDROPDOWNMENU(eK)){t1="";t2="onMouseOver=eMI('"+eSECN8 +"','',event)"}else{t1=" style='margin-left:9px'";t2=""}; eDW("<div id='c"+eSECN8 +"' "+t2+" class='LinkBox"+eCLASSNAME(eK)+"'"+t1+"><table "+t+"><tr><td class='LinkPage'>");if(eII(eK,'nl')){eDW(eNAME)}else{eDW("<a ");eCLK(eSECN8,eK,eNAME,eHREF);eDW("</a>")};eDW("</td></tr></table></div>")}else if(eGB){if(eNCF==0){eDW("<p id='c"+eSECN8 +"' class='LinkBox"+eCLASSNAME(eK)+"' style='margin-left:"+eML +"px'>");if(eII(eK,'nl')){eDW(eNAME);}else{eDW("<a ");eCLK(eSECN8,eK,eNAME,eHREF);eDW("</a>")};eDW('</p>')};}}
//write column
function eCOL(){eDW("</TD><TD class='MenuTreeBox' valign='top'>");}
//write end of div
function eDE(){if(eW3C){eDW("</div></div>")}else if(eGB){if(eNCF==0){eML=eML-9}else{eNCF=eNCF-1}};}
//common main folder
function eCMF(eSECN12,eK,eNAME,eHREF){eOSFL(eK,'mfo',eSECN12);if(eGB&&eSIO(eCO,eSECN12)){eO[eSECN12]=true};var t1; if(eDROPDOWNMENU(eK)){t1=eHREF}else{t1="if(!eO['"+eSECN12 +"']){"+eHREF +"};eCK('"+eSECN12 +"','"+eK +"')"};eDW(eWA(eSECN12,eK,eNAME,"{"+t1+";return false}","javascript:{\\}","MainFolderLine"+eCLASSNAME(eK)));eDW(""+eNAME)}
//common subfolder
function eCSF(eSECN13,eK,eNAME,eHREF){eOSFL(eK,'sfo',eSECN13);if(eGB&&eSIO(eCO,eSECN13)){eO[eSECN13]=true};var t1; if(eDROPDOWNMENU(eK)){t1=eHREF}else{t1="if(!eO['"+eSECN13 +"']){"+eHREF +"};eCK('"+eSECN13 +"','"+eK +"')"};eDW(eWA(eSECN13,eK,eNAME,"{"+t1+";return false}","javascript:{\\}","MainFolderLine"+eCLASSNAME(eK)));eDW(""+eNAME)}
//common link
function eCLK(eSECN8,eK,eNAME,eHREF){var eCN,eOCJS;if(eII(eK,'j')){eOCJS=eHREF+";return false";eHREF="javascript:{\\}"}else{eOCJS="eSSC(0,0);return true";eHREF=eCNV(eHREF,eK,eNAME)};if(eII(eK,'nf')){eCN='MainFolderLine'}else{eCN='LinkLine'};eDW(eWA(eSECN8,eK,eNAME,eOCJS,eHREF,eCN+eCLASSNAME(eK)));eDW(eNAME)}
//write anchor tag
function eWA(eSECN14,eK,eNAME,ocjs,href,cn){var t=""; if(eII(eK,'e')){t="target=_blank"};return "id='a"+eSECN14+"' onclick=\""+ocjs+"\" href=\""+href+"\" onMouseOver=\""+eWAMO(cn,eNAME)+";return true\" onMouseOut=\""+eWAMT(cn)+";return true\"  style='{white-space:nowrap;}' class='"+cn+"' "+t+">"}
//write mouseover and mouseout functions
function eWAMO(cn,eSTR){return "if(eW3C){this.className='"+cn+"MouseOver'}"}
function eWAMT(cn){return "if(eW3C){this.className='"+cn+"'}"}
//write image
function eWI(eSECN14,gif,h,w){return "<IMG border='0' src='"+gif+"' id='i"+eSECN14+"'>&nbsp;"}
//click functions
function eCK(eSECN8,eK){if(!eDROPDOWNMENU(eK)){eUDC(eSECN8)};eCK2(eSECN8)}
function eCK2(eSECN8){if(eW3C){if(eO[eSECN8]){eO[eSECN8] = false;eGO(eSECN8).style.display = "none"}else{eO[eSECN8] = true;eGO(eSECN8).style.display = "";eGO(eSECN8).style.zIndex=2000};}else if(eGB){eSSHW();window.location.href=eFN};}
// Open section on first load
function eOSFL(eK,eT,eSECN9){if(eFL&&eII(eK,eT)&&!eDROPDOWNMENU(eK)&&eUC){eOSC(eSECN9),eCO=eGC('menuJeffrey_Jue')}}
// is main folder
function eISMF(eSECN12){return eSECN12!="out"&&eSECN12.indexOf("d",eSECN12.indexOf("d")+1) == -1}
//division ID--reference to division with id of secn, ie4 uses 'all'
function eGO(eSECN10){if (document.getElementById){return eval(document.getElementById(eSECN10))}else{return eval(document.all(eSECN10))}}
//open the sections for one id number -- called by oas
function eOS(eSECN16){if(eGB){if(!eO[eSECN16]){eCK2(eSECN16)}}else{var start=0;start = eSECN16.indexOf("d",start) + 1;start = eSECN16.indexOf("d",start) + 1;while(start > 0){if(!eO[eSECN16.substring(0,start-1)]){eCK2(eSECN16.substring(0,start-1))};start = eSECN16.indexOf("d",start) + 1};if(!eO[eSECN16]){eCK2(eSECN16)}}}
//close the section for one id number -- not used in program
function eCS(eSECN16){if(eO[eSECN16]){eCK2(eSECN16)}}
//get father of section.  gf('e1d1')='', gf('e1d1d2')='e1d1'
function eGF(eSECN2){if(eSECN2.substring(0,1)=='b'){eSECN2=eSECN2.slice(1)};var j, p=eSECN2.lastIndexOf('d'); j = eSECN2.substring(0,p).lastIndexOf('d');if(j==-1){return ""}else{return eSECN2.substring(0,p)}}
// document write -- actually stores str to gstr, later written in one shot
function eDW(str){eGSTR += str}
//gif -- either main or subfolder, either open or closed, bool = mainfolder
function eGIF(eSECN11,bool){if(bool){if(eO[eSECN11]){return ""}else{return ""}}else{if(eO[eSECN11]){return ""}else{return ""}}}
//b is in k
function eII(k,b){if(k.indexOf(b)>-1){return true};return false}
function eCH(eNAME){if(eII(eNAME,"'")||eII(eNAME,"</")){return ""};return eNAME}
//update cookie and eCO -- called on every click.
//This first sets cookie and then reads that cookie into eCO.
function eUDC(eSECN8){if(eUC){if(eSIO(eCO,eSECN8)){eCSC(eSECN8)}else{eOSC(eSECN8)};eCO=eGC('menuJeffrey_Jue')}}
//'open section cookie -- only called by udc, changes cookie and nothing else
//rewrites entire cookie --includes sec16 NON-ancesters and sec16 
function eOSC(eSEC16){var nc='',start=0,end;end=eCO.indexOf('x',start);while(end>0){if(!eSIO(eSEC16,eCO.substring(start,end))){nc=nc+eCO.substring(start,end)+'x'};start=end+1;end=eCO.indexOf('x',start)};eSC('menuJeffrey_Jue',nc+eSEC16+'x')}
//'close section cookie' -- only called by udc, changes cookie and nothing else'
//rewrites entire cookie -- delete the section and all its children, and add its father
function eCSC(eSEC16){var nc='',start=0,end;end=eCO.indexOf('x',start);while(end>0){if(!eSIO(eCO.substring(start,end+1),eSEC16)){nc=nc+eCO.substring(start,end)+'x'};start=end+1;end=eCO.indexOf('x',start)};if(eGF(eSEC16)!=''){nc=nc+eGF(eSEC16)+'x'};if(nc==''){nc='none'};eSC('menuJeffrey_Jue',nc)}
//section is open -- used in eGB to whether a section is open. eCOX is usually the cookie (AMS: unclear to me now).
function eSIO(eCOX,eSECN11){if(eII(eCOX,eSECN11+'d')||eII(eCOX,eSECN11+'x')){return true}else{return false}}
//oas is used when loading a page with a tree menu, unless 'prjChkAllMenusClosed'is checked.
//calls os for all the sections in cookie--this will do nothing is co is 'none' or '0'.
function eOAS(){var start=0,end;end=eCO.indexOf('x',start);while(end>0){eOS(eCO.substring(start,end));start=end+1;end=eCO.indexOf('x',start)};}
//get cookie--cookie is prjName=secn
function eGC(eCOOKIENAME){var cs=document.cookie,s=-1,m,e;while(s<cs.length){m=cs.indexOf('=',s);e=cs.indexOf(';',m);if(e==-1){e=cs.length};if(cs.substring(s+1,m)==eCOOKIENAME){return cs.substring(m+1,e)};s=cs.indexOf(';',s+1);if(s==-1){s=cs.length};s=s+1};return '0'}
//save cookie
function eSC(eCOOKIENAME,eSECN){document.cookie=eCOOKIENAME+'='+eSECN+';path=/'}
//set current scroll height and width to a cookie
function eSSHW(){var t=0,l=0;if(eXOFF){l=window.pageXOffset;t=window.pageYOffset}else if(eSTOP){t=document.body.scrollTop;y=document.body.scrollLeft};eSSC(l,t)}
//set scroll cookies
function eSSC(l,t){eSC('menuJeffrey_JueLeft',l);eSC('menuJeffrey_JueTop',t)}
//scroll to the scroll cookies
function eSTSC(){var l,t;l=eGC('menuJeffrey_JueLeft');t=eGC('menuJeffrey_JueTop');if(eXOFF){window.scroll(l,t)}else if(eSTOP){document.body.scrollLeft=l;document.body.scrollTop=t}}
//cookie test -- return true if cookies on.  Note: this changes the cookie, but cookie to co below.
function eCT(){eSC('menuJeffrey_Jue','t');;if(eGC('menuJeffrey_Jue')=='t'){return true};return false}
function eCLASSNAME(eK){var t1; t1=eK.indexOf('cn');if(t1>-1){return eK.substring(t1+2,t1+4)} else {return ''}}
//Scripting the Menu Tree function
function eOPENPAGE(ln){eOS(eGF(eGI(ln)));}
function eCLOSEPAGE(ln){eCS(eGF(eGI(ln)));}
function eOPEN(ln){eOS(eGI(ln));}
function eCLOSE(ln){eCS(eGI(ln));}
function eSWAP(ln,att,val,aic){if(eW3C){var t = eGO(aic + eGI(ln)); eval("t." + att + "= '"+ val + "'")}}
function eSWAPBOX(ln,att,val){eSWAP(ln,att, val,"c")}
function eSWAPIMAGE(ln,att,val){eSWAP(ln,att,val,"i")}
function eSWAPLINE(ln,att,val){eSWAP(ln,att,val, "a")}
function eGI(eNAME){for(x in eGN){if(eGN[x]==eNAME){return x}}return "No such link"}
function eGP(eNAME){var eSEC='', ePATH=eNAME;eSEC=eGF(eGI(eNAME));while(eSEC!=""){ePATH=eGN[eSEC] + '&nbsp;&rarr;&nbsp;' + ePATH;eSEC = eGF(eSEC)}return ePATH}
//Begin mouseover menu functions.
//Drop down menu if eW3C and 'dd' is in k
function eDROPDOWNMENU(eK){if(eW3C&&eII(eK,"dd")){return true};return false}
//open section eSECN9 near eOSEC-first set to same place as eOSEC then adjust
function eSETPOSITION(eSECN9,eK){var eT,ePTOP,ePLEFT,eOBJ,eOBJNEW,eFTOP=false,eFLEFT=false,eFSHIFT=0;if(eII(eK,"to")){eFTOP=true}; if(eII(eK,"le")){eFLEFT=true};eT=eK.indexOf('.');if(eT==-1){eFSHIFT =1}else{eFSHIFT=eK.substring(eT,eT+3)};eOBJ= eGO("c"+eSECN9);eOBJNEW= eGO(eSECN9);ePLEFT=eTOTALLEFT(eOBJ); ePTOP=eTOTALTOP(eOBJ);if(eFTOP){ePTOP=ePTOP-eOBJNEW.offsetHeight;if(eFSHIFT==1){ePTOP=ePTOP+eOBJ.offsetHeight}}else if(!eFTOP){if(eFSHIFT!=1){ePTOP=ePTOP+eOBJ.offsetHeight}}if(!eFLEFT){ePLEFT=ePLEFT+(eOBJ.offsetWidth*eFSHIFT)}else if(eFLEFT){ePLEFT=ePLEFT-(eOBJNEW.offsetWidth*eFSHIFT)};eOBJNEW.style.left =ePLEFT+"px";eOBJNEW.style.top =ePTOP + "px"}
function eTOTALTOP(eOBJ){var t=0;while(eOBJ){if(eOBJ.style.position=='absolute'){return t};t=t+eOBJ.offsetTop;eOBJ=eOBJ.offsetParent};return t}
function eTOTALLEFT(eOBJ){var t=0;while(eOBJ){if(eOBJ.style.position=='absolute'){return t};t=t+eOBJ.offsetLeft;eOBJ=eOBJ.offsetParent}return t}
function eMI(eSECN9,eK,evt){if(window.event){window.event.cancelBubble=true}else{evt.cancelBubble=true};if(!eII(eK,'nf')){if(eINTTIME2){clearTimeout(eINTTIME2)};if(eINTTIME){clearTimeout(eINTTIME)};eINTTIME =setTimeout("eMI2('"+eSECN9 +"','"+eK +"')",400)}}
function eMO(eSECN9,eK,evt){if(window.event){window.event.cancelBubble =true}else{evt.cancelBubble=true};if(!eII(eK,'nf')){if(eINTTIME){clearTimeout(eINTTIME)};eINTTIME=setTimeout("eMO2()",200)}}
//main function -- divide a link (b..), no old, old=new, new father of old, new child of old, totally new new
function eMI2(eSECN9,eK){if(eSECN9.substring(0,1)=='b'){eSECN9=eGF(eSECN9.slice(1));while(!eII(eSECN9,eOSEC)){eCK2(eOSEC);eOSEC = eGF(eOSEC);}}else if(eOSEC==""){eCK2(eSECN9);eSETPOSITION(eSECN9,eK);eOSEC =eSECN9;}else if(eII(eSECN9,eOSEC+'d')){eCK2(eSECN9);eSETPOSITION(eSECN9,eK);eOSEC=eSECN9;}else if(eII(eOSEC,eSECN9+'d')){while(eII(eOSEC,eSECN9+'d')){eCK2(eOSEC);eOSEC=eGF(eOSEC)}}else{eCK2(eOSEC);eOSEC=eGF(eOSEC);while(!eII(eSECN9,eOSEC+'d')){eCK2(eOSEC);eOSEC=eGF(eOSEC);}if(!eO[eSECN9]){eCK2(eSECN9);eSETPOSITION(eSECN9,eK);eOSEC =eSECN9}}}
function eMO2(){eINTTIME2=setTimeout("eTIMEOUT()",200)}
function eTIMEOUT(){ while(eOSEC!=""){eCK2(eOSEC);eOSEC=eGF(eOSEC);}}
function eCNV(url,k,name){if(url.indexOf('.wmv')==-1){return url}else if(remoteHost.substring(0,9)=='192.168.0' || remoteHost=='59.124.11.179' ){return 'mms://192.168.0.250'+url}else{return  'mms://www.crtslive.net'+url}}
//----------
//Cookie is only used to determine what folders to open when page is loaded.
//On pageload, it is read into eCO, and then eOAS uses this eCO.
//Both eCO and the cookie are set (to the same thing, by eUDC) every time the user clicks a folder.
//If not using cookies (user has turned off cookies, all folders closed on load), only eCO is set by eUDC.
//eCO is used to keep track of which folders are already open, which folders to close, etc.
//----------
//eGC returns '0' if the cookie does not exist -- so this is the first load.
if(eGC('menuJeffrey_Jue')=='0'){eFL=true};
//Change eCO to stored cookie.
if(eUC){eCO=eGC('menuJeffrey_Jue')};
//if cookie test fails, turn off use cookie
if(eUC&&!eCT()){eUC=false};
//if eGB and cookie test fails, send a message
if(eGB&&!eUC){alert('For the tree menu to work properly, you must turn on cookies')};
//eCT (cookie test) used above will change cookie.  So change cookie back to eCO.
if(eUC){eSC('menuJeffrey_Jue',eCO)};
//Style Sheet
eDW("<style>");
eDW(".MenuTreeBox {");
eDW("}");
eDW(".MainFolderBox {");
eDW("	cursor:pointer;");
eDW("	background-color : white;");
eDW("	border : 1px navy solid;");
eDW("	color : navy;");
eDW("	margin : 0px 0px 0px 0px;");
eDW("	padding : 3px 3px 3px 3px;");
eDW("}");
eDW(".MainFolderPage {");
eDW("}");
eDW(".MainFolderLine {");
eDW("	color : navy;");
eDW("	text-decoration : none;");
eDW("}");
eDW(".MainFolderLineMouseOver {");
eDW("	color : red;");
eDW("	text-decoration : none;");
eDW("}");
eDW(".SubFolderBox {");
eDW("	background-color : white;");
eDW("	border : 1px navy solid;");
eDW("	color : navy;");
eDW("	margin : 0px 0px 0px 0px;");
eDW("	padding : 3px 3px 3px 3px;");
eDW("}");
eDW(".SubFolderPage {");
eDW("}");
eDW(".SubFolderLine {");
eDW("	color : navy;");
eDW("	text-decoration : none;");
eDW("}");
eDW(".SubFolderLineMouseOver {");
eDW("	color : red;");
eDW("	text-decoration : none;");
eDW("}");
eDW(".LinkBox {");
eDW("	background-color : white;");
eDW("	border : 1px navy solid;");
eDW("	color : navy;");
eDW("	margin : 0px 0px 0px 0px;");
eDW("	padding : 3px 3px 3px 3px;");
eDW("}");
eDW(".LinkPage {");
eDW("}");
eDW(".LinkLine {");
eDW("	color : blue;");
eDW("}");
eDW(".LinkLineMouseOver {");
eDW("	color : red;");
eDW("}");
eDW("a:visited {");
eDW("	color : blue;");
eDW("}");
eDW("a:hover {");
eDW("	color : red;");
eDW("}");
eDW("</style>");

//start of tree menu table
eDW("<TABLE border='0' cellspacing='0' cellpadding='0'>");
eDW("<TR>");
eDW("<TD class='MenuTreeBox' valign='top'>");
eMF("e1d1","","上帝的國度：改教先驅的末世觀","","300");
eLK("e1d1d1","i","crtsLive.2009.01.09.1901.wmv, 109242K","/videos/Jeffrey_Jue/上帝的國度：改教先驅的末世觀/crtsLive.2009.01.09.1901.wmv","");
eLK("e1d1d2","i","crtsLive.2009.01.09.2023.wmv, 58607K","/videos/Jeffrey_Jue/上帝的國度：改教先驅的末世觀/crtsLive.2009.01.09.2023.wmv","");
eDE();
eMF("e1d2","","上帝的話語：加爾文和聖經論","","300");
eLK("e1d2d1","i","crtsLive.2009.01.08.1902.wmv, 106771K","/videos/Jeffrey_Jue/上帝的話語：加爾文和聖經論/crtsLive.2009.01.08.1902.wmv","");
eLK("e1d2d2","i","crtsLive.2009.01.08.2025.wmv, 62931K","/videos/Jeffrey_Jue/上帝的話語：加爾文和聖經論/crtsLive.2009.01.08.2025.wmv","");
eDE();
eDW("</TD>");
eDW("</TR>");
eDW("</TABLE>");
document.write(eGSTR);eGSTR="";
//open all the cookie sections--cookie hardwired above, 2nd load of eGB reads new cookie
if(eW3C){eOAS()};
if(window.pageXOffset==0){eXOFF=true}else if(eIE){eSTOP=true};
//scroll to scroll cookie
if(eGB){eSTSC()}
