function Accordian(target) {  
	typeof target == "object" ? this.element = target : this.element = document.getElementById(target); if (!this.element) return false;  
	this.ul = this.element.getElementsByTagName("ul")[0]; 
	this.tabs = this.ul.getElementsByTagName("li");
	this.tabContent = this.getTabContent();
	this.bind();
}

Accordian.prototype.getTabContent = function() {
	tabContent= new Array();    
	this.divs = this.element.getElementsByTagName("div");
	for(var i = 0; i < this.divs.length; i++) {
        if (/tabContent/i.test(this.divs[i].className)) {
        tabContent.push(this.divs[i]);                        
		}
	}
	return tabContent;
}

Accordian.prototype.bind = function() {    
	var o = this;
	for(var i = 0; i < this.tabs.length; i++) {
		this.tabs[i].onclick = function() { o.open(this); return false; };   
		var a = this.tabs[i].getElementsByTagName("a")[0];
    if (a) a.onclick = function() { return false; };                     
	}
}

Accordian.prototype.open = function(caller) {    
	for(var i = 0; i < this.tabs.length; i++) {
		var tab = this.tabs[i]; 
		if (tab == caller) {  
			this.collapse();
			tab.className = "selected"
			this.tabContent[i].style.display = "block";
		}
	}
}

Accordian.prototype.collapse = function() {
	for(var i = 0; i < this.tabs.length; i++) {    
		this.tabs[i].className = "";
		this.tabContent[i].style.display = "none";                 
	}                                                                
}

 


function enhanceAccordians() {
	var divs = document.getElementsByTagName('div');
	for (var i = 0; i < divs.length; i++) {
		var element = divs[i];     
		if (/accordian/i.test(element.className)) {
			new Accordian(element);
		}
	} 
}

	function toggleLayer(whichLayer)
	{
	if (document.getElementById)
	{
	// this is the way the standards work
	var style2 = document.getElementById(whichLayer).style;
	style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
	// this is the way old msie versions work
	var style2 = document.all[whichLayer].style;
	style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
	// this is the way nn4 works
	var style2 = document.layers[whichLayer].style;
	style2.display = style2.display? "":"block";
	}
	}
