// JavaScript Document



//	Colors del menu
var tdColor="#000000";		// color del texto de los elementos del menu
var tdBgColor="#BBDDFF";	// color de fondo de los elementos del menu
var hlColor="BBDDFF";		// color texto cuando puntero encima
var hlBgColor="#000000";	// color fondo cuando punetor encima


// Definicio del menu



//1  BENVINGUDA
td_1 ="BENVINGUTS"
url_1 = "index.php"
	
	td_1_1 ="QUI SOM?"
	url_1_1 = "1somos.php"
	td_1_2 = "PATROCINADORS"
	url_1_2 = "1patrocinadores.php"
	td_1_3 = "INICI"
	url_1_3 = "index.php"
	
	
//2  ON ESTEM
td_2 ="ON SOM"
url_2 = "1donde.php"
	td_2_1 ="ON SOM"
	url_2_1 = "1donde.php"
	td_2_2 = "CONTACTAR"
	url_2_2 = "1contactar.php"
	
//3 SERVEIS
//td_3 ="SERVEIS"
	//url_3 = "1serveis.php"
		
		
	
//3  ACTIVITASTS
	td_3 ="ACTIVITATS"
	url_3 = "1info_aula.php"
		td_3_1 ="INFORMACIÓ"
		url_3_1 = "1info_aula.php"
		td_3_2 = "PROGRAMACIÓ"
		url_3_2 = "1programacio_aula.php"
		td_3_3 = "ALTRES CURSOS"
		url_3_3 = "1otros_cursos.php"
		
		
		
//4  SERVEIS
		td_4 = "SERVEIS"
		url_4 = "1serveis.php"
		  td_4_1 = "FORMACIÓ A MIDA"
		  url_4_1 = "1formacion_medida.php"
		  td_4_2 = "CENTRE DOCUMENTACIÓ"
		  url_4_2 = "1centro_doc.php"
		  td_4_3 = "ARTICLES I VIDEOS"
		  url_4_3 = "1articulos.php"
		
//5  ENLLAÇOS
	td_5 ="LLOCS D'INTERÈS"
	url_5 = "1enlaces.php"
	

		
		
//6  h2o point
td_6 ="LLIBRES"
url_6 = "1libros.php"


td_7 ="  . . . . . . . . . . . . . . "
//url_8 = "index.php"

		
		
var md=250;
var ti=-1;
var oTd=new Object;
oTd=null;

function doMenu(td){
	clearTimeout(ti);
	td.style.backgroundColor=hlBgColor;
	td.style.color=hlColor;
	var i;
	var sT="";
	var tda=new Array();
	tda=td.id.split("_");
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		for(i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			if(tdo[i]!=tda[i]){
				document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
				document.getElementById("td"+sT).style.color=tdColor;
				if(document.getElementById("tbl"+sT)!=null)
					document.getElementById("tbl"+sT).style.visibility="hidden";
			}
		}			
	}
	oTd=td;
	sT="tbl";
	for(i=1;i<tda.length;i++)
		sT+="_"+tda[i];
	if(document.getElementById(sT)!=null)
		document.getElementById(sT).style.visibility="visible";

}

function clearMenu(){
	if(oTd!=null){
		var tdo=new Array();
		tdo=oTd.id.split("_");
		var sT="";
		for(var i=1;i<tdo.length;i++){
			sT+="_"+tdo[i];
			document.getElementById("td"+sT).style.backgroundColor=tdBgColor;
			document.getElementById("td"+sT).style.color=tdColor;
			if(document.getElementById("tbl"+sT)!=null)
				document.getElementById("tbl"+sT).style.visibility="hidden";
		}
		oTd=null;			
	}
}

function runMenu(strURL){
	location.href=strURL;
}

var tt="";
var sT="";
var pT=new Array();
var tA=new Array();

function getCoord(st){
	tA=st.split("_");
	if(tA.length>2){
		tA=tA.slice(0,-1);
		tt=tA.join("_");
		return (document.getElementById("tbl"+tt).offsetTop+document.getElementById("td"+st).offsetTop+4)+"px;left:"+
			(document.getElementById("tbl"+tt).offsetLeft+document.getElementById("td"+st).offsetWidth-2)+"px\">";
	}
	return (document.getElementById("mainmenu").offsetTop+document.getElementById("td"+st).offsetHeight-2)+"px;left:"+
		  (document.getElementById("mainmenu").offsetLeft+document.getElementById("td"+st).offsetLeft+5)+"px\">";
}