 

// JavaScript Document

 

 

// Script for FAQ div reveal //

speed=15

hideLast=1 // 0 = no 1 = yes: automatically hides the previously revealed content

 

function initExpCol(){

 

count=0

numOfObj=0

tags=document.getElementsByTagName("DIV")

 

while(tags[count]){

if(tags[count].id.indexOf("expdiv")!= -1){

numOfObj++

}

count++

}

 

for(var i=1;i<=numOfObj;i++){

window["my_object"+i]=new create("expdiv"+i)

document.getElementById("expander"+i).i=i

 

document.getElementById("expander"+i).onclick=function(){

window["my_object"+this.i].chk_status(this.i,'down')

}

 

}

 

// passing the divs number via the query string will automatically reveal the div when the page loads

if (location.search.length > 0){

preNum = unescape(location.search.substring(1))

window["my_object"+preNum].chk_status(preNum,'down')

}

 

}

 

lastNum=null

 

function create(id){ //define properties, pass id

this.id=id

this.num=this.id.replace(/[A-z]/g,"")

this.element=document.getElementById(this.id)

this.height=this.element.offsetHeight

this.timer=null

this.running=0

 

this.chk_status=function(num,d){

 

if(hideLast==1&&this.num!=lastNum&&lastNum!=null&&document.getElementById("expdiv"+lastNum).offsetHeight>0){

window["my_object"+lastNum].chk_status(lastNum,'up')

}

 

this.dir=d

if(this.dir=="up"){

document.getElementById("expander"+this.num).onclick=function(){

window["my_object"+num].chk_status(num,'down')

}

}

if(this.dir=="down"){

document.getElementById("expander"+this.num).onclick=function(){

window["my_object"+num].chk_status(num,'up')

}

 

}

this.running=1

 

this.step=speed

window["my_object"+num].animate('my_object'+num,num)

 

lastNum=this.num

}

 

this.animate=function(myobject,num){

clearTimeout(this.timer)

if(this.dir=="down"){

this.element.style.display="block"

this.height+=this.step

}

else{

this.height-=this.step

}

 

this.stop=this.element.scrollHeight

 

this.timer=setTimeout(myobject+".animate('"+myobject+"','"+num+"')",50)

 

if(this.dir=="down"&&this.height>this.stop){

this.running=0

clearTimeout(this.timer)

this.height=this.stop

}

 

if(this.dir=="up"&&this.height<=speed){

this.height=0

this.running=0

clearTimeout(this.timer)

this.element.style.display="none"

}

 

this.element.style.height=this.height

 

}

 

}


