function Validacio() {
	cerrarModal_4_f();
	mail = document.getElementById("newsletter_f").value;
		
		if (mail!=""){
			//console.log(mail);
			mail_valid = isValidEmail(mail);
			
			if(mail_valid){
				//alert("mail OK !!");
				$.ajax({
					type: "POST",
					url: "frontoffice/secciones/subscripcion/subscripcio.php",
					data: "ajax=1&mail="+mail,
	 
					
					
					success: function(msg){
					
						//alert (msg);
						
						if(msg == "ok"){//mail correcte
							$('#trama').show();
							$('#mail_ok').fadeIn('slow');			
						}
						else{//mail ja existen ko_2
							$('#trama').show();
							$('#mail_ko').fadeIn('slow');
						}
					}
		 			});
					
			}else{//mail incorrecte
				$('#trama').show();
				$('#mail_ko').fadeIn('slow');
			}
 
		}else{//mail incorrecte
			$('#trama').show();
			$('#mail_ko').fadeIn('slow');
		}
			
 
			
	}
function acepto_cond(){
	return true;
}
	
function Envia_Sugerencia() {
	
	mail = document.getElementById("email").value;
	nombre = document.getElementById("nombre").value;		
	comentario = document.getElementById("comentario").value;
	
		if (mail!=""){
			//alert("ok");
			mail_valid = isValidEmail(mail);
			
			if(mail_valid){
				//alert("ok2");
				$.ajax({
					type: "POST",
					url: "frontoffice/secciones/contacto/enviar_form.php",
					data: "ajax=1&mail="+mail+"&nombre="+nombre+"&comentario="+comentario,	
					
					
					
					success: function(msg){
					
						//alert (msg);
						
						if(msg == "ok"){//mail correcte
							abrirModal_5();		
						}
						else{//mail ja existen ko_2
							abrirModal_6();	
							}
						}
		 			});
				
			}else{//mail incorrecte
				abrirModal_6();
			}
 
		}else{//mail incorrecte
			abrirModal_6();
		}
			
}	
	
		
function isValidEmail(str) {
	return (str.indexOf(".") >= 1) && (str.indexOf("@") > 0);
	}
		
function cerrarModal_1(){
	$('#trama').fadeOut('slow');
	$('#mail_ok').fadeOut('fast');
	}
	
function cerrarModal_2(){
	$('#trama').fadeOut('slow');
	$('#mail_ko').fadeOut('fast');
	}
	
function abrirModal_3(){
	$('#trama').show();
	$('#registro_texto').fadeIn('fast');
	}
//Funcion igual que abrirModal_3 pero para el footer
function abrirModal_3_f(){
	$('#trama').show();
	$('#registro_texto_footer').fadeIn('fast');
	}
function cerrarModal_4_f(){
	$('#trama').fadeOut('slow');
	$('#registro_texto_footer').fadeOut('fast');
	}
	
function cerrarModal_4(){
	$('#trama').fadeOut('slow');
	$('#registro_texto').fadeOut('fast');
	}
	
/*------modals nous---------*/	
function abrirModal_5(){
	$('#trama').show();
	$('#contacto_ok').fadeIn('fast');
	}
function cerrarModal_5(){
	$('#trama').fadeOut('slow');
	$('#contacto_ok').fadeOut('fast');
	}

function abrirModal_6(){
	$('#trama').show();
	$('#contacto_ko').fadeIn('fast');
	}
function cerrarModal_6(){
	$('#trama').fadeOut('slow');
	$('#contacto_ko').fadeOut('fast');
	}
