
function preparaMenu () {
if(!document.getElementsByTagName) return false;
if(!document.getElementById) return false;
if(!document.getElementById("menu_principal")) return false;
							
var menu_principal = document.getElementById("menu_principal");							
var imatges = menu_principal.getElementsByTagName("img");

	for(var i = 0; i < imatges.length; i++) {	
	imatges[i].onmouseover = function() {
	fesHover(this,true);
	};	

	imatges[i].onmouseout = function() {
	fesHover(this,false);
	};	
	}
}


function fesHover (quin,estaSobre) {
if(quin.className != 'triat'){
	if (estaSobre) {
	var nom_arxiu_vell = quin.getAttribute("src");
	var nom_arxiu_nou = nom_arxiu_vell.replace('normal','hover')
	quin.setAttribute("src",nom_arxiu_nou);
	}	
	else {
	var nom_arxiu_vell = quin.getAttribute("src");
	var nom_arxiu_nou = nom_arxiu_vell.replace('hover','normal')
	quin.setAttribute("src",nom_arxiu_nou);
	}
}
}


function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}


function desplegaMenu(mostra) {
var e = document.getElementById("guia_pedagogica");
if (mostra == true) {
e.className = "menu_obert";
}
else {
e.className = "menu_tancat";	
}
}

/* popup centrat */
function popup(url,windowname,width,height,features) { 
width=(width)?width:screen.width/2; 
height=(height)?height:screen.height/2; 
var screenX = (screen.width/2 - width/2); 
var screenY = (screen.height/2 - height/2); 
if (features) {
var features= "width=" + width + ",height=" + height + "," + features; 	
} 
else {
var features= "width=" + width + ",height=" + height +",scrollbars=yes,status=no,resizable=no"; 
}
features += ",screenX=" + screenX + ",left=" + screenX; 
features += ",screenY=" + screenY + ",top=" + screenY; 

var mywin=window.open(url, windowname, features); 
if (mywin) 
mywin.focus(); 
return mywin; 
} 


// funcions que carreguem a l'inici
// --------------------------------
addLoadEvent(preparaMenu);

function validar() {
	
	pdf  = document.getElementById("pdf").value;
		
	if (pdf!=""){	
		frm_pdf.submit();
	}else{
		alert("escribe la contraseņa");
	}
}


