// JavaScript Document
function tdmouseover_menu (text){
	text.style.color="#A84140";
	//text.style.backgroundColor = "#144B21";
}
function tdmouseout_menu (text) {
	text.style.color="black";
	//text.style.backgroundColor = "#0F9439";
}

function tdmouseover_menu1 (text){
	text.style.color="white";
	//text.style.backgroundColor = "#144B21";
}
function tdmouseout_menu1 (text) {
	text.style.color="#fadede";
	//text.style.backgroundColor = "#0F9439";
}

function tdMouseOverMenuLateral (text){
	text.style.color="#000000";
	//text.style.backgroundColor = "#144B21";
}
function tdMouseOutMenuLateral (text){
	text.style.color="#888888";
	//text.style.backgroundColor = "#144B21";
}

function changeImageBackground(text,imageBackground,textColor){
	text.style.color=textColor;
	text.style.backgroundImage='url('+imageBackground+')';
}


function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	 for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	 if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	 obj.visibility=v; }
}

function comprovarObligatoris (nom_form,inputs,desc)
{
  tots_plens=true;

	a_inputs=inputs.split(',')
	len_a_inputs=a_inputs.length;

	a_desc=desc.split(',');
	len_a_desc=a_desc.length;

	for(i=0;i<len_a_inputs;i++){
		if (eval('window.document.forms.'+nom_form+'.'+a_inputs[i]+'.value')==""){
			
			alert ('El campo '+a_desc[i]+' no puede estar vacío.');
			//alert('<?=$text_comprovar[3]?>'+a_desc[i]);
			
			eval('window.document.forms.'+nom_form+'.'+a_inputs[i]+'.select()')
			tots_plens=false;
			break;
		} 	
	}	
	return tots_plens;
}

function loadimage(url){
	
	window.open('imagen.php?imagen='+url,'','width=400,height=300,resizable=no');
	
}

function comprovarCaractersEspecials(nomForm, nomInput){

	continuar=false;

	var vVariableDoc=eval('window.document.forms.'+nomForm+'.'+nomInput+'.value');
    var vLongitud=vVariableDoc.length;
	var vLongitud1=vVariableDoc.lastIndexOf("\\");
	var resultat=vVariableDoc.substr (vLongitud1);
	
	patron =/[ñáàéèíìóòúù´ ·`'ÁÀÉÈÍÌÓÒÚÙñ]/; // Añade todos los caracteres no aceptados	
	
	if(patron.test(resultat)){
		alert ("El nom d'arxiu del camp "+nomInput+" conté caràcters no vàlids. S'han d'evitar els espais en blanc,els accents, apostròfs, etc...");
		continuar=false;
		//break;
	}else{ // if(patron.test(resultat)){
		continuar=true;	
	}
	
	return continuar;
	
}


