function toggleclasses (containerElem, musthaveclass, filterclass, tag, option, optvisible)	{

	var testMustHave= new RegExp("(^|\\s)" + musthaveclass + "(\\s|$)");
	var testFilter= new RegExp("(^|\\s)" + filterclass + "(\\s|$)");
	var tag = tag || "*";
	var elm = document.getElementById(containerElem) || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var current;
	var length = elements.length;
	var onmatch='';
	var nomatch='';
	var show='';
	if(option == 'showblock')	{
		onmatch = 'block';
		nomatch = 'none';
		if(tag == 'tbody' ||  tag == 'tr')	{
			onmatch= document.defaultView ? "table-row-group" : "block";
		}
		else if(tag == 'img')	{
			onmatch = 'inline';
		}
	}
	else if(option == 'showinline')	{
		onmatch = 'inline';
		nomatch = 'none';
	}
	else if(option == 'hide')	{
		onmatch = 'none';
		nomatch = 'block';
	}
	for(var i=0; i<length; i++){
		current = elements[i];
		if(testMustHave.test(current.className)){
			if(testFilter.test(current.className)){
				if(optvisible == 'visible')	{
					current.style.visibility= 'visible';
				}
				else	{
				  current.style.display = onmatch;
				}
			}
			else	{
				if(optvisible == 'visible')	{
					current.style.visibility= 'hidden';
				}
				else	{
					current.style.display = nomatch;
				}
			}
		}
	}
}

