// Menu Web Departament d'Agricultura
var currentState=0
var esta=false
var menuActual=''
// --------------------------------------------------->
function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft];
}
// --------------------------------------------------->
function alpha(boto,menu){
// Superfunci�n que no va:  rE(menu).style.marginLeft=findPos(rE(boto))+'px';
//alert("menuSelecionado= "+menu+", menuAcutal= "+menuActual)
var bt=document.getElementById(boto)
var me=document.getElementById(menu)
me.style.marginLeft=findPos(bt)+'px';
	if(menuActual==''){
		menuActual=menu
	}
	if(menuActual!=menu){
		if(currentState==1){
			var myFx = new Fx.Style(menuActual, 'opacity').start(0.9,0);
		}
		menuActual=menu
		currentState=0
	}
	if(currentState==0){
		var myFx = new Fx.Style(menu, 'opacity').start(0,0.9);
		currentState=1;
	}else{
		var myFx = new Fx.Style(menu, 'opacity').start(0.9,0);
		currentState=0;
	}
}
function comprueba(){
	if ((esta==false)&&(currentState!=0)){
			var myFx = new Fx.Style(menuActual, 'opacity').start(0.9,0);
			currentState=0
	}
}
// --------------------------------------------------->
function creaMenu(){
	var myFx = new Fx.Style('menuRamaders', 'opacity').set(0);
	var myFx = new Fx.Style('menuGossera', 'opacity').set(0);
	var myFx = new Fx.Style('menuExplotacions', 'opacity').set(0);
	var myFx = new Fx.Style('menuVeterinari', 'opacity').set(0);
	document.getElementById('menuRamaders').style.marginLeft=findPos(document.getElementById('menuRamaders'))+500+'px';
	document.getElementById('menuGossera').style.marginLeft=findPos(document.getElementById('menuGossera'))+'px';
	document.getElementById('menuExplotacions').style.marginLeft=findPos(document.getElementById('menuExplotacions'))+'px';
	document.getElementById('menuVeterinari').style.marginLeft=findPos(document.getElementById('menuVeterinari'))+'px';
}
