	var validchars      ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    var flash_menu      =new Array();
    var flash_publicidad=new Array();
    var flash_radio		=new Array();
	   
	var OSName			="Unknown OS";
	var BrowserName		=navigator.appName;
	
	if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
	if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
	if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
	if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
	
    function getUrlMenuFlash(id){
    	if (id==6){
			window.open(flash_menu[id]);
		}else{
    		location.href=flash_menu[id];
		}
    }

    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }

    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_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }

    function validar_string(cadena){
        var parsed = true;

        for (var i=0; i < cadena.length; i++) {
            var letter = cadena.charAt(i);

            if (validchars.indexOf(letter) != -1) continue;
            parsed = false;
            break;
        }

        return parsed
    }

    function emailCheck (emailStr,idioma) {
    	var emailPat=/^(.+)@(.+)$/
    	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    	var validChars="\[^\\s" + specialChars + "\]"
    	var quotedUser="(\"[^\"]*\")"
    	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    	var atom=validChars + '+'
    	var word="(" + atom + "|" + quotedUser + ")"
    	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    	var matchArray=emailStr.match(emailPat)

    	switch (idioma){
    		case "ca":
    			missatge_1="L'adreça d'e-mail sembla incorrecta (comprovar @ i .'s)";
    			missatge_2="El nom d'usuari no sembla vàl·lid.";
    			missatge_3="No són vàl·lides les adreces IP's!";
    			missatge_4="El nom del domini no sembla vàl·lid.";
    			missatge_5="El e-mail ha de terminar en tres lletres de domini, o dues lletres de codi de pa&iuml;s";
    			missatge_6="Aquesta adreça no té hostname!";
    			break;
    		case "es":
    			missatge_1="La dirección de e-mail parece incorrecta (comprovar @ y .'s)";
    			missatge_2="El nombre de usuario no parece válido.";
    			missatge_3="¡No son válidas las direciones IP's!";
    			missatge_4="El nombre del dominio no parece válido.";
    			missatge_5="El e-mail tiene que terminar con tres letras de dominio, o dos letras de código de pais";
    			missatge_6="¡Esta dirección no tiene nombre de dominio!";
    			break;
    		case "pt":
    			missatge_1="O endereço de e-mail parece incorrecto (confirmar @ e .'s)";
    			missatge_2="O nome de usuário parece incorrecto.";
    			missatge_3="Não são válidos os endereços digitados!";
    			missatge_4="O nome de domínio é inválido.";
    			missatge_5="O e-mail deve terminar com as três letreas do domínio, ou duas letras do código do seu paìs.";
    			missatge_6="Este encdereço não tem nom do domínio!";
    			break;
    		case "fr":
    			missatge_1="La dirección de e-mail parece incorrecta (comprovar @ y .'s)";
    			missatge_2="El nombre de usuario no parece válido.";
    			missatge_3="¡No son válidas las direciones IP's!";
    			missatge_4="El nombre del dominio no parece válido.";
    			missatge_5="El e-mail tiene que terminar con tres letras de dominio, o dos letras de código de pais";
    			missatge_6="¡Esta dirección no tiene nombre de dominio!";
    			break;
    		case "en":
    			missatge_1="The email adress seems incorrect (check @ and 's) ";
    			missatge_2="The user name does not seem valid.";
    			missatge_3="The IP's adresses are not valid! ";
    			missatge_4="The domain name does not seem valid. ";
    			missatge_5="The email must finish with three letters of domain, or two letters of country code";
    			missatge_6="This email adress does not have hostname! ";
    			break;
    		case "fr":
    			missatge_1="L'adresse électronique n'est pas correcte (vérifier @ et .'s)";
    			missatge_2="Le nom d'usager n'est pas valide.";
    			missatge_3="¡Les adresses IP ne sont pas valides!";
    			missatge_4="Le nom du domaine n'est pas valide.";
    			missatge_5="L'adresse électronique doit finir avec trois lettres de domaine ou deux lettres de code du pays";
    			missatge_6="¡L'adresse n'a pas un nom de domaine!";
    			break;
    	}

    	if (matchArray==null) {
    		alert(missatge_1);
    	   	return false;
    	}
    	var user=matchArray[1];
    	var domain=matchArray[2];
    	if (user.match(userPat)==null) {
    		alert(missatge_2);
    		return false;
    	}
    	var IPArray=domain.match(ipDomainPat);
    	if (IPArray!=null) {
    		for (var i=1;i<=4;i++) {
    	   		if (IPArray[i]>255) {
    	       		alert(missatge_3);
    	            return false;
    	   		}
    		}
    		return true;
    	}

    	var domainArray=domain.match(domainPat);
    	if (domainArray==null) {
    		alert(missatge_4)
    		return false
    	}

    	var atomPat=new RegExp(atom,"g");
    	var domArr=domain.match(atomPat);
    	var len=domArr.length;
    	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>4) {
    	   alert(missatge_5);
    	   return false;
    	}
    	if (len<2) {
    	   alert(missatge_6);
    	   return false;
    	}
    	return true;
    }


    function validarRegistro(idioma){
    	var f=document.registro;

    	if (f.username.value==""){
            alert(mensaje_01);
            f.username.focus();
        }else{
            if (f.username.value.length<6){
                alert(mensaje_14);
                f.username.focus();
            }else{
                if (validar_string(f.username.value)==false){
                    alert(mensaje_15);
                    f.username.focus();
                }else{
                    if (f.e_mail.value==""){
                        alert(mensaje_02);
                        f.e_mail.focus();
                    }else{
                        if (emailCheck (f.e_mail.value,idioma)==false){
                            f.e_mail.focus();
                        }else{
                            if ((f.password.value.length<6) || (f.password.value.length>10)){
                                alert(mensaje_03);
                                f.password.focus();
                            }else{
                                if (validar_string(f.password.value)==false){
                                    alert(mensaje_16);
                                    f.password.focus();
                                }else{
                                    if (f.password.value!=f.rep_password.value){
                                    	alert(mensaje_04);
                                        f.password.focus();
                                    }else{
                                    	if (!calidad_password(f.password.value)){
                                        	f.password.focus();
                                    	}else{
	                                        if (f.nombre.value==""){
	                                            alert(mensaje_05);
	                                            f.nombre.focus();
	                                        }else{
	                                            if (f.apellido1.value==""){
	                                                alert(mensaje_06);
	                                                f.apellido1.focus();
	                                            }else{
	                                                if (f.direccion.value.length==0){
	                                                    alert(mensaje_07);
	                                                    f.direccion.focus();
	                                                }else{
                                                    	if (Trim(f.idprovincia.value)==""){
                                                        	alert(mensaje_33);
                                                            f.idprovincia.focus();
                                                    	}else{
                                                       		if (Trim(f.sel_poblacion.value)==""){
                                                            	alert(mensaje_33);
                                                            	f.sel_poblacion.focus();
                                                        	}else{
                                                            	if (isNaN(f.telefono.value) || (f.telefono.value.length==0)){
                                                            		alert(mensaje_35);
                                                                	f.telefono.focus();
                                                            	}else{
                                                                    if (f.condiciones.checked==false){
                                                                        alert(mensaje_13);
                                                                        f.condiciones.focus();
                                                                    }else{
                                                                    	doBoton('Enviando...');
                                                                        f.submit();
                                                                    }
                                                            	}
                                                        	}
                                                        }
                                                    }
	                                            }
	                                        }
	                                    }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }


    function validar_devolucion(idioma){
        var f=document.devolucion;
        if (f.pedido.value==""){
        	alert(mensaje_23);
            f.pedido.focus();
		}else{
            if (f.comentario.value==""){
        		alert(mensaje_24);
            	f.comentario.focus();
			}else{
        		if (f.username.value==""){
            		alert(mensaje_01);
            		f.username.focus();
        		}else{
            		if (f.username.value.length<6){
		                alert(mensaje_14);
        		        f.username.focus();
		            }else{
        		        if (validar_string(f.username.value)==false){
                		    alert(mensaje_15);
		                    f.username.focus();
        		        }else{
                		    if (f.e_mail.value==""){
                        		alert(mensaje_02);
		                        f.e_mail.focus();
        		            }else{
                		        if (emailCheck (f.e_mail.value,idioma)==false){
                        		    f.e_mail.focus();
		                        }else{
        		                    if ((f.password.value.length<6) || (f.password.value.length>10)){
                		                alert(mensaje_03);
                        		        f.password.focus();
		                            }else{
        		                        if (validar_string(f.password.value)==false){
                		                    alert(mensaje_16);
                        		            f.password.focus();
                                		}else{
		                                    if (f.password.value!=f.rep_password.value){
        		                                alert(mensaje_04);
                		                        f.password.focus();
                        		            }else{
                        		            	f.submit();
											}
										}
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

	function validar_mod_password(idioma){
		var f=document.frm_mod_password;
        switch (idioma){
            case "es":
                var mensaje_01="El campo 'Nueva Contraseña' no puede tener menos de 6 carácteres ni más de 10";
                var mensaje_02="El campo 'Nueva Contraseña' contiene carácteres no válidos.\nCarácteres válidos: '"+validchars+"'";
                break;
           case "pt":
                var mensaje_01="O campo 'Novo Password' não pode ter menos de 6 caracteres nem mais de 10";
                var mensaje_02="O campo 'Novo Passaword' contém caracteres inválidos.\nCaracteres válidos: '"+validchars+"'";
                break;
          	case "fr":
                var mensaje_01="Le champ 'nouveau mot de passe' doit avoir entre 6 et 10 caractères";
                var mensaje_02="Le champ 'nouveau mot de passe' contient des caractères qui ne sont pas valides.\nCaractères valides: '"+validchars+"'";
                break;
        }
        if ((f.new_password.value.length<6) || (f.new_password.value.length>10)){
        	alert(mensaje_01);
            f.new_password.focus();
            return false;
        }else{
           if (f.new_password.value!=f.rep_password.value){
           		alert(mensaje_04);
                f.new_password.focus();
                return false;
           }else{ 
           	    if(!calidad_password(f.new_password.value)){
                    f.new_password.focus();
                    return false;
                }else{
                	return true;
                }
           }
        }
    }

    
    function validarPerfil(idioma,strdoSubmit){
        var f=document.registro;
		
        if (f.e_mail.value==""){
            alert(mensaje_02);
            f.e_mail.focus();
        }else{
            if (emailCheck (f.e_mail.value,idioma)==false){
                f.e_mail.focus();
            }else{
                if (f.nombre.value==""){
                    alert(mensaje_05);
                    f.nombre.focus();
                }else{
                    if (f.apellido1.value==""){
                        alert(mensaje_06);
                        f.apellido1.focus();
                    }else{
                        if (f.direccion.value.length==0){
                            alert(mensaje_07);
                            f.direccion.focus();
                        }else{
                            if (f.direccion.value.length>120){
                                alert(mensaje_08);
                                f.direccion.focus();
                            }else{
                            	if (Trim(f.sel_poblacion.value)==""){
                                    alert(mensaje_33);
                                    f.prv_pob_cp.focus();
                                }else{
                                    if (Trim(f.idprovincia.value)==""){
                                        alert(mensaje_33);
                                        f.idprovincia.focus();
                                    }else{
                                         if (Trim(f.codpostal.value)==""){
                                            alert(mensaje_33);
                                            f.prv_pob_cp.focus();
                                        }else{
                                        	if (isNaN(f.telefono.value) || (f.telefono.value.length==0)){
												alert(mensaje_35);
                                                f.telefono.focus();
                                          	}else{
                                          		doBoton(strdoSubmit);
                                          		f.submit();
                                          	}
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }

    
    function validar_buscador(idioma){
        var f=document.buscador;

        switch (idioma){
            case "es":
                mensaje_01="La palabra de búsqueda tiene que tener como mínimo 3 carácteres";
                break;
        }
        if (f.keyword.value.length<3){
            alert(mensaje_01);
            f.keyword.focus();
        }else{
            f.submit();
        }
    }

    function validar_amigo(idioma){
        var f=document.amigo;

        switch (idioma){
            case "es":
                mensaje_01="El campo 'Su correo electrónico' no puede estar vacio";
                mensaje_02="El campo 'Su nombre' no puede estar vacio";
                mensaje_03="El campo 'El correo electrónico de su amigo' no puede estar vacio";
                mensaje_04="El campo 'El nombre de su amigo' no puede estar vacio";
                break;
        }
        if (f.e_mail.value==""){
            alert(mensaje_02);
            f.e_mail.focus();
        }else{
            if (emailCheck (f.e_mail.value,idioma)==false){
                f.e_mail.focus();
            }else{
                if (f.nombre.value==""){
                    alert(mensaje_02);
                    f.nombre.focus();
                }else{
                    if (f.friend_mail.value==""){
                        alert(mensaje_03);
                        f.friend_mail.focus();
                    }else{
                        if (emailCheck (f.friend_mail.value,idioma)==false){
                            f.friend_mail.focus();
                        }else{
                             if (f.friend_name.value==""){
                                alert(mensaje_04);
                                f.friend_name.focus();
                            }else{
                                f.submit();
                            }
                        }
                    }
                }
            }
        }
    }

    
    function get_Video(id){
        var objeto="<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='475' height='315'>";
        objeto+="<param name='movie' value='/img/publicidad/"+flash_publicidad[id]+"'>";
        objeto+="<param name='quality' value='high'>";
        objeto+="<param name='wmode' value='transparent'>";
		objeto+="<embed src='/img/publicidad/"+flash_publicidad[id]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='475' height='315' wmode='transparent'></embed>";
        objeto+="</object>";
	if (document.all){
            document.all("flash_video").innerHTML = objeto;
        }else if (document.getElementById){
            document.getElementById("flash_video").innerHTML = objeto;
        }
    }
    
    function get_Radio(id){
        var objeto="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='295' height='80'>";
        objeto+="<param name='movie' value='/img/publicidad/"+flash_radio[id]+"'>";
        objeto+="<param name='quality' value='high'>";
        objeto+="<param name='wmode' value='transparent'>";
	objeto+="<param name='bgcolor' value='FEEC98'>";
        objeto+="<embed src='/img/publicidad/"+flash_radio[id]+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='295' height='80' wmode='transparent' bgcolor='FEEC98'></embed>";
        objeto+="</object>";
	if (document.all){
            document.all("flash_radio").innerHTML = objeto;
        }else if (document.getElementById){
            document.getElementById("flash_radio").innerHTML = objeto;
        }
	}
	function get_flash(peli){
        var objeto="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase='[flash_code_base]' width='320' height='240'>";
        objeto+="<param name='movie' value='" + peli +"'>";
        objeto+="<param name='quality' value='high'>";
        objeto+="<param name='wmode' value='transparent'>";
        objeto+="<embed src='" + peli +"' width='320' height='240' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' wmode='transparent'></embed></object>";
        objeto+="</object>";
		if (document.all){
            document.all("flash_index").innerHTML = objeto;
        }else if (document.getElementById){
            document.getElementById("flash_index").innerHTML = objeto;
        }
    }

   	function validar_franquicia(idioma){
        var f=document.franquicia;
        if (f.nombre.value==""){
            alert(mensaje_05);
            f.nombre.focus();
        }else{
            if (f.apellido1.value==""){
                alert(mensaje_06);
                f.apellido1.focus();
            }else{
                if (f.apellido2.value==""){
                    alert(mensaje_18);
                    f.apellido2.focus();
                }else{
                	 if (f.email.value==""){
            			alert(mensaje_02);
            			f.email.focus();
        			}else{
            			if (emailCheck (f.email.value,idioma)==false){
                			f.email.focus();
            			}else{
            				if (f.direccion.value==""){
		                    	alert(mensaje_07);
		                    	f.direccion.focus();
		                	}else{
		                    	if (f.poblacion.value==""){
		                        	alert(mensaje_10);
			                        f.poblacion.focus();
		    	                }else{
		    	                	if (f.telefono1.value==""){
		            	            	alert(mensaje_25);
		                	            f.telefono1.focus();
		                    	    }else{
			        	                if (f.ubicacion.value==""){
		    	        	            	alert(mensaje_19);
		        	        	            f.ubicacion.focus();
		            	        	    }else{
		                	        	    if ((f.metros.value=="") && (f.local[0].checked)){
		                    	        	    alert(mensaje_21);
		                        	        	f.metros.focus();
		                            		}else{
		                            			doBoton('Cargando...');
		                            			f.submit();
		                            			
		                            		}
		                            	}
		                            }
		                        }
		                	}
            			}
                    }
                }
            }
        }
    }
    

    function add_poblaciones(idprovincia){
        var f=document.frm_mapa;
        var provincia="";
        
        if (typeof window["provincia_"+idprovincia]=="object"){
        	provincia=eval("provincia_"+idprovincia);
        	objeto="<select name='poblaciones' size='8' class='txtgen10' onchange='javascript:add_tiendas();' style='width: 200px;'>";
	        for (i=0;i<provincia.length;i++){
	            objeto+="<option value='"+provincia[i][0]+"'>"+provincia[i][1]+"</option>";
	        }
	        objeto+="</select><br><br>";
	
	        if (document.all){
	            poblaciones.innerHTML = objeto;
	            tiendas.innerHTML = "";
	        }else if (document.getElementById){
	            document.getElementById("poblaciones").innerHTML = objeto;
	            document.getElementById("tiendas").innerHTML = "";
	        }
	        window.scrollTo(0,500);
	        f.idtienda.value="";
	        f.poblaciones.focus();
        }else{
        	switch (idioma){
    			case "es":
    				mensaje="En estos momentos no disponemos de tiendas en esta provincia";
    				break;
    			case "pt":
    				mensaje="Neste momento não dispomos de lojas nessa provincia";
    				break;
    			case "fr":
    				mensaje="Actuellement nous n’avons pas de magasins dans";
    				break;
    		}
    		alert(mensaje);
        }
    }
    	    
    function add_tiendas(){
        var f=document.frm_mapa;
        var poblacion=eval("poblacion_"+f.poblaciones.value);

        objeto="<select name='tiendas' size='8' class='txtgen10' onchange='javascript:document.frm_mapa.idtienda.value=document.frm_mapa.tiendas.value;'>";
        for (i=0;i<poblacion.length;i++){
            objeto+="<option value='"+poblacion[i][0]+"'>"+poblacion[i][1]+"</option>";
        }
        objeto+="</select><br><br>";

        if (document.all){
            tiendas.innerHTML = objeto;
        }else if (document.getElementById){
            document.getElementById("tiendas").innerHTML = objeto;
        }
        f.idtienda.value="";
    }

    function validar_tienda(idioma){
        var f=document.frm_mapa;
        if (f.idtienda.value==""){
            switch (idioma){
                case "es":
                    alert("Tiene que seleccionar una tienda");
                    break;
                case "fr":
                    alert("Vous devez sélectionner un magasin");
                    break;
            }
        }else{
            switch (idioma){
            	case "es":
                    doBoton('Cargando...');
                    break;
                case "fr":
                    doBoton('Téléchargement...');
                    break;
            }
            f.submit();
        }
    }

    function validar_devolucion(idioma){
    	var f=document.devolucion;
    	
    	 switch (idioma){
            case "es":
                mensaje_01="Tiene que escibir el motivo por el solicita la devoluci&oacute;n";
                break;
        }
        
 		if (f.e_mail.value==""){
        	alert(mensaje_02);
         	f.e_mail.focus();
     	}else{
        	if (emailCheck (f.e_mail.value,idioma)==false){
         		f.e_mail.focus();
        	}else{
        		if (f.comentarios.value.length==0){
        			alert(mensaje_01);
        			f.comentarios.focus();
        		}else{
        			f.submit();
        		}
        	}
     	}
    }
    
    
    function validar_curriculum(idioma){
    	var f=document.curriculum;
    	
    	if (f.nombre.value==""){
    		alert(mensaje_05);
    		f.nombre.focus();
    	}else{
    		if (f.apellido1.value==""){
    			alert(mensaje_06);
    			f.apellido1.focus();
    		}else{
    			if (f.apellido2.value==""){
    				alert(mensaje_22);
    				f.apellido2.focus();
    			}else{
    				if (f.telefono1.value==""){
    					alert(mensaje_25);
    					f.telefono1.focus();
    				}else{
    					if (f.mail.value==""){
    						alert(mensaje_02);
    						f.mail.focus();
    					}else{
    						if (emailCheck (f.mail.value,idioma)==false){
                            	f.mail.focus();
                        	}else{
		    					if (f.nacionalidad.value==""){
    								alert(mensaje_29);
    								f.nacionalidad.focus();
    							}else{
									if (f.pais.value==""){
										alert(mensaje_26);
										f.pais.focus();
									}else{
										if (f.cp.value==""){
											alert(mensaje_12);
											f.cp.focus();
										}else{
											if (f.provincia.value==""){
												alert(mensaje_11);
												f.provincia.focus();
											}else{
												if (f.poblacion.value==""){
													alert(mensaje_10);
													f.poblacion.focus();
												}else{
													if (f.direccion.value==""){
														alert(mensaje_07);
														f.direccion.focus();
													}else{
														if (f.puesto_0.checked==false && f.puesto_1.checked==false && f.puesto_2.checked==false && f.puesto_3.checked==false && f.puesto_4.checked==false && f.puesto_5.checked==false){
															alert(mensaje_27);
															f.puesto_0.focus();
														}else{
															doBoton('Enviando...');
															f.submit();
														}
													}
												}
											}
										}
									}
								}
							}
    					}
    				}
    			}
    		}
    	}
    }
    
    function validar_curriculum_act(idioma){
    	var f=document.curriculum;
    	
    	if (f.nombre.value==""){
    		alert(mensaje_05);
    		f.nombre.focus();
    	}else{
    		if (f.apellido1.value==""){
    			alert(mensaje_06);
    			f.apellido1.focus();
    		}else{
    			if (f.apellido2.value==""){
    				alert(mensaje_22);
    				f.apellido2.focus();
    			}else{
    				if (f.telefono1.value==""){
    					alert(mensaje_25);
    					f.telefono1.focus();
    				}else{
    					if (f.mail.value==""){
    						alert(mensaje_02);
    						f.mail.focus();
    					}else{
    						if (emailCheck (f.mail.value,idioma)==false){
                            	f.mail.focus();
                        	}else{
		    					if (f.nacionalidad.value==""){
    								alert(mensaje_29);
    								f.nacionalidad.focus();
    							}else{
									if (f.pais.value==""){
										alert(mensaje_26);
										f.pais.focus();
									}else{
										if (f.cp.value==""){
											alert(mensaje_12);
											f.cp.focus();
										}else{
											if (f.provincia.value==""){
												alert(mensaje_11);
												f.provincia.focus();
											}else{
												if (f.poblacion.value==""){
													alert(mensaje_10);
													f.poblacion.focus();
												}else{
													if (f.direccion.value==""){
														alert(mensaje_07);
														f.direccion.focus();
													}else{
														doBoton('Enviando...');
														f.submit();
													}
												}
											}
										}
									}
								}
							}
    					}
    				}
    			}
    		}
    	}
    }
    
    function previsualizar_avatar(action,w,h){
    	var ranNum= Math.round(Math.random()*1000);
    	var f=document.perfil;
    	
    	preferencias="toolbar=no,menubar=yes,width="+w+",height="+h+",resizable=no";
    	window.open("","previsualizar_avatar_"+ranNum,preferencias).blur();
    	
    	window.focus();
    	f.action=action
    	f.target="previsualizar_avatar_"+ranNum;
    	f.submit();
    }
    
    
    function pasa_clau(formulari,valor) {
		formulari.clau.value=valor;
		formulari.submit();
	}
	
	
	function encuesta(accion,w,h,k,idioma){
    	var ranNum= Math.round(Math.random()*1000);
    	var f=document.frm_encuesta;
    	for (var i=0; i<f.idrespuesta.length; i++) {
        	if (f.idrespuesta[i].checked) {
           		k++; 
         	}
      	}
		if (k==0){
			alert(mensaje_28);
		}else{
    		f.accion.value=accion;
    		preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    		window.open("","encuesta_"+ranNum,preferencias);
    	
    		f.target="encuesta_"+ranNum;
    		f.submit();
		}
	}
	
	
	function visualizar(imagen,base,marca,modelo){
   	var screenH = screen.height;
	var screenW = screen.width;
		
		screenH=(screenH*15)/100;
		screenW=(screenW*25)/100;
		titulo=marca + ' ' + modelo;
   		//ventana=window.open(imagen,'MyWnd','toolbar=no,menubar=no,resizable=yes, scrollbars=yes, titlebar=yes, width=550,height=565');
   		ventana=window.open(base + '/ftpx_popup.php?imagen='+base+imagen+'&titulo='+titulo,'','toolbar=no,menubar=no,resizable=yes, scrollbars=yes, titlebar=yes, width=550,height=565');
   		ventana.moveTo(screenW,screenH)

   }
   
   
   function visualizar_prv(pagina){
		var screenH = screen.height;
		var screenW = screen.width;
		
		screenH=(screenH*15)/100;
		screenW=(screenW*25)/100;	
   		ventana=window.open(pagina,'','toolbar=no,menubar=no,resizable=yes, scrollbars=yes, titlebar=yes, width=400,height=480');
  		ventana.moveTo(screenW,screenH)
   }
   
   
   function seleccion(formulari,provincia,idioma){
   		provincias=getMultiSelected(provincia,idioma);
		if (provincias==''){
			alert(mensaje_32);
		}else{
			pasa_clau(formulari,provincias);
		}
   }
   function getMultiSelected(seleccio,idioma) {
      var sel = new Array();
      var resul='';
      var pasa=false;
      	for (var i=0; i < seleccio.length; i++) {
        	if (seleccio[i].selected) {
				resul= resul + seleccio[i].value;
            	resul= resul + ',';
            	pasa=true;
         	}
      	}
      	if (pasa==true){
      		return resul;
	 	}else{
	  	    return "";
			
		}
   }
   function link_analisis(cami){
   		//alert(document.flista.options[document.flista.selectedIndex].value);
		alert(this.flista.options[flista.selectedIndex]);
   }
   
   function popup_revelado_online(){
   		var w=642;
   		var h=482;
   		preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    	window.open(domini_ROL+"/index.php?resource=FTPX050400","revelado_online",preferencias);
	
   }
   
   function carga_pob(prov1,prov2,idioma){
   		objeto=mensaje_31;
       	if (document.all){
            document.all("buscando").innerHTML = objeto;
        }else if (document.getElementById){
            document.getElementById("buscando").innerHTML = objeto;
        }
       	seleccion(prov1,prov2,idioma);
   }
   function Trim(s){
  		while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r')){
    		s = s.substring(1,s.length);
  		}
		while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r')){
	    	s = s.substring(0,s.length-1);
  		}
  		return s;
	}
	
	function busquedas(selectObj,opcions,imarca){
		var numShown;
		numShown=0;
		selectObj.length=0;
		
		selectObj[numShown] = new Option("Seleccione modelo","");
        numShown++;
		for(var i=0; i < opcions.length; i++){
        	if(imarca==opcions[i][0]){
        		selectObj[numShown] = new Option(opcions[i][1],opcions[i][2]);
            	numShown++;
        	}
    	}
	}
	function fer_link(cad1,selectObj){
		cad2=selectObj.options[selectObj.selectedIndex].value;
		location.href=cad1+cad2;
      	
	}
	
	function enviar_pasarela(){
		var objeto = "Procesando datos...";
		if (document.all){
        	document.all("pasarela").innerHTML = objeto;
    	}else if (document.getElementById){
        	document.getElementById("pasarela").innerHTML = objeto;
    	}
    	document.pasarela.submit();
	}
	
	function popBreves(link){
		top.location.href=link;
	}
	
	function votacion(w,h,k,idioma,idfoto){
    		var ranNum= Math.round(Math.random()*1000);
    		var f=eval("document.frm_votacion_"+idfoto);
    		
    		preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    		window.open("","votacion_"+ranNum,preferencias);
    	    	f.target="votacion_"+ranNum;
		f.submit();
	}
	
	function pujar_foto(w,h){
    	var ranNum= Math.round(Math.random()*1000);
    	var f=document.frm_concurso;
    		
    	preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    	window.open("","concurso_fotoprix_"+ranNum,preferencias);
    	   f.target="concurso_fotoprix_"+ranNum;
		f.submit();
	}
	
	function validar_frm_concurso(){
		var f=document.frm_concurso;
		
		if (f.titul.value==""){
			alert(mensaje_36);
			f.titul.focus();
		}else{
			if (f.camara.value==""){
				alert(mensaje_37);
				f.camara.focus();
			}else{
				pujar_foto(350,150);
			}
		}
	}
	
	function alerta_dades_erroneas(w,h,base){
    		var ranNum= Math.round(Math.random()*1000);
    		
    		preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no,scrollbars=0";
    		window.open(base+"/index.php?resource=FTPX010055","dades_perfil_"+ranNum,preferencias);
	}
	
	function alerta_adreca_erroneas(w,h,base){
    		var ranNum= Math.round(Math.random()*1000);
    		
    		preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no,scrollbars=0";
    		window.open(base+"/index.php?resource=FTPX010056","dades_adreca_"+ranNum,preferencias);
	}
/*	
	function carregar_articles(){
		var f=document.TOL_comparativa;
		var matriu=eval("marca_"+f.idmarca.value);
		var imatge="";
		var objecte="<select name='idarticulo_comparativa' class='txtgen10' onchange='javascript:document.TOL_comparativa.submit();'>";
			objecte+="<option value=''>Seleccione modelo</option>";
		
		if (matriu.length>0){
			imatge="<img src='/img/comparativa.jpg' border='0'>";
			for (i=0;i<matriu.length;i++){
				selected=(matriu[i][0]==idarticulo_comparativa) ? "selected" : "";
				if (matriu[i][0]==idarticulo_comparativa) imatge="<img src='/img/TOL/"+matriu[i][0]+"/"+matriu[i][2]+"' border='0'>";
				objecte+="<option value='"+matriu[i][0]+"' "+selected+">"+matriu[i][1]+"</option>";
			}
			objecte+="</select>";
		}else{
			objecte="";
			imatge="<img src='/img/comparativa.jpg' border='0'>";
		}
		
		if (document.all){
        	document.all("model").innerHTML = objecte;
        	document.all("imatge").innerHTML = imatge;
    	}else if (document.getElementById){
        	document.getElementById("model").innerHTML = objecte;
        	document.getElementById("imatge").innerHTML = imatge;
    	}
	}
*/
	function carregar_articles(){
		var f=document.TOL_comparativa;
		var matriu=eval("marca_"+f.idmarca.value);
		var imatge="";
		var objecte="<select name='idarticulo_comparativa' class='txtgen10' onchange='javascript:document.TOL_comparativa.submit();'>";
			objecte+="<option value=''>Seleccione modelo</option>";
		
		if (matriu.length>0){
			imatge="<img src='/img/comparativa.jpg' border='0'>";
			for (i=0;i<matriu.length;i++){
				selected=(matriu[i][0]==idarticulo_comparativa) ? "selected" : "";
				if (matriu[i][0]==idarticulo_comparativa) imatge="<img src='/img/TOL/"+matriu[i][2]+"' border='0'>";
				objecte+="<option value='"+matriu[i][0]+"' "+selected+">"+matriu[i][1]+"</option>";
			}
			objecte+="</select>";
		}else{
			objecte="";
			imatge="<img src='/img/comparativa.jpg' border='0'>";
		}
		
		if (document.all){
        	document.all("model").innerHTML = objecte;
        	document.all("imatge").innerHTML = imatge;
    	}else if (document.getElementById){
        	document.getElementById("model").innerHTML = objecte;
        	document.getElementById("imatge").innerHTML = imatge;
    	}
	}
	
	function carregar_inputs_registre(base_https,formulario,w){
		var f=eval("document."+formulario);
		var idpais		=f.idpais.value;
		var	provincia	=f.tmp_provincia.value;
		var	poblacion	=f.tmp_poblacion.value;
		var	codpostal	=f.tmp_codpostal.value;
		var inputs		="";
		
		var inputs_ES="<tr>";
			inputs_ES+="<td class='texto4'><font color='#FF0000'>*</font></td>";
			inputs_ES+="<td colspan='2' align='left' class='textoplanonojustnegr'><a href=\"javascript:visualizar_prv('"+base_https+"/index.php?resource=FTPX010100');\" class='link5'><u>Seleccione aqu&iacute; su provincia, poblaci&oacute;n y c&oacute;digo postal</u></a><input type='text' size='1' name='prv_pob_cp' readonly style='background-color: transparent;border: 0; width: 1px'></td></tr>";
			inputs_ES+="<tr><td colspan='3'><img src='/img/null.gif' height='5'</td></tr>";
			inputs_ES+="<tr>";
            inputs_ES+="<td class='texto4'><font color='#FF0000'>*</font></td>";
			inputs_ES+="<td class='texto1'>Provincia</td>";
            inputs_ES+="<td><input name='provincia' type='text' class='texto2' size='40' maxlength='100' value='"+provincia+"' readonly style='background-color: transparent;'></td>";
            inputs_ES+="</tr>";
            inputs_ES+="<tr><td colspan='3'><img src='/img/null.gif' height='5'</td></tr>";
			inputs_ES+="<tr>";
			inputs_ES+="<td class='texto4'><font color='#FF0000'>*</font></td>";
    	    inputs_ES+="<td class='texto1'>Poblaci&oacute;n</td>";
        	inputs_ES+="<td><input name='poblacion' type='text' class='texto2' maxlength='100' size='40' value='"+poblacion+"' readonly style='background-color: transparent;'></td>";
        	inputs_ES+="</tr>";
        	inputs_ES+="<tr><td colspan='3'><img src='/img/null.gif' height='5'</td></tr>";
			inputs_ES+="<tr>";
            inputs_ES+="<td class='texto4' width='15'><font color='#FF0000'>*</font></td>";
			inputs_ES+="<td class='texto1' width='"+w+"'>C&oacute;digo Postal</td>";
    	    inputs_ES+="<td width='310'><input name='codpostal' type='text' class='texto2' size='7' maxlength='5' value='"+codpostal+"' readonly style='background-color: transparent;'></td>";
        	inputs_ES+="</tr>";
		
		var inputs_altres="<tr>";
			inputs_altres+="<td class='texto4'><font color='#FF0000'>*</font></td>";
			inputs_altres+="<td class='texto1'>Provincia</td>";
            inputs_altres+="<td><input name='provincia' type='text' class='texto2' size='40' maxlength='100' value='"+provincia+"'></td>";
            inputs_altres+="</tr>";
            inputs_altres+="<tr><td colspan='3'><img src='/img/null.gif' height='5'</td></tr>";
			inputs_altres+="<tr>";
			inputs_altres+="<td class='texto4'><font color='#FF0000'>*</font></td>";
    	    inputs_altres+="<td class='texto1'>Poblaci&oacute;n</td>";
        	inputs_altres+="<td><input name='poblacion' type='text' class='texto2' maxlength='100' size='40' value='"+poblacion+"'></td>";
       		inputs_altres+="</tr>";
       		inputs_altres+="<tr><td colspan='3'><img src='/img/null.gif' height='5'</td></tr>";
			inputs_altres+="<tr>";
            inputs_altres+="<td class='texto4' width='15'><font color='#FF0000'>*</font></td>";
			inputs_altres+="<td class='texto1' width='"+w+"'>C&oacute;digo Postal</td>";
    	    inputs_altres+="<td width='310'><input name='codpostal' type='text' class='texto2' size='7' maxlength='5' value='"+codpostal+"'></td></tr>";
		
		if (idpais=="ES"){
			inputs="<table border='0' cellpadding='0' cellspacing='0'>"+inputs_ES+"</table>";
		}else{
			inputs="<table border='0' cellpadding='0' cellspacing='0'>"+inputs_altres+"</table>";
		}
		
		if (document.all){
        	document.all("poblacions_provincies").innerHTML = inputs;
    	}else if (document.getElementById){
        	document.getElementById("poblacions_provincies").innerHTML = inputs;
    	}
	}
	
	function modificar_cistella(idlinia){
		var f1=eval("document.frm_"+idlinia);
		var f2=document.frm_update;
		
		f2.idlinea.value	=idlinia;
		f2.cantidad.value	=f1.cantidad.value;
		
		f2.submit();
	}
	
	
	// Comprueba la entrada de datos
	function CompruebaDatos(elCIF) {
	  	var resul = false;
	    var temp = elCIF.value.toUpperCase(); // pasar a mayúsculas
	
	    if (!/^[A-Za-z0-9]{9}$/.test(temp)) // Son 9 dígitos?
	    	resul = false;
			//alert ("Longitud incorrecta, un CIF consta de 9 dígitos");
		else if (!/^[ABCDEFGHKLMNPQRS]/.test(temp)) // Es una letra de las admitidas ?
			resul = false;
	    	//alert("El primer dígito es incorrecto, debe ser una letra de las siguientes: A,B,C,D,E,F,G,H,K,L,M,N,P,Q,S ");
	    else
	      	resul = true;
	
	    	return resul;
	  }


  // La función recibe el CIF completo: A58818501
  function ValidaCIF(CIF){

    var v1 		= new Array(0,2,4,6,8,1,3,5,7,9);
    var v2		= new Array ('J','A','B','C','D','E','F','G','H','I');
    var temp 	= 0;
    var resul	=false;


    for( i = 2; i <= 6; i += 2 ){
      temp = temp + v1[ parseInt(CIF.substr(i-1,1)) ];
      temp = temp + parseInt(CIF.substr(i,1));
    }

    temp = temp + v1[ parseInt(CIF.substr(7,1)) ];

    temp = (10 - ( temp % 10));

	if ((( temp == 10 ) && (CIF.substr(8,1).toUpperCase()=="J") || (CIF.substr(8,1).toUpperCase()=="0")) || ((temp!=10) && ((CIF.substr(8,1).toUpperCase()==temp) || (CIF.substr(8,1).toUpperCase()==v2[temp]))) ){
      //alert( "El dígito de control es: J ó 0" );
      resul=true;
    }else{
      //alert( "El dígito de control es: "+temp );
      //alert("El CIF es incorrecto, verifiquelo");
      resul=false;
    }
    
    return resul;
  }

  	function calcularNIF(dni,letra) {
  		var resultat=true;
		if (!/^\d{8}$/.test(dni)) {
  			//alert ("El numero introducido no es valido");
  			resultat=false;
		}

		var letras = 'TRWAGMYFPDXBNJZSQVHLCKE';

		var numero = dni%23;
		if (letra!=letras.substring(numero,numero+1)) resultat=false;
		
		return resultat;
	}
	
	function validar_NIF_INTL(tipus,num_chars,NIF){
  		var v0="0123456789";
  		var v1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  		var parsed=true;
  		var cadena=NIF;
  		var validchars;
  		
  		if (tipus=="0"){		// numeric
  			validchars=v0;
  		}else{					// alfanumeric
  			validchars=v0+v1;
  		}
  		
  		for (var i=0; i < cadena.length; i++) {
        	var letter = cadena.charAt(i);

        	if (validchars.indexOf(letter) != -1) continue;
            	parsed = false;
            	break;
       	}
  		
       	if (cadena.length!=num_chars) parsed=false;
       	
  		return parsed;
  	}
  	  	
  
  	/*** 
  		Per validar el formulari de facturacio de la pasarela 
  	***/
	function validarFacturacio(){
		var f=document.pasarela;
		
		if (f.factura.value=="1"){
			if (f.razonsocial.value==""){
				alert(mensaje_34);
				f.razonsocial.focus();
			}else{
				if (f.direccion.value==""){
					alert(mensaje_07);
					f.direccion.focus();
				}else{
					if (f.poblacion.value==""){
						alert(mensaje_10);
						f.poblacion.focus();
					}else{
						if (f.provincia.value==""){
							alert(mensaje_11);
							f.provincia.focus();
						}else{
							if (f.codpostal.value==""){
								alert(mensaje_12);
								f.codpostal.focus();
							}else{
								if (f.CIF.value==""){
									alert(mensaje_09);
									f.CIF.focus();
								}else{
									switch (f.idpais_ue.value){
										case "DE":		// Alemanya
											if (!validar_NIF_INTL(0,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "AT":		// Austria
											if (!validar_NIF_INTL(1,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "BE":		// Bèlgica
											if (!validar_NIF_INTL(0,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "CY":		// Chipre
											if (!validar_NIF_INTL(1,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "DK":		// Dinamarca
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "SI":		// Eslovenia
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "EE":		// Estonia
											if (!validar_NIF_INTL(0,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "FI":		// Finlandia
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "FR":		// Francia
											/*if (!validar_NIF_INTL(1,11,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}JGX(20/02/2008)
											Se quita el control para Francia
											Solo con que exista información vale*/
											amagarBoto();
											f.submit();
											break;
										case "EL":		// Grecia
											if (!validar_NIF_INTL(0,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "GB":		// Gran Bretanya
											if ((!validar_NIF_INTL(1,5,f.CIF.value)) && (!validar_NIF_INTL(1,9,f.CIF.value)) && (!validar_NIF_INTL(1,12,f.CIF.value))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "NL":		// Holanda
											if (!validar_NIF_INTL(1,12,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "ES":
											if (((!CompruebaDatos(f.CIF)) || (!ValidaCIF(f.CIF.value))) && (!calcularNIF(f.CIF.value.substr(0,8),f.CIF.value.substr(8,1).toUpperCase())) && (!calcularNIF("0"+f.CIF.value.substr(1,7),f.CIF.value.substr(8,1).toUpperCase()))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "HU":		// Hungria
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "IT":		// Italia
											if (!validar_NIF_INTL(0,11,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "IE":		// Irlanda
											if (!validar_NIF_INTL(1,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "LV":		// Letonia
											if (!validar_NIF_INTL(0,11,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "LT":		// Lituania
											if ((!validar_NIF_INTL(0,9,f.CIF.value)) && (!validar_NIF_INTL(0,12,f.CIF.value))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "LU":		// Luxemburgo
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "MT":		// Malta
											if (!validar_NIF_INTL(0,8,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "PL":		// Polonia
											if (!validar_NIF_INTL(0,10,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "PT":		// Portugal
											if (!validar_NIF_INTL(0,9,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "CZ":		// Republica Checa
											if ((!validar_NIF_INTL(0,8,f.CIF.value)) && (!validar_NIF_INTL(0,9,f.CIF.value)) && (!validar_NIF_INTL(0,10,f.CIF.value))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "SK":		// Republica Slovaca
											if ((!validar_NIF_INTL(0,9,f.CIF.value)) && (!validar_NIF_INTL(0,10,f.CIF.value))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "SE":		// Suecia
											if (!validar_NIF_INTL(0,12,f.CIF.value)){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
										case "AD":		// Andorra
											if ((!validar_NIF_INTL(0,4,f.CIF.value)) && (!validar_NIF_INTL(0,5,f.CIF.value)) && (!validar_NIF_INTL(1,7,f.CIF.value))){
												alert ("CIF/NIF no válido");
												f.CIF.focus();
											}else{
												amagarBoto();
												f.submit();
											}
											break;
									}
								}
							}
						}
					}
				}
			}
		}else{
			amagarBoto();
			f.submit();
		}
	}
	
	function ImprimirComanda(f){
   		var ranNum= Math.round(Math.random()*1000);
    		
    	preferencias="toolbar=no,menubar=no,width=580,height=600,resizable=yes";
    	window.open("","ImprimirComanda_"+ranNum,preferencias);
    	f.target="ImprimirComanda_"+ranNum;
		f.submit();
	}
	
	function garantia(url,w,h){
    	preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    	window.open(url,"garantia",preferencias);
	}

	function enviar_amigo(url,w,h){
    	preferencias="toolbar=no,menubar=no,width="+w+",height="+h+",resizable=no";
    	window.open(url,"enviar_amigo",preferencias);
	}
	function calidad_password(pwd){
		var ieDOM = false, nsDOM = false;
		var stdDOM = document.getElementById; 	
		var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
		var mediumRegex = new RegExp("^(?=.{6,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
		var enoughRegex = new RegExp("(?=.{5,}).*", "g");

		if( false == enoughRegex.test(pwd) ){
			alert(mensaje_39);
			return false;
		}else if( strongRegex.test(pwd) ){
			return true;
			}else if( mediumRegex.test( pwd ) ){
				return true;
			}else{
				alert(mensaje_40);
				return false;
			}
	}
	
	function entrar(src,color_entrada) {
	src.bgColor=color_entrada;
	}

	function sortir(src,color_default) {
	src.bgColor=color_default;
	}
	
	function largo_cp(idpais){
		var long_cp=0;
		switch (idpais){
			case "ES":
			case "FR":
			case "DE":
				long_cp=5
				break;
			case "PT":
				long_cp=8
				break;
			case "AD":
				long_cp=3
				break;
			case "BE":
			case "NL":
			case "SI":
			case "LU":
				long_cp=4
				break;
		}
		return long_cp;
	}
	
		function XHConn(){
		var xmlhttp, bComplete = false;
	  	try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	  	catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	  	catch (e) { try { xmlhttp = new XMLHttpRequest(); }
	  	catch (e) { xmlhttp = false; }}}
	  	if (!xmlhttp) return null;
	  	this.connect = function(sURL, sMethod, sVars, fnDone){
	    	if (!xmlhttp) return false;
	    	bComplete = false;
	    	sMethod = sMethod.toUpperCase();
			try {
	      		if (sMethod == "GET"){
	        		xmlhttp.open(sMethod, sURL+"?"+sVars, true);
	        		sVars = "";
	      		}else{
	        		xmlhttp.open(sMethod, sURL, true);
	        		xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
	        		xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	      		}
	      		xmlhttp.onreadystatechange = function(){
	        		if (xmlhttp.readyState == 4 && !bComplete){
	          			bComplete = true;
	          			fnDone(xmlhttp);
	        		}
	      		};
	      		xmlhttp.send(sVars);
	    	}
	    	catch(z) { return false; }
	    	return true;
	  	};
	  	return this;
	}


	function obtenirProvincies(idpais,objecte,provincia){
		var myConn = new XHConn();
	    if (!myConn) return '';
	
	  	var objecte	=eval(objecte);
	  	var selected=false;
	  	
	  	objecte.length = 0;
	  	    
	  	var peticion = function (oXML) {  
	    	elements 	= oXML.responseXML.getElementsByTagName("root")[0];
			element 	= elements.getElementsByTagName("provincia");
			objecte.options[0] = new Option(strProvinciesTitul,'0');
			
			for (i = 0; i < element.length; i++) {
				try {
					id_elemento = element[i].getElementsByTagName("id")[0].firstChild.nodeValue;
				}
				catch (e) {
					id_elemento = 'None';
				}
	
				try {
					nombre_elemento = element[i].getElementsByTagName("nom")[0].firstChild.nodeValue;
				}
				catch (e) {
					nombre_elemento = 'None';
				}
				
				if (id_elemento != 'None' && nombre_elemento != 'None'){
					selected		=(nombre_elemento==provincia) ? true : false;
					defaultSelected	=(nombre_elemento==provincia) ? true : false;
					objecte.options[i+1] = new Option(nombre_elemento,id_elemento,defaultSelected,selected);
				}
			}
		};
	
		myConn.connect("index.php", "GET", "resource=MBSRV900000&idpais="+idpais, peticion);
	}	   