/**
 * @author freddy
 */

 
var Metrosplash;


if(!Metrosplash)
{
   Metrosplash = {}
}


Metrosplash.util = {};
Metrosplash.util.accordionMenu = function (el) {
   var menu = Ext.get(el);
   
   var onClick = function(event, el, options) {
      clearOptions();
      Ext.fly(this.id+"Menu").applyStyles({
         display: 'block'
      });
      
   }
   

   
   var clearOptions = function() {
      var first = menu.first();
      
      Ext.fly(first.id+"Menu").applyStyles({
         display: 'none'
      });
      var sib = first.next();
      while(sib != null)
      {
         Ext.fly(sib.id+"Menu").applyStyles({
            display: 'none'
         });
         sib = sib.next();
      }     
   }
   
   var child = menu.first();
   child.on("click", onClick);
   var nextChild = child.next();
   while(nextChild != null)
   {
      nextChild.on("click", onClick);
      nextChild = nextChild.next();
   }
   
   if(window && window.location &&  window.location.hash && window.location.hash != "")
   {
		var selected = window.location.hash.substr(1);
		clearOptions();
	    Ext.fly(selected+"Menu").applyStyles({
		 display: 'block'
  	  });

   }
}
 