var SunValley = {};
SunValley.expandList = {
  'initialise'	: 	function (){
  				SunValley.expandList.open = false;
  				SunValley.expandList.drops = Lib.Dom.getElementsByClassName(document, 'div', 'drop');
  				if (SunValley.expandList.drops.length > 0){
  				 dropped = [];
				 for (var i=0; i<SunValley.expandList.drops.length; i++){
				  dropped.push(Lib.Dom.Elm.first(SunValley.expandList.drops[i], "div"));
				  Lib.Dom.Elm.Style.add (dropped[dropped.length-1], {'display':'none'});
				  Lib.Dom.addEvent(Lib.Dom.Elm.first(SunValley.expandList.drops[i], "h4"), "click", Lib.delegate(this, SunValley.expandList.openSec, dropped[dropped.length-1]));
				 }
				 //SunValley.expandList.openSec(false, dropped[0]);
				}
  				
  },
  'closeSec'	: 	function (){
  				if (SunValley.expandList.open){
  					SunValley.expandList.open.open = false;
  					Lib.Dom.Elm.Style.add(SunValley.expandList.open, {'display': 'none'});
  				}
  },
  'openSec' 	: 	function (e, i){
  					
  				if (i.open != true){
  				 SunValley.expandList.closeSec();
  				 SunValley.expandList.open = i;
  				 i.open = true;
				 Lib.Dom.Elm.Style.add(i, {'display':'block'});
				}else {
				 SunValley.expandList.open = i;
				 SunValley.expandList.open.open = true;
				  SunValley.expandList.closeSec();
				}
  }
};


callWhenDOMLoaded(Lib.delegate(this, Lib.Dom.LinkPanels.initialise, 'container', 'div|tr'));
callWhenDOMLoaded(SunValley.expandList.initialise);