//------------------------------------------------------
// Generic toggle script

// attributes:
// el : element object passed to the function
// t : tag name of the elements that need to be toggled
// s : this allows you to alter the className for the opened list container [true or false]
// l : threshold value of when to trigger alternate className

function toggleME(el,tag,s,l){
  var tag = ( tag=="" || tag==undefined || tag==null ) ? 'LI' : tag ;
  var e = fpd(el,tag);
  var o="open";
  var c="closed";
  if(arguments.length>2) {
    var liElm = e.getElementsByTagName(tag);
    if (liElm.length>l && s==true ){ o='openSpecial' }
  }
  if (e.className.indexOf(c)>-1){
    removeCSSClass(e,c);
    addCSSClass(e,o);
  } else if (e.className.indexOf(o)>-1) {
    removeCSSClass(e,o);
    addCSSClass(e,c);
  }
}
function addCSSClass(elem,cn){elem.className=(elem.className+" "+cn).trim();}
function removeCSSClass(elem,cn){elem.className=elem.className.replace(cn,"").trim();}
String.prototype.trim=function(){return this.replace( /^\s+|\s+$/, "" );}
function fpd(elem,tag){var o=elem;while(o.parentNode.nodeName.toUpperCase()!=tag.toUpperCase()){o=o.parentNode;}return o.parentNode;}

// End Generic toggle script
//------------------------------------------------------


//------------------------------------------------------
// set selected pulldown menu 

function catselector(x){
    thisid=x;
    var se = document.getElementById('catpull');
    var oe = se.options;
    for (n=0; n<oe.length; n++){
        if (oe[n].value == thisid) oe[n].selected=true ;
    }
}

// End set selected pulldown menu
//------------------------------------------------------
