home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magazyn WWW 2001 May
/
cd49www.iso
/
full
/
js
/
index.js
< prev
Wrap
Text File
|
2000-04-06
|
4KB
|
156 lines
nn4=(document.layers)?true:false;
ie4=(document.all)?true:false;
niemac=(navigator.appVersion.indexOf("Macintosh")==-1);
ie4=ie4 && niemac;
v4 = ie4 || nn4;
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() {
if(nn4){
oknoW=window.innerWidth-16;
oknoH=window.innerHeight
}else if(ie4){
oknoW=document.body.clientWidth;
oknoH=document.body.clientHeight;
}
if(document.layers[firstInd]) {
//document.layers[firstInd].pageX = (oknoW-750)/2;
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=(oknoW-750)/2;
nextY += whichEl.document.height;
}
}
}
}
function init(){
if(!v4){return}
if(nn4){
oknoW=window.innerWidth-16;
oknoH=window.innerHeight
}else if(ie4){
oknoW=document.body.clientWidth;
oknoH=document.body.clientHeight;
}
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;
}
whichEl.pageX = (oknoW-750)/2;
}
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= document.layers[el + "Child"];
// whichIm= document.layers[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; width:750; " }
if (ie4) { s+= "text-align:center; " }
s+= "}\n";
s+= ".child {" ;
if (nn4) { s+= "position:absolute; left:-800; width:750; " }
if (ie4) { s+= "display:none; text-align:center; " }
s+= "}\n";
s+= "--></style>";
document.write(s);