// togglebynext

function toggleNext(el) {
	var next=el.nextSibling;
	
	while(next.nodeType != 1) next = next.nextSibling;
/*
//	next.style.display="none";
//	Effect.toggle(next,'blind'); return false;	

	if (next.style.display=="none"){
		next.style.display=="block";
		Effect.toggle(next,'blind'); return false;	
	}else{
		next.style.display=="none";
		Effect.toggle(next,'blind'); return false;
	}

*/
	next.style.display=((next.style.display=="none") ? "block" : "none");
}



function toggleNextById(el) {
	var ccn="clicker";
	var clicker=document.getElementById(el);
	clicker.className+=" "+ccn;
	clicker.onclick=function() {toggleNext(this)}
	toggleNext(clicker);
}

function toggleNextByTagName(tname) {
	var ccn="clicker";
	var clickers=document.getElementsByTagName(tname);
	for (i=0; i<clickers.length; i++) {
	clickers[i].className+=" "+ccn;
	clickers[i].onclick=function() {toggleNext(this)}
	toggleNext(clickers[i]);
	}
}


function getElementsByTagAndClassName(tag,cname) {
var tags = document.getElementsByTagName(tag);
var cEls = new Array();
for (i=0; i<tags.length; i++) {
    var rE = new RegExp("(^|\\s)" + cname + "(\\s|$)");
	if (rE.test(tags[i].className)) {
		cEls.push(tags[i]);
		}
	}
return cEls;
}

function toggleNextByTagAndClassName(tag,cname) {
	var ccn="clicker";
	clickers=getElementsByTagAndClassName(tag,cname);
	for (i=0; i<clickers.length; i++) {
		clickers[i].className+=" "+ccn;
		clickers[i].onclick=function() {toggleNext(this)}
		toggleNext(clickers[i]);
	}
}
//


//
function getElementsByIdTagAndClassName(id,tag,cname) {
var tags = document.getElementById(id).getElementsByTagName(tag);
var cEls = new Array();
for (i=0; i<tags.length; i++) {
    var rE = new RegExp("(^|\\s)" + cname + "(\\s|$)");
	if (rE.test(tags[i].className)) {
		cEls.push(tags[i]);
		}
	}
return cEls;
}

function toggleNextByIdTagAndClassName(id,tag,cname) {
	var ccn="clicker";
	clickers=getElementsByIdTagAndClassName(id,tag,cname);
	for (i=0; i<clickers.length; i++) {
		clickers[i].className+=" "+ccn;
		clickers[i].onclick=function() {toggleNext(this)}
		toggleNext(clickers[i]);
	}
}
//


//start. This one gets children with a certain className that are children of a certain ID.
function getElementsByIdThenClassName(id,cname) {
var nodes = document.getElementById(id).childNodes;
var cEls = new Array();
for (i=0; i<nodes.length; i++) {
    var rE = new RegExp("(^|\\s)" + cname + "(\\s|$)");
	if (rE.test(nodes[i].className)) {
		cEls.push(nodes[i]);
		}
	}
return cEls;
}

function toggleNextByIdThenClassName(id,cname) {
	var ccn="clicker";
	clickers=getElementsByIdThenClassName(id,cname);
	for (i=0; i<clickers.length; i++) {
		clickers[i].className+=" "+ccn;
		clickers[i].onclick=function() {toggleNext(this)}
		toggleNext(clickers[i]);
	}
}
//end


// end togglebynext



function toggleNextByTagAndClassNameSpesh(tag,cname) {
 var ccn="clicker";
 clickers=getElementsByTagAndClassName(tag,cname);
 for (i=0; i<clickers.length; i++) {
  clickers[i].className+=" "+ccn;
  clickers[i].onclick=function() {toggleNextSpesh(this,clickers); return false;}
  toggleNextSpesh(clickers[i],1);
 }
}
