/*************************************************************** * * JavaScript DHTML foldout menu * * $Id: jsfunc.foldout.js 3439 2008-03-16 19:16:51Z flyguide $ * * * * Copyright notice * * (c) 1998-2008 Kasper Skårhøj * All rights reserved * * This script is part of the TYPO3 tslib/ library provided by * Kasper Skårhøj together with TYPO3 * * Released under GNU/GPL (see license file in tslib/) * * This script is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * This copyright notice MUST APPEAR in all copies of this script ***************************************************************/ //object constructor... function GF_makeMenu(obj,nest,adjustH){ nest= (!nest)?'':'document.'+nest+'.'; this.el= bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj); this.css= bw.ns4?this.el:this.el.style; this.ref= bw.ns4?this.el.document:document; this.x= (bw.ns4||bw.opera)?this.css.left:this.el.offsetLeft; this.y= (bw.ns4||bw.opera)?this.css.top:this.el.offsetTop; this.height= (bw.ie4||bw.ie5||bw.ns6)?this.el.offsetHeight:bw.ns4?this.ref.height:bw.opera?this.css.pixelHeight:0; this.vis= GF_visible; this.hideIt= GF_hideIt; this.showIt= GF_showIt; this.moveIt= GF_moveIt; this.moveBy= GF_moveBy; // Added by Kasper Skårhøj: if (adjustH) this.height = this.height+adjustH; return this } //object methods... function GF_showIt(){this.css.visibility='visible'} function GF_hideIt(){this.css.visibility='hidden'} function GF_visible(){if(this.css.visibility=='visible' || this.css.visibility=='VISIBLE' || this.css.visibility=='show') return true;} function GF_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x; this.css.top=this.y} function GF_moveBy(x,y){this.moveIt(this.x+x,this.y+y)} /************************************************************************************ These functions GF_menu, GF_doMove, and GF_placeAll open and close the menu. ************************************************************************************/ function GF_menu(num){ //If GFV_stayFolded is false, one fold is open, and it's not the one you clicked, we enter this if structure. if(bw.bw && !GFV_active && !GFV_stayFolded && GFV_currentFold!=null && GFV_currentFold!=num){ GFV_active= true //Adjusting the speed of the animation. GFV_foldStep1= oSub[num].height/GFV_foldSpeed GFV_foldStep2= oSub[GFV_currentFold].height/-GFV_foldSpeed //Setting the images correctly, showing the new sub. if(GFV_foldImg) oTop[num].ref['imgA'+num].src=GFV_exImg.src if(GFV_foldImg) oTop[GFV_currentFold].ref['imgA'+GFV_currentFold].src=GFV_unImg.src oSub[num].showIt() //Keeping track of what fold is opened, then do the move. var temp= GFV_currentFold GFV_currentFold= num GF_doMove(num+1,temp+1) } //In the simple cases, we enter this else if structure. else if(bw.bw && !GFV_active){ GFV_active= true //If the sub is not visible, show it, change it's image, and expand it. if(!oSub[num].vis()){ oSub[num].showIt() if(GFV_foldImg)oTop[num].ref['imgA'+num].src=GFV_exImg.src GFV_foldStep1=oSub[num].height/GFV_foldSpeed GFV_currentFold=num GF_doMove(num+1,null) } //If the sub is visible, change it's image and collapse it. else{ if(GFV_foldImg)oTop[num].ref['imgA'+num].src=GFV_unImg.src GFV_foldStep2=oSub[num].height/-GFV_foldSpeed GFV_currentFold=null GF_doMove(null,num+1) } } } function GF_doMove(expand,collapse){ GFV_step++ if(expand!=null) for(var i=expand;iinnerWidth+10 || GFV_scrY>innerHeight+10){ GFV_scrX= innerWidth; GFV_scrY= innerHeight; GF_initFoldout(); } } }