// JavaScript Document

function boletin(){
	

	if(document.getElementById('boletin').style.display == 'none') document.getElementById('boletin').style.display = 'block';
	else document.getElementById('boletin').style.display = 'none';
}

/*********************************************************************************************************************************/

function c_fondo(){
	
	if(document.getElementById('menu_2_c')) document.getElementById('menu_2_c').id='menu_2_c_active';
	else	document.getElementById('menu_2_c_active').id='menu_2_c';
}

/*********************************************************************************************************************************/

tID = 0;
i = 0;
spd  = 50; 

function typeLayer(str) {
	
	if(i > str.length){
  		clearTimeout(tID);
		document.getElementById('mas').style.display = 'block';		
 	} else {
  		msg = str.substring(0,i);
  		document.getElementById('news').innerHTML = msg;
  		i++;
  		tID = setTimeout('typeLayer("'+str+'")',spd);
 	}
}

/*********************************************************************************************************************************/

function campos(){
	
	
	var error;
	var texto_legal = "En cumplimiento de la Ley Orgánica 15/1999 sobre Protección de Datos de Carácter Personal, les informamos que los datos facilitados a través de este sitio Web quedarán recogidos en un fichero cuyo responsable es CENTRO DE ALIANZAS PARA EL DESARROLLO, SL, inscrita en el Registro Mercantil de Barcelona con el Nº hoja _____, Nº de folio _____, tomo _____, libro _____, de la sección _____ – CIF: B17666439 con domicilio en Barcelona, C/ Muntaner 180 pral 2ª, 08034 Barcelona, con la finalidad de dar respuesta a las dudas que pueda plantearnos o facilitarle información que nos fuera concretamente solicitada." + '\n' + '\n' +"Sus datos serán tratados con absoluta confidencialidad y en ningún caso serán cedidos a terceros sin su previo consentimiento. Usted puede ejercitar los derechos de oposición, acceso, rectificación y cancelación de sus datos personales, dirigiéndose personalmente a las oficinas de la empresa ubicadas en la dirección antes indicada, manifestando claramente el objeto de su petición y acreditando debidamente su identificación (fotocopia DNI).";
	

	if(document.getElementById('nombre').value==' Nombre') error = 1;
	if(document.getElementById('email').value==' E-mail') error = 1;	
	
	if(error == 1) alert('$alert_1');
	else{
		ventana = confirm("'$alert_3'\n\n"+texto_legal);	
		if(ventana) document.inscripcion.submit();
		else{
			alert('$alert_2');	
		}
	}
}

/*********************************************************************************************************************************/

function comprovar_campos(msg, msg_1){

	var error1;
	var error2;
	
	if(document.getElementById('nombre').value=='') error1 = 1;
	if(document.getElementById('email').value=='') error1 = 1;
	if(document.getElementById('apellido').value=='') error1 = 1;
	if(document.getElementById('acepto').checked=='') error2 = 1;	
	
	if(error1 == 1 || error2 == 1){
		if(error1 == 1) alert(msg);
		if(error2 == 1) alert(msg_1);	
	}
	else{
		document.contacto.submit();	
	}
	
}