home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 1999 April
/
cd24-www.iso
/
js
/
index.js
Wrap
Text File
|
1999-01-02
|
4KB
|
139 lines
nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;
v4=(nn4 || ie4)?true:false;
if (document.images) {
plusImg = new Image();
plusImg.src = "../img/plus.gif";
minusImg = new Image();
minusImg.src = "../img/minus.gif";
}
isExpanded=false;
function reDo(){window.location.reload()}
function getIndex(el) {
var ind=null;
for (i=0; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id==el) {
ind=i;
break;
}
}
return ind;
}
function arrange() {
document.layers[firstInd].pageX = 0;
nextY=document.layers[firstInd].pageY + document.layers[firstInd].document.height ;
for (i=firstInd+1; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.visibility != "hide") {
whichEl.pageY=nextY;
whichEl.pageX=0;
nextY += whichEl.document.height;
}
}
}
function init(){
if(!v4){return}
if (nn4) {
scrollTo(0,pageYOffset-30)
for (i=0; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id.indexOf("Child") != -1) {
whichEl.visibility="hide";
whichEl.isExpanded=false;
}
}
arrange();
setTimeout("window.onresize=reDo",1000)
}
}
function expandIt(el) {
if (!v4) {return}
if (nn4) {expandNN(el)} else {expandIE(el)}
}
function expandIE(el) {
whichEl=eval(el + "Child");
whichIm=eval("document.images['" + el + "img']");
if (!whichEl.isExpanded) { //whichEl.style.display == "none") {
whichEl.style.display="block";
whichEl.isExpanded=true;
whichIm.src=minusImg.src;
} else {
whichEl.style.display="none";
whichEl.isExpanded=false;
whichIm.src=plusImg.src;
}
}
function expandNN(el) {
whichEl=eval("document." + el + "Child");
whichIm=eval("document." + el + "Parent.document.images['"+ el + "img']");
if (whichEl.visibility == "hide") {
whichEl.visibility="show";
whichEl.isExpanded=true;
whichIm.src=minusImg.src;
} else {
whichEl.visibility="hide";
whichEl.isExpanded=false;
whichIm.src=plusImg.src;
}
arrange();
}
function showAll() {
for (i=firstInd; i<document.layers.length; i++) {
whichEl=document.layers[i];
whichEl.visibility="show";
}
}
function expandAll(isBot) {
if(!v4){return}
newSrc=(isExpanded)? plusImg.src : minusImg.src ;
if (nn4) {
document.images["allimg"].src=newSrc;
for (i=firstInd; i<document.layers.length; i++) {
whichEl=document.layers[i];
if (whichEl.id.indexOf("Parent") != -1) {
whichEl.document.images[0].src=newSrc;
}
if (whichEl.id.indexOf("Child") != -1) {
whichEl.visibility=(isExpanded)?"hide":"show";
whichEl.isExpanded=(isExpanded)?false:true;
}
}
arrange();
if (isBot && isExpanded) {scrollTo(0,document.layers[firstInd].pageY)}
} else {
divColl=document.all.tags("DIV");
for (i=0; i<divColl.length; i++) {
if (divColl(i).className == "child") {
divColl(i).style.display=(isExpanded)?"none":"block";
divColl(i).isExpanded=(isExpanded)?false:true;
}
}
imColl=document.images;
for (i=0; i<imColl.length; i++) {
if(imColl(i).name.indexOf("img") != -1) {
imColl(i).src=newSrc;
}
}
}
isExpanded=!isExpanded;
}
s = "<style type='text/css'><!--\n";
s+= ".parent {" ;
if(nn4) { s+="position:absolute; left:-800; " }
s+="margin-left:99}\n" ;
s+=".child {" ;
if (nn4) { s+="position:absolute; left:-800; " }
if (ie4) { s+="display:none; " }
s+="margin-left:99}\n" ;
s+="--></style>";
document.write(s);