
function filter_more() {
	filterToggles = getElementsByClassName("filter_group_toggle");
	nft = filterToggles.length;
	
	for (i=0; i < nft; i++) {
		filterToggles[i].onclick = function() {
			target = $(this.id.slice(7));
			if (target.style.display == "none") {
				target.style.display = "block";
				this.className = "open";
			} else {
				target.style.display = "none";
				this.className = "";
			}
			return false;
		}
	}
	
	moreShowHide = getElementsByClassName("show|hide");
	nSH = moreShowHide.length;
	
	for (i=0; i < nSH; i++) {
		moreShowHide[i].onclick = function() {
			infoStr = this.parentNode.parentNode.id;
			action = infoStr.slice(1 + infoStr.lastIndexOf("_"));
			target = infoStr.slice(0, infoStr.indexOf("_"));
			
			if (action == "hide") {
				$(target + "_more_show").style.display = "block";
				$(target + "_more_filter").style.display = "none";
				$(target + "_more_hide").style.display = "none";
			} else {
				$(target + "_more_show").style.display = "none";
				$(target + "_more_filter").style.display = "block";
				$(target + "_more_hide").style.display = "block";
			}
			
			return false;
		}
	}
}
		
function showHideMore( oAnchor, filterId )
{
	// Determine if it's a show or hide action
	// => Show action if anchor class is 'show'
	// => Hide action if anchor class is 'hide'
	anchorClass = oAnchor.className;
	
	// Hide action
	if( anchorClass == 'show' )
	{
		// Show more filters for this filterId
		moreFiltersContainerId = filterId + '_more_filters';
		document.getElementById( moreFiltersContainerId ).style.display = 'block';
		
		// Show 'hide' anchor link container
		hideAnchorLinkContainerId = filterId + '_more_hide';
		document.getElementById( hideAnchorLinkContainerId ).style.display = 'block';

		// Hide 'show' anchor link container
		showAnchorLinkContainerId = filterId + '_more_show';
		document.getElementById( showAnchorLinkContainerId ).style.display = 'none';
		
	}
	// Show action
	if( anchorClass == 'hide' )
	{
		// Hide more filters for this filterId
		moreFiltersContainerId = filterId + '_more_filters';
		document.getElementById( moreFiltersContainerId ).style.display = 'none';
		
		// Show 'show' anchor link container
		showAnchorLinkContainerId = filterId + '_more_show';
		document.getElementById( showAnchorLinkContainerId ).style.display = 'block';

		// Hide 'show' anchor link container
		hideAnchorLinkContainerId = filterId + '_more_hide';
		document.getElementById( hideAnchorLinkContainerId ).style.display = 'none';

		
	}
}		


/* Probably in your framework already.
 */
function $(elm) { return document.getElementById(elm); }

function getElementsByClassName(strClass, strTag, objContElm) {
  strTag = strTag || "*";
  objContElm = objContElm || document;    
  var objColl = objContElm.getElementsByTagName(strTag);
  if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
  var arr = new Array();                              
  var delim = strClass.indexOf('|') != -1  ? '|' : ' ';   
  var arrClass = strClass.split(delim);    
  for (var i = 0, j = objColl.length; i < j; i++) {                         
    var arrObjClass = objColl[i].className.split(' ');   
    if (delim == ' ' && arrClass.length > arrObjClass.length) continue;
    var c = 0;
    comparisonLoop:
    for (var k = 0, l = arrObjClass.length; k < l; k++) {
      for (var m = 0, n = arrClass.length; m < n; m++) {
        if (arrClass[m] == arrObjClass[k]) c++;
        if ((delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
          arr.push(objColl[i]); 
          break comparisonLoop;
        }
      }
    }
  }
  return arr; 
}

// To cover IE 5 Mac lack of the push method
Array.prototype.push = function(value) {this[this.length] = value; };
