function collapse()
{
// check if DOM is available, return if not
  if(!document.createTextNode){return;}

  var dropdowns = getElementsByClassName(document,"div","dropdown trigger");
	var closebutton = getElementsByClassName(document,"A","close");

// loop through all dropdown menus
  for(var i=0;i<dropdowns.length;i++)
  {

// grab the next sibling (the loop is needed because
// of whitespace issues
      var tohide=dropdowns[i].nextSibling;
      while(tohide.nodeType!=1)
      {
        tohide=tohide.nextSibling;
      }
// hide the sibling by applying the class 'hide' and 
// show that the dropdown menu is clickable by applying 
// the class 'trigger'
      cssjs('add',tohide,'hide')
      cssjs('add',dropdowns[i],'trigger')
// store the element to be hide in an attribute
      dropdowns[i].tohide=tohide;
			

			
// if the user activates the dropdown menu
      dropdowns[i].onclick=function()
      {

// test if the class 'hide' is already applied to the 
// next sibling

        if(cssjs('check',this.tohide,'hide'))
        {
// if that is the case, replace it with show and 
// the dropdown menu class with open

					cssjs('remove',dropdowns[0],'open');
					cssjs('add',dropdowns[0],'trigger');
					cssjs('remove',dropdowns[0].tohide,'show');
					cssjs('add',dropdowns[0].tohide,'hide');
					
					cssjs('remove',dropdowns[1],'open');
					cssjs('add',dropdowns[1],'trigger');
					cssjs('remove',dropdowns[1].tohide,'show');
					cssjs('add',dropdowns[1].tohide,'hide');

          cssjs('swap',this,'trigger','open');      
          cssjs('swap',this.tohide,'hide','show');   
					fixListHeights();
        } else {
// and vice versa
          cssjs('swap',this,'open','trigger');      
          cssjs('swap',this.tohide,'show','hide');  
					fixListHeights();
        }
			}
// add close button functionality
			closebutton[i].onclick=function(){
				cssjs('remove',dropdowns[0],'open');
				cssjs('add',dropdowns[0],'trigger');
				cssjs('remove',dropdowns[0].tohide,'show');
				cssjs('add',dropdowns[0].tohide,'hide');
				
				cssjs('remove',dropdowns[1],'open');
				cssjs('add',dropdowns[1],'trigger');
				cssjs('remove',dropdowns[1].tohide,'show');
				cssjs('add',dropdowns[1].tohide,'hide');
				return false;
			}			
		}

  function cssjs(a,o,c1,c2)
			{
				switch (a){
					case 'swap':
						o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
					break;
					case 'add':
						if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
					break;
					case 'remove':
						var rep=o.className.match(' '+c1)?' '+c1:c1;
						o.className=o.className.replace(rep,'');
					break;
					case 'check':
						return new RegExp('\\b'+c1+'\\b').test(o.className)
					break;
				}
			}
		}

function fixListHeights(){
	var listitems = document.getElementById("search-our-experience").getElementsByTagName("li")
		for(var j=0;j < listitems.length;j++){
				if (listitems[j].offsetHeight > 30){
					listitems[j].className = "taller";
				}
		}
}

addLoadEvent(collapse);
