/***********************************************
* Switch Content script II- &copy; Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use. Last updated April 2nd, 2005.
* Visit http://www.dynamicdrive.com/ for full source code
* Re-edited by Tam Yuen Hei William at 1 August, 2006.
***********************************************/

/////No need to edit beyond here //////////////////////////
var expandsymbol="&#9658;"
var contractsymbol="&#9660;"
var itemcnt = 0;
var isPanelShow = new Array();

function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}

function sweeptoggle(ec){
var inc=0
while (ccollect[inc]){
ccollect[inc].style.display=(ec=="contract")? "none" : ""
inc++
}
revivestatus()
}

function revivestatus(){
var inc=0
while (statecollect[inc]){
if (ccollect[inc].style.display=="none")
statecollect[inc].innerHTML=expandsymbol
else
statecollect[inc].innerHTML=contractsymbol
inc++
}
}


function expandcontent(curobj, cid){
if (ccollect.length>0){
sweeptoggle('contract');
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="none")? "none" : ""
document.getElementById(curobj).innerHTML=(document.getElementById(cid).style.display=="none")? expandsymbol : contractsymbol
}
}

function revivecontent(){
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="none"
}

function setpanel(defpanelid){
var alltags=document.all? document.all : document.getElementsByTagName("*")
ccollect=getElementbyClass(alltags, "switchcontent")
statecollect=getElementbyClass(alltags, "showstate")
sweeptoggle('contract');
if (defpanelid==""||defpanelid==null) defpanelid=1;
eval("expandcontent('s"+defpanelid+"', 'sc"+defpanelid+"')");
}

