// JavaScript Document

var URL;
var ANTURL;
var lang;

///////////////////////////// MENUS /////////////////////////////

function CargaBotons(){
	misImgN = new Array("Compra_N.jpg","M11_N.jpg","M12_N.jpg","M13_N.jpg","M14_N.jpg","M15_N.jpg","Botiga_N.jpg","M21_N.jpg","M22_N.jpg","M23_N.jpg","M24_N.jpg","M25_N.jpg","M26_N.jpg","M27_N.jpg","Contacta_N.jpg","M31_N.jpg","M32_N.jpg","M33_N.jpg","M34_N.jpg","Andreu_N.jpg","M41_N.jpg","M42_N.jpg","M43_N.jpg","bcn.jpg","hosp.jpg","sab.jpg","sant.jpg","salt.jpg","Compra1_S.jpg","Botiga_S.jpg","Contacta_S.jpg","Andreu_S.jpg");
	misImgR = new Array("Compra_R.jpg","M11_R.jpg","M12_R.jpg","M13_R.jpg","M14_R.jpg","M15_R.jpg","Botiga_R.jpg","M21_R.jpg","M22_R.jpg","M23_R.jpg","M24_R.jpg","M25_R.jpg","M26_R.jpg","M27_R.jpg","Contacta_R.jpg","M31_R.jpg","M32_R.jpg","M33_R.jpg","M34_R.jpg","Andreu_R.jpg","M41_R.jpg","M42_R.jpg","M43_R.jpg","","","","","","","","","");
	misBot= new Array ("1","11","12","13","14","15","2","21","22","23","24","25","26","27","3","31","32","33","34","4","41","42","43","100","101","102","103","104","105","106","107","108");
}

function mostrarMenu(layer,titulo,barra,ImgId,img){	
if(old_ImgId != null){
	ocultarmenu(old_ImgId,old_img);
}
	old_ImgId=ImgId;
	old_img=document.getElementById(ImgId).src;
	document.getElementById(ImgId).src=eval(img+".src");
	layerID=xGetElementById(layer);
	tituloID=xGetElementById(titulo);
	barraID=xGetElementById(barra);
	PosLbarra=xOffsetLeft(barraID);
	PosLMenu=xOffsetLeft(tituloID);
	if(layer=='menu4'){
		PosFinal=PosLbarra+PosLMenu+3;	
	}
	if(layer=='menu1'){
		PosFinal=PosLbarra+PosLMenu+4;	
	}
	if(layer=='menu2'){
		PosFinal=PosLbarra+PosLMenu+3;	
	}
	if(layer=='menu3'){
		PosFinal=PosLbarra+PosLMenu+3;	
	}
	xMoveTo(layerID,PosFinal);
	xShow(layerID);
	ignorarOcultar();	
}

function cargaImg(ImgId,img){
	document.getElementById(ImgId).src=eval(img+".src");
}

function descargarImg(ImgId,img){
	document.getElementById(ImgId).src=eval(img+".src");
}

function cargaImgProd(zona,ImgId,img){
	document.getElementById(ImgId).src=img;
	if(zona !='menuProd1'){
		document.getElementById(zona).id='menuProd6';
	}else{
		document.getElementById(zona).id='menuProd7';	
	}
	
}

function descargaImgProd(zona,ImgId,img){
		document.getElementById(ImgId).src=img;
	if(zona !='menuProd1'){
		document.getElementById('menuProd6').id=zona;
	}else{
		document.getElementById('menuProd7').id=zona;
	}
}

function ocultarFondo(ImgId,img){
	clearTimeout(retardo);	
	retardo=setTimeout("ocultarmenu('"+ImgId+"','"+img+"')",500);
}

function ignorarOcultar(){
	clearTimeout(retardo);	
}

function ignorarOcultarMen(){
	ignorarOcultar();	
}

function ocultarmenu(ImgId,img){
	document.getElementById(ImgId).src=img;
	ocultarTodo();
}

function ocultarTodo(){
	xHide('menu1');
	xHide('menu2');
	xHide('menu3');
	xHide('menu4');
}

///////////////////////////// CONTROL LOAD + URL /////////////////////////////
function Inicio(URL_com){
	num=URL_com.length;
	do {
	car=URL_com.substring(num-1,num);
	num--;
	} while(car != "/");
	lang=URL_com.substring((num-3),num);
	URL=URL_com.substring((num+1),URL_com.length);
	ANTURL=URL_com.substring(0,(num-4));
}

function canviIdioma(idiomanou){
	URLFinal=(ANTURL+"/"+idiomanou+"/"+URL);
	parent.location.href=URLFinal;
}

function cargarIndex(){
	navegador=navigator.userAgent;
	if(navegador.indexOf("Safari")!=-1 || navegador.indexOf("Firefox")!=-1 ){	
		document.getElementsByTagName("body")[0].className="especialIdx";
		document.getElementsByTagName("body")[0].scrolling="yes";
	}
	tiempo=setTimeout('precarga()',500);
}

function cargarframes(){
	navegador=navigator.userAgent;
	if(navegador.indexOf("Safari")!=-1){	
		document.getElementsByTagName("body")[0].className="especialIdx";
	}
	if(navegador.indexOf("MSIE")!=-1){
		parent.document.getElementById("Llistat").style.overflowY="hidden";
	}
	
}

//////////////////////////FUNCIONS CISTELLA////////////////////////////////

function cesta_cant(valor, linea){
	xajax_ActLinea(valor.value, linea);
}

function reg_cant(valor, linea){
	xajax_ActLineaReg(valor.value, linea);
}

function recargar(){
	window.location.reload();
}


//////////////////////////VARIS////////////////////////////////

function cambiSelProd(id,capa,familia){
	document.getElementById("F"+oldcapa).style.backgroundColor="#2f2f2f";
	document.getElementById("T"+oldcapa).style.color=Txt_list;
	document.getElementById("P"+oldcapa).style.color=Txt_list;
	document.getElementById("PT"+oldcapa).style.color=Lab_list;
	document.getElementById("Q"+oldcapa).style.color=Txt_list;
	document.getElementById("QT"+oldcapa).style.color=Lab_list;
	document.getElementById("F"+capa).style.backgroundColor=Img_bg_sel;
	document.getElementById("T"+capa).style.color=Txt_sel;
	document.getElementById("P"+capa).style.color=Txt_sel;
	document.getElementById("PT"+capa).style.color=Lab_sel;
	document.getElementById("Q"+capa).style.color=Txt_sel;
	document.getElementById("QT"+capa).style.color=Lab_sel;
	oldcapa=capa;	
	if(familia !=4){
		URLFinal=("Compra/I_Producte.php?Id="+id+"&obj=Q"+capa+"&num="+capa+"&familia="+familia+"");
	}else{
		URLFinal=("Compra/I_Regal.php?Id="+id+"&obj=Q"+capa+"&num="+capa+"&familia="+familia+"");
	}
	parent.Menu.frproducto.location.href=URLFinal;
}



function visualizarPest(zona,pestan){
	document.getElementById(pestOld).style.backgroundImage="url(../../ImgDesign/Pestanya_r.jpg)";
	document.getElementById(zonaOld).style.visibility="hidden";
	document.getElementById(pestan).style.backgroundImage="url(../../ImgDesign/Pestanya_n.jpg)";
	document.getElementById(zona).style.visibility="visible";
	zonaOld=zona;	
	pestOld=pestan;
}

function cambiarfondo(elemento,img){
	document.getElementById(elemento).style.backgroundImage="url(../ImgDesign/"+img+")";
}

function cambiarfondo_B(elemento,img){
	if(old_submenu != elemento){
		document.getElementById(elemento).style.backgroundImage="url(../ImgDesign/"+img+")";
	}
}


function clicarfondo_B(elemento,direccion){
	if(old_submenu != elemento){
		document.getElementById(elemento).style.backgroundImage="url(../ImgDesign/Bot_submenu_R.jpg)";
		document.getElementById(old_submenu).style.backgroundImage="url(../ImgDesign/Bot_submenu_N.jpg)";
		old_submenu=elemento;
	}
	subFrame.location.href=direccion;
}

function mostrar_X(elemento,img){
		document.getElementById(elemento).style.backgroundImage="url(../ImgDesign/Bot_extra_R.jpg)";
		act="zona_"+elemento;
		xVisibility(act,true);
}

function amagar_X(elemento,img){
	document.getElementById(elemento).style.backgroundImage="url(../ImgDesign/Bot_extra_N.jpg)";
		act="zona_"+elemento;
		xVisibility(act,false);
}

function cambiarfondo_T(elemento,color){
	if(old_tastet != elemento){
		document.getElementById(elemento).style.backgroundColor=color;
	}
}

function clicarfondo_T(elemento,color,idioma,fam){
	
		if(old_tastet != elemento){
			document.getElementById(old_tastet).style.backgroundColor="#333333";	
			zona=old_tastet+"a";
			xVisibility(zona,false);
			zona=old_tastet+"s";
			xVisibility(zona,false);
			
			document.getElementById(elemento).style.backgroundColor=color;	
			zona=elemento+"a";
			xVisibility(zona,true);
			zona=elemento+"s";
			xVisibility(zona,true);
			old_tastet=elemento;
		}
		xajax_swFondo(fam,idioma);
}	

function seleccionarFam_T(idioma,arx){
	img="../Continguts/tastets/"+idioma+"/"+arx;
	xBackground("I_tastet","",img);
}
	

//////////////////////////AJAX FUNCIONES////////////////////////////////
function Compraprod(Id_producto,precio,obj,num,familia){
	formCant=document.Producto.Cantidad.value;
	xajax_ActCompra(Id_producto,formCant,precio,obj,num,familia);
}

function Tornarestat(language){
	if(language == "CAT"){
		setTimeout("MisCat()",1500);
	}else{
		setTimeout("MisCast()",1500);
	}
}

function MisCast(){
	xajax_ActMissatge('Mira tu cesta');
}

function MisCat(){
	xajax_ActMissatge('Mira la teva cistella');
}

function Actualinferior(obj,num,cant,familia){
	top.Llistat.xajax_Actquantitat(obj,num,cant,familia);
}

function ActMenu(lang){
	top.Menu.xajax_ActMenu();
}
	

function NoValidCantReg(){
		if(lang=="CAT"){
	alert("Per reduir la quantitat cal esborrar al producte en la cistella");
		}else{
			alert("Para reducir la cantidad es necesario borrar el producto de la cesta");
		}
}


//////////////////////////FUNCIONS GENERALS////////////////////////////////

// CAMBIAR A FORMATO NUMERICO PARA MOSTRAR CON JAVASCRIPT  //
function numerico(numero){
	numero *=100;
	numero=Math.round(numero);
	numero /=100;
	
	numeroCadena=Math.abs(numero).toString();

	if(numeroCadena.indexOf(".")==-1){
		numeroCadena+=".00";
	}else{
		decimales=numeroCadena.substr(numeroCadena.indexOf("."));
		if(decimales.length ==2){
			numeroCadena+="0";
		}
	}
	numeroCadena=numeroCadena.replace(/\./,",");
	if (numeroCadena.length > 6){
		posfinal=numeroCadena.indexOf(",",0);
		dec=numeroCadena.substring(posfinal);
		ent=numeroCadena.substring(0,posfinal);
		longitud=ent.length % 3;
		while (longitud<ent.length){
			if(longitud==0){
				longitud=3;
			}
			ent=ent.substr(0,longitud)+"."+ent.substr(longitud,ent.length);
			longitud+=4
		}
		numeroCadena=ent+dec;
	}
	numeroCadena=numeroCadena+" €";
	
	return numeroCadena;
}

// TRADUCCION NUMERO DECIMAL Y MILLARES  A  FORMATO INGLES//
function formatoNum(numero){
	posfinal=numero.indexOf(",",0);
	dec=numero.substring(posfinal);
	ent=numero.substring(0,posfinal);
	dec=dec.replace(/\,/,".");
	ent=ent.replace(/\./,"");
	numeroCadena=ent+dec
return numeroCadena;
}


//////////////////////////CONTROL POPUPS////////////////////////////////

function AbrirVentanaPop(Direccion,NombreVen){
	navegador=navigator.userAgent;
	if(navegador.indexOf("Safari")==-1){
	parametros="width=605, height=240, left=100, top=100, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=auto, status=no";
	}else{
	parametros="width=625, height=260, left=100, top=100, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=auto, status=no";	
	}
	ventanaPop=window.open(Direccion,NombreVen,parametros);	
	ventanaPop.focus();
}

function CerrarPopTienda(){
	window.close();
}

function AbrirVentanaLegal(Direccion,NombreVen){
	navegador=navigator.userAgent;
	if(navegador.indexOf("Safari")==-1){
		parametros="width=805, height=685, left=100, top=50, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=yes, status=no";
	}else{
		parametros="width=825, height=705, left=100, top=50, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=yes, status=no";	
	}
	ventanaPop=window.open(Direccion,NombreVen,parametros);	
	ventanaPop.focus();
}

function AbrirVentanaMapa(Direccion,NombreVen){
	navegador=navigator.userAgent;
	if(navegador.indexOf("Safari")==-1){
		parametros="width=615, height=750, left=100, top=50, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=yes, status=no";
	}else{
		parametros="width=630, height=770, left=100, top=50, resizable=no, menubar=no, toolbar=no, directories=no, scrollbars=yes, status=no";	
	}
	ventanaPop=window.open(Direccion,NombreVen,parametros);	
	ventanaPop.focus();
}

function CerrarPop(proc){
	if(proc==1){
		opener.window.document.registrePag.accept.checked=1;
		opener.window.document.registrePag.accept.value="1";
	}
	window.close();
}

function mapatornar(url){
	opener.top.location.href=url;
	window.close();
}
//////////////////////////PAGAMENTS////////////////////////////////

function AccesPagar(numprod,lugar){
	if(numprod==0){
		if(lang=="CAT"){
		alert("No té productes");
		}else{
			alert("No tiene productos");
		}
	}else{
		if(lugar =="Si"){
			xajax_Pagar();	
		}else{
			if(lang=="CAT"){
			alert("Falta indicar correctament adreça de lliurament");	
			}else{
				alert("Falta indicar correctamente dirección de entrega");	
			}
		}
	}
	
}

function AccesPagarTot(lugar,lugarReg){
	if(lugar =="Si" & lugarReg =="Si"){
		xajax_Pagar();	
	}else{
		if(lang=="CAT"){
			alert("Falta indicar correctament adreça de lliurament");	
		}else{
			alert("Falta indicar correctamente dirección de entrega");	
		}
	}
	
}


function GoPagar(){
	URLFinal=("Cist_Pagar.php");
			location.href=URLFinal;
}

function swCheck(camp){
	if(	eval("document."+camp+".checked")==true){
		eval("document."+camp+".value='Si'");
	}else{
		eval("document."+camp+".value='No'");
	}
}

function swFiscal(camp){
	if(	document.registrePag.fiscal.checked==true){
		document.registrePag.fiscal.value="Si";
		xajax_VerFiscal('Si');
	}else{
		document.registrePag.fiscal.value="No";
		xajax_VerFiscal('No');
	}
}

function controlPaga(){
	if(( document.registrePag.Noms.value=="" ||  document.registrePag.Mail.value=="" || document.registrePag.Sexe.value==""  ||  document.registrePag.accept.checked==0 ) ||  (document.registrePag.Telefon.value=="" && document.registrePag.Mobil.value=="")){
		if(lang=="CAT"){
		alert("Es necesari omplir les dades que tenen * i llegir la politica de privacitat");	
		}else{
			alert("Es necesario cumplimentar los datos que tienen * y leer la política de privacidad");
		}
		return false;
	}else{
		if(document.registrePag.vol_registra.value=="Si"){
			 if( (document.registrePag.Contrasenya.value=="") && (document.registrePag.Contrasenya.value !=document.registrePag.Contrasenya2.value)){
				 if(lang=="CAT"){
				alert("Les contrasenyes no son iguals");
				 }else{
					alert("Las contraseñas no son iguales"); 
				 }
				return false;
			}else {
				xajax_VerMail(document.registrePag.Mail.value);
			}
		} else{
			document.registrePag.submit();
		}
	}
}

function No_registrat(){
	if(lang=="CAT"){
		alert ("Aquest mail ja existeix");
	}else{
			alert ("Este mail ya existe");
	}
}

function registrat(camp){
	eval("document."+camp+".submit()");
}

function Refresc(desti){
	location.href=desti;	
}

function VeureAnt(){
	xVisibility("cist_ant",true);
}

//////////////////////////FORMULARIS////////////////////////////////

function controlReg(){
	if(( document.registre.Noms.value=="" || document.registre.Adresa.value=="" || document.registre.Numero.value=="" || document.registre.Poblacio.value==""  || document.registre.CP.value==""  ||  document.registre.Mail.value=="" || document.registre.Noms2.value=="" || document.registre.Adresa2.value=="" || document.registre.Numero2.value=="" || document.registre.Poblacio2.value==""  || document.registre.CP2.value=="" || document.registre.Sexe.value=="") ||  (document.registre.Telefon.value=="" && document.registre.Mobil.value=="")){
		if(lang=="CAT"){
			alert("Es necesari omplir les dades que tenen *");
		}else{
			alert("Es necesario cumplimentar los datos que tienen *");
		}
		return false;
		}else{
			ok=document.registre.Mail.value.indexOf("@");
			if(ok===-1 || ok===0 || ok===(document.registre.Mail.value.length)-1 ){
				if(lang=="CAT"){
				alert("L'adreça de correu no es correcte");	
				}else{
					alert("La dirección de correo no es correcta");	
				}
				return false;
			} else{
				 if( (document.registre.Contrasenya.value=="") && (document.registre.Contrasenya.value !=document.registre.Contrasenya2.value)){
				 if(lang=="CAT"){
				alert("Les contrasenyes no son iguals");
				 }else{
					alert("Las contraseñas no son iguales"); 
				 }
				return false;
				 }	else{
					 xajax_VerMail(document.registre.Mail.value,document.registre.CP2.value);
				 }
			}
		}
}

function controlAten(){
		if( document.atencio.Noms.value=="" || document.atencio.Adresa.value==""  || document.atencio.Poblacio.value==""  || document.atencio.CP.value==""  ||  document.atencio.Mail.value=="" ||  (document.atencio.Telefon.value=="" && document.atencio.Mobil.value=="") ){
		if(lang=="CAT"){
			alert("Es necesari omplir les dades que tenen *");
		}else{
			alert("Es necesario cumplimentar los datos que tienen *");
		}
		return false;
		}else{
			ok=document.atencio.Mail.value.indexOf("@");
			if(ok===-1 || ok===0 || ok===(document.atencio.Mail.value.length)-1 ){
				if(lang=="CAT"){
				alert("L'adreça de correu no es correcte");	
				}else{
					alert("La dirección de correo no es correcta");	
				}
				return false;
			}
		}
}

function controlMillorar(){
	if( document.millorar.Noms.value=="" || document.millorar.Adresa.value==""  || document.millorar.Poblacio.value==""  || document.millorar.CP.value==""  ||  document.millorar.Mail.value=="" || (document.millorar.edad[0].checked==false && document.millorar.edad[1].checked==false && document.millorar.edad[2].checked==false && document.millorar.edad[3].checked==false && document.millorar.edad[4].checked==false  && document.millorar.edad[5].checked==false  ) || (document.millorar.Telefon.value=="" && document.millorar.Mobil.value=="")){
		if(lang=="CAT"){
			alert("Es necesari omplir les dades que tenen *");
		}else{
			alert("Es necesario cumplimentar los datos que tienen *");
		}
		return false;
		}else{
			ok=document.atencio.Mail.value.indexOf("@");
			if(ok===-1 || ok===0 || ok===(document.millorar.Mail.value.length)-1 ){
				if(lang=="CAT"){
				alert("L'adreça de correu no es correcte");	
				}else{
					alert("La dirección de correo no es correcta");	
				}
				return false;
			}
		}
}

function controlSollicitud(){
		if( document.sollicitud.Noms.value=="" || document.sollicitud.Adresa.value=="" || document.sollicitud.Pais.value==""  || document.sollicitud.DNI.value=="" || document.sollicitud.estudis.value==""  || document.sollicitud.professional.value=="" || document.sollicitud.Poblacio.value==""  || document.sollicitud.CP.value==""  ||  document.sollicitud.Mail.value=="" ||  (document.sollicitud.Telefon.value=="" && document.sollicitud.Mobil.value=="") ||  (document.sollicitud.illa.checked==false && document.sollicitud.granvia.checked==false && document.sollicitud.caterina.checked==false && document.sollicitud.sabadell.checked==false && document.sollicitud.cugat.checked==false && document.sollicitud.salt.checked==false) ||  (document.sollicitud.matins.checked==false && document.sollicitud.migdies.checked==false && document.sollicitud.tardes.checked==false && document.sollicitud.capsetmana.checked==false) ||  (document.sollicitud.catala.checked==false && document.sollicitud.castella.checked==false && document.sollicitud.angles.checked==false && document.sollicitud.frances.checked==false && document.sollicitud.altres.checked==false)){
		if(lang=="CAT"){
			alert("Es necesari omplir les dades que tenen *");
		}else{
			alert("Es necesario cumplimentar los datos que tienen *");
		}
		return false;
		}else{
			ok=document.sollicitud.Mail.value.indexOf("@");
			if(ok===-1 || ok===0 || ok===(document.sollicitud.Mail.value.length)-1 ){
				if(lang=="CAT"){
				alert("L'adreça de correu no es correcte");	
				}else{
					alert("La dirección de correo no es correcta");	
				}
				return false;
			}
		}
}

function tancarLliure(tip,linea){
		if(document.registrepop.Noms2.value=="" || document.registrepop.Adresa2.value=="" || document.registrepop.Numero2.value=="" || document.registrepop.Poblacio2.value==""  || document.registrepop.CP2.value==""){
		if(lang=="CAT"){
			alert("Es necesari omplir les dades que tenen *");
		}else{
			alert("Es necesario cumplimentar los datos que tienen *");
		}
		}else{
			S1=document.registrepop.Noms2.value;
			S2=document.registrepop.Adresa2.value;
			S3=document.registrepop.Numero2.value;
			S4=document.registrepop.Pis2.value;
			S5=document.registrepop.Porta2.value;
			S6=document.registrepop.Escala2.value;
			S7=document.registrepop.Poblacio2.value;
			S8=document.registrepop.CP2.value;
			if(tip=="prod"){
				opener.xajax_ActLliure(S1,S2,S3,S4,S5,S6,S7,S8);
			}else{
				opener.xajax_ActLliureReg(linea,S1,S2,S3,S4,S5,S6,S7,S8);
			}
			window.close();
			
		}
}

function no_envio(){
	if(lang=="CAT"){
			alert("No tenim distribució en aquest codi postal. Posis en contacte amb nosaltres.");	
	}else{
		alert("No tenemos distribución en este código postal. Póngase en contacte con nosotros.");	
				
	}
}

	function comprobarReg(Ve,Registrat){
	Nom="";
	Contr="";
	if(Registrat=='No'){
		if( document.dadesUser.NomsAcc.value=="" || document.dadesUser.ContrasenyaAcc.value==""){
			if(lang=="CAT"){
				alert("Cal entrar usuari i codi d'accés");	
			}else{
				alert("Es necesario teclear el usuario y el código de acceso");	
			}
		}else{
			Nom=document.dadesUser.NomsAcc.value;
			Contr=document.dadesUser.ContrasenyaAcc.value;
			xajax_BuscarClient(Nom,Contr,Ve);
		}
	}else{
		Nom=document.dadesUser.NomsAcc.value;
		Contr=document.dadesUser.ContrasenyaAcc.value;
		xajax_BuscarClient(Nom,Contr,Ve);
	}
}

function Escriu_reg(llista,trata){
	parent.xajax_ActualClient(llista,trata);
}

function Error_registre(){
	if(lang=="CAT"){
	alert("Les dades d'usuari i codi d'accés no son correctes");	
	}else{
				alert("Los datos del usuario y del código de acceso no son correctos");	
			}
}

function Accept_registre(Noms){
	if(lang=="CAT"){
	alert(Noms+", benvingut/benvinguda a la botiga");
	}else{
		alert(Noms+", bienvenido/bienvenida a la tienda");
	}
	document.dadesUser.ContrasenyaAcc.value="";
}

function Ver_registre(id){
	URLFinal=("Cist_Registre.php?id="+id+"");
	location.href=URLFinal;
}

function enviarMail(){
	if( document.dadesUser.NomsAcc.value=="" ){
			if(lang=="CAT"){
			alert("Cal entrar l'usuari");	
			}else{
				alert("Es necesario introducir el usuario");	
			}
		}else{
			Nom=document.dadesUser.NomsAcc.value;
			URLFinal=("../Librerias/ValPassword.php?nom="+Nom+"");
			location.href=URLFinal;
		}
}

function Error_password(){
		if(lang=="CAT"){
	alert("Les dades d'usuari no son correctes o no existeixen");	
		}else{
		alert("Los datos de usuario no son correctos o no existen");		
		}
}


function NetejaLliure(){
	document.registre.Noms2.value="";
		document.registre.Adresa2.value="";
		document.registre.Numero2.value="";
		document.registre.Pis2.value="";
		document.registre.Porta2.value="";
		document.registre.Escala2.value="";
		document.registre.Poblacio2.value="";
		document.registre.CP2.value="";
}

function Cambi_lliura(valor){
	if(valor=="Domicili"){
		NetejaLliure();
	img="../ImgDesign/Reg_verd.jpg";
	xBackground("reg_zonaLliu","",img);
	}
	if(valor=="Propia"){
		document.registre.Noms2.value=document.registre.Noms.value;
		document.registre.Adresa2.value=document.registre.Adresa.value;
		document.registre.Numero2.value=document.registre.Numero.value;
		document.registre.Pis2.value=document.registre.Pis.value;
		document.registre.Porta2.value=document.registre.Porta.value;
		document.registre.Escala2.value=document.registre.Escala.value;
		document.registre.Poblacio2.value=document.registre.Poblacio.value;
		document.registre.CP2.value=document.registre.CP.value;
		img="../ImgDesign/Reg_rosa.jpg";
		xBackground("reg_zonaLliu","",img);
	}
}


