//Menu principal
function ActivarMenuPrincipal(){
	aMyMenu = readCookie('myMenu') ? readCookie('myMenu').split(',') : new Array(1,1,1,1,1,1,1,1,1,1,1,1,1,1);
	iMyMenu = 0;
	$$('#main_menu p span').each(function(s){
	  if(s.childElements().length > 2){
		s.style.overflow = 'hidden';
		s.menuHeight = s.getHeight();
		s.menuStatus = aMyMenu[iMyMenu];
		if(s.menuStatus==0){		//Setea como se ve según cookie
		  s.style.height = '29px';
		  s.innerHTML = '<img class="btn" src="Images/flecha_down.gif" />' + s.innerHTML;
		}else{
		  s.style.paddingBottom = '10px';
		  s.innerHTML = '<img class="btn" src="Images/flecha_up.gif" />' + s.innerHTML;
		  s.up('p').style.marginBottom = '15px';
		}
	  }
	  iMyMenu++
	});

	$$('#main_menu img.btn').each(function(s){
	  s.onclick = function(){
		elemP = this.up('span');
		if(elemP.menuStatus > 0){
		  elemP.morph('height: 29px; padding-bottom: 0;');
		  elemP.up('p').morph('margin-bottom: 3px;');
		  elemP.menuStatus = 0;
		  elemP.down('img').src = 'Images/flecha_down.gif';
		}else{
		  elemP.morph('height: '+(elemP.menuHeight)+'px; padding-bottom: 10px;');
		  elemP.up('p').morph('margin-bottom: 15px;');
		  elemP.menuStatus = 1;
		  elemP.down('img').src = 'Images/flecha_up.gif';
		}
		updateMyMenu();
	  }
	});
	
	//Actualizar cookie
	function updateMyMenu(){
	  aSetMenu = new Array();
	  iSetMenu = 0;
	  $$('#main_menu p span').each(function(s){
		aSetMenu[iSetMenu++] = s.menuStatus ? s.menuStatus : 0;
	  });
	  createCookie('myMenu', aSetMenu, 30);
	}
	
}


//Logins
function ActivarLoginsHome(){
	$$('#forms_menu .tab_content').each(function(sh){sh.hide();});
	$('Webmail').show();
	$$('#forms_menu li').each(function(s){
	  s.onclick = function(){
		this.siblings().each(function(sh){
		  sh.className = '';
		});
		this.className = 'selected';
		$$('#forms_menu .tab_content').each(function(sh){sh.hide();});
		tabName = this.title;
		$(tabName).show();
	  }
	});
}



