home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Beginning Direct3D Game Programming
/
Direct3D.iso
/
directx
/
dxf
/
extras
/
documentation
/
directx7
/
directx7.chm
/
dxmedia
/
foundation
/
d3drm
/
js
/
toc.js
< prev
next >
Wrap
Text File
|
2000-09-22
|
3KB
|
121 lines
var doc = new Object();
var win = new Object();
var image_on = '';
var image_off = '';
function TocControl(){
this.printStr = printStr;
this.setTarget = setTarget;
this.setVar = setVar;
this.tree = tree;
}
function setVar(WINDOW, DOCUMENT, IMAGE_ON, IMAGE_OFF){
win = WINDOW;
doc = DOCUMENT;
image_on = IMAGE_ON;
image_off = IMAGE_OFF;
}
function setTarget(str){
if (win.top != self) {
if (win.top.frames.length > 1 && win.top.frames[1].name==str) {
for (i=0; i<doc.links.length; i++) {
if (doc.links(i).target=="")
doc.links(i).target=str;
}
}
}
}
function tree(src){
//<!--@ Limit response to ALINK and IMAGE type elements-->
if ((src.tagName == "A")||(src.tagName == "IMG")) {
var i = 0;
//<!--@ Go upwards parent containers -->
for (var TAG_PARENT = src.parentElement; TAG_PARENT != null; TAG_PARENT = TAG_PARENT.parentElement) {
//<!--@ If you find <LI> container test for node type end exit loop -->
if(TAG_PARENT.tagName == "LI") {
setIfNode(TAG_PARENT);
break;
}
//<!--@ Exit if looped 4 times -->
if (i == 4) break;
i++;
}
}
}
function setIfNode(src){
var i = 0;
//<!--@ Look children elements for <DIV> and <IMG> elements
// Loop will terminate in two steps for non node elements.
// -->
while (src.children(i) != null){
//<!--@ Look for IMG inside <A> element -->
if (src.children(i).tagName == "A") {
if (src.children(i).children(0))
if (src.children(i).children(0).className == "FLIP" )
var IMAGE = src.children(i).children(0)
}
//<!--@ If you find <DIV> -->
if (src.children(i).tagName == "DIV") {
if (src.children(i).className == "Outline"){
var NODE = src.children(i);
break;
}else {alert("Improper DIV CLASS for this request!"); break;}
}
//<!--@ Exit after 4 loops -->
if (i==4) break;
i++
}
if (NODE) displayMode(NODE,IMAGE);
}
function displayMode(src,image){
if (src){
if ('none' == src.style.display) {
src.style.display = '';
//<!--@ Set the expanded tree node icon image_on = global variable -->
if(image) image.src = image_on;
}
else{
src.style.display = 'none';
//<!--@ Set the collapsed tree node icon image_off = global variable -->
if(image) image.src = image_off ;
//<!-- Colapse all children elements -->
collapseChildren(src);
}
}
}
function collapseChildren(src) {
var i;
var div = doc.all.tags("DIV");
for (i=0; i<div.length; i++) {
if (div(i).sourceIndex < src.sourceIndex) continue;
if (src.contains(div(i)) != true) return;
if (div(i).className == "Outline") {div(i).style.display = "none" };
}
}
function setTocControl(sImgOn, sImgOff){
if((g_isIE== true) && (g_iMaj > 3)){
setVar(window,document,sImgOn,sImgOff);
setTarget("TEXTWIN");
}
}