<!-- START
/*==================================================================
   Program:     Menu Class
   Created:     17/02/04
   Modified:    04/03/04
   Version No:  1.7.6
   Copyright:   2004 Open Learning Institute of TAFE Queensland
====================================================================*/

var T4=document;var gMenu=new Array();function activateMenu(theId,theClass){var node=T4.getElementById(theId);if(node==null)return;if((node.getElementsByTagName('ul').length==0)&&(node.getElementsByTagName('ol').length==0))return;if(!isActiveMenu(theId)){var iNo=gMenu.length;gMenu[iNo]=new myMenu(theId,iNo,theClass);gMenu[iNo].init();}}function isActiveMenu(theId){var isActive=false;var i=0;var maxMenu=gMenu.length;while(!isActive &&(i < maxMenu)){if(gMenu[i].id==theId)isActive=true;i++;}return isActive;}function myMenu(theId,theNo,theClass){this.id=theId || 'myMenu';this.no=theNo || 0;this.prefix='almt';this.show='block';this.hide='none';this.cssClass=theClass || 'menuItem';var butClass=this.cssClass+'But';this.expandBut=new myButton('[+]','Expand menu',butClass);this.collapseBut=new myButton('[-]','Collapse menu',butClass);this.init=myMenu_init;this.init_list=myMenu_init_list;this.isCurPage=myMenu_isCurPage;this.set=myMenu_set;}function myMenu_init(){var node=T4.getElementById(this.id);if(node==null)return;if((this.expandBut.image==null)&&(this.collapseBut.image==null)){if((node.getAttribute('butexpand'))&&(node.getAttribute('butcollapse'))){this.expandBut.image=node.getAttribute('butexpand');this.collapseBut.image=node.getAttribute('butcollapse');}}var baseNode=node.nodeName.toLowerCase();node=node.getElementsByTagName('ul');if(node.length==0)node=node.getElementsByTagName('ol');if(node.length==0)return;var nodeStart=0;if((baseNode !='ul')&&(baseNode !='ol'))nodeStart++;this.init_list(node,nodeStart);}function myMenu_init_list(theNode,theNodeStart){var curPage=lib_extractFileName(location.href);var sPrefix=this.id+'_'+this.prefix;var maxNode=theNode.length;for(var i=theNodeStart;i < maxNode;i++){var pNode=theNode[i].parentNode;var objBut,elmId,elmHref;if(!this.isCurPage(theNode[i],curPage)){theNode[i].style.display='none';objBut=this.expandBut;}else{objBut=this.collapseBut;}elmId=sPrefix+i;elmHref="javascript:gMenu["+this.no+"].set('"+elmId+"');";objBut.create(pNode,elmId,elmHref);pNode.className=this.cssClass;}}function myMenu_isCurPage(theNode,thePage){var tmpResult=false;var node=theNode.getElementsByTagName('a');var maxNode=node.length;var i=0;while(i < maxNode){var tmpPage=node[i].getAttribute('href');tmpPage=lib_extractFileName(tmpPage);if(tmpPage==thePage){tmpResult=true;i=maxNode;}i++;}return tmpResult;}function myMenu_set(theId){var node=T4.getElementById(theId);if((node==null)||(node.length==0))return;var isSet=false;while(!isSet &&(node !=null)){node=node.nextSibling;var sName=node.nodeName.toLowerCase();if((sName=='ul')||(sName=='ol')){var tmpStyle=node.style;if(tmpStyle.display==this.hide){tmpStyle.display=this.show;this.collapseBut.set(theId);}else{tmpStyle.display=this.hide;this.expandBut.set(theId);}isSet=true;}}}function myButton(theText,theTitle,theClass,theImage){this.text=theText || null;this.title=theTitle || null;this.cssClass=theClass || null;this.image=theImage || null;this.create=myButton_create;this.set=myButton_set;}function myButton_create(theNode,theId,theHref){if(theId==null)return;if(theHref==null)theHref='#';var elmDiv,elmA,elm;elmDiv=T4.createElement('div');elmDiv.setAttribute('id',theId);elmDiv.className=this.cssClass;elmA=T4.createElement('a');elmA.setAttribute('href',theHref);elmA.setAttribute('title',this.title);if(this.image !=null){elm=T4.createElement('img');elm.setAttribute('alt',this.title);elm.setAttribute('src',this.image);elm.setAttribute('border','0');}else{elm=T4.createTextNode(this.text);}elmA.appendChild(elm);elmDiv.appendChild(elmA);theNode.insertBefore(elmDiv,theNode.firstChild);}function myButton_set(theId){if(theId==null)return;var node=T4.getElementById(theId);if((node==null)||(node.length==0))return;node=(node.firstChild).firstChild;if(node.nodeName.toLowerCase()=='#text'){node.nodeValue=this.text;}else{node.setAttribute('alt',this.title);node.setAttribute('src',this.image);}(node.parentNode).setAttribute('title',this.title);}function lib_extractFileName(theUrl){if(theUrl==null)return;var tmpFile=theUrl.split('/');tmpFile=tmpFile[tmpFile.length - 1];tmpFile=tmpFile.split('#');return(tmpFile[0]);}function lib_extractPathName(theUrl){if(theUrl==null)return;var sCurPath=theUrl.substring(0,(theUrl.lastIndexOf("/")+1));return(sCurPath);}

// END -->