/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this scriptt and the associated (x)html
is available at http://www.stunicholls.com/menu/simple.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */
function createFaq() {
   for (i=1;i<=999;i++) {
	   clickMenu('faq+i+');
	}
}

clickMenu = function(faq) {
	var getEls = document.getElementById(faq).getElementsByTagName("LI");
	var getAgn = getEls;
	
	for (var i=0; i<getEls.length; i++) {	
		getEls[i].onclick=function() {												
			if (this.className.indexOf('sub')!=-1 || this.className.indexOf('foo') != -1) {
			   if (this.className.indexOf('foo') != -1) {
				   for (var y=0; y<getAgn.length; y++) {
					   if (getAgn[y].className.indexOf('ans') ==-1) {
					      getAgn[y].className+=" ans";
						}
			      }		
				} else if (this.className.indexOf('sub')!=-1) {					
				   if (this.className.indexOf('click') !=-1 && this.className.indexOf('ans') ==-1) { 
		            this.className=this.className.replace(/click/g, "");
					} else if (this.className.indexOf('click') !=-1 && this.className.indexOf('ans') !=-1) {
						for (var y=0; y<getAgn.length; y++) {
						   if (getAgn[y].className.indexOf('ans') !=-1) {
						      getAgn[y].className = getAgn[y].className.replace(/ans/g, "");;
							}
				      }
					} else if (this.className.indexOf('click') ==-1) {
					   this.className+=" click";
					}						
				}
			}		       			   
		}
	}
}
	
	
