ant='';

writeCookie();

function writeCookie(){
var today = new Date();
var the_date = new Date("December 31, 2023");
var the_cookie_date = the_date.toGMTString();
var the_cookie = "users_resolution="+ screen.width +"x"+ screen.height;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie=the_cookie
}

function submenu(capa,tot){
	for(i=0;i<tot;i++){
		document.getElementById('submenu'+i).style.visibility='hidden';
		document.getElementById('submenu'+i).style.position='absolute';
	}
	document.getElementById('submenu'+capa).style.visibility='visible';
	document.getElementById('submenu'+capa).style.position='relative';
}

function canviImg(idimg,img){
	document.getElementById(idimg).src=eval(img+'.src');
}

function comprovarForm(dades,noms){
	camps=dades.split(",");
	nomcamps=noms.split(",");
	for(i=0;i<camps.length;i++){
		if(camps[i]=='email'){
			if ((document.getElementById('email').value =="") || !(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value))){
      			alert("Email incorrecto.");
      			return false;
    		}else if(document.getElementById('email').value!=document.getElementById('confirmemail').value){
    			alert("Confirmacion del Email incorrecta.");
      			return false;
    		}
		}else{
			text=document.getElementById(camps[i]).value;
			if (document.getElementById(camps[i]).value =="" || text.indexOf("(*)")>0){
      			alert(nomcamps[i]+" incorrecto.");
      			return false;
    		}
		}
	}

	return true;
}

function efectegris(obj,actiu){
	if(actiu)	obj.style.filter='gray';
	else obj.style.filter='';
}

function menuGaleria(capa){
	if(ant==capa){
		document.getElementById(ant).style.display='none';
		document.getElementById('bullet'+ant).src=bulleton.src;
		document.getElementById('tr'+ant).style.backgroundColor='#ffffff';
		ant='';
	}else{
		if(document.getElementById(ant)){
			document.getElementById(ant).style.display='none';
			document.getElementById('bullet'+ant).src=bulleton.src;
			document.getElementById('tr'+ant).style.backgroundColor='#ffffff';
		}
		document.getElementById('bullet'+capa).src=bulletoff.src;
		document.getElementById(capa).style.display='block';
		ant=capa;
	}
}

function scroll(on,capa){
	if(actiu){
		if(on=='up'){
			document.getElementById(capa).scrollTop=document.getElementById(capa).scrollTop+10;
		}else{
			document.getElementById(capa).scrollTop=document.getElementById(capa).scrollTop-10;
		}

	setTimeout("scroll('"+on+"','"+capa+"')",50);
	}
}
