function cargaAudiencias(cadena){
		var dd = document.formulario.select2.options[document.formulario.select2.options.selectedIndex].value;
		if(dd.length == 1) dd = "0" + dd;
		var mm = document.formulario.select3.options[document.formulario.select3.options.selectedIndex].value;
		if(mm.length == 1) mm = "0" + mm;
		var aaaa = document.formulario.select4.options[document.formulario.select4.options.selectedIndex].value;

		//document.location.href = "audiencias.php?c="+cad+"&fecha_aud=" + dd + "/" + mm + "/" + aaaa;
		document.location.href = "/audiencias.php/cadena/aaaa-mm-dd";
	
}


function control_peliculas_r() {
	if (document.formulario.titulo.value == "" && document.formulario.titulo_original.value == "" && document.formulario.director.value == "" && document.formulario.actores.value == "" && document.formulario.tipo.value == "0" && document.formulario.anno.value == "" ) {
		alert("Por favor, rellene algún campo del buscador")
		}
	else {
		var titulo_enviar = escape(window.document.formulario.titulo.value);
		document.formulario.action="/buscador/peliculas/?termino=" + titulo_enviar;
		document.formulario.submit()
		}
	}

function control_series_r() {
	if (document.formulario.titulo.value == "" && document.formulario.actores.value == "" ) {
		alert("Por favor, rellene algún campo del buscador")
		}
	else {
		var titulo_enviar = escape(window.document.formulario.titulo.value);
		document.formulario.action="/buscador/series/?termino=" + titulo_enviar;
		document.formulario.submit()
		}
	}

function control_programas_r() {
	if (document.formulario.titulo.value == "" && document.formulario.presentador.value == "" ) {
		alert("Por favor, rellene algún campo del buscador")
		}
	else {
		var titulo_enviar = escape(window.document.formulario.titulo.value);
		document.formulario.action="/buscador/programas/?termino=" + titulo_enviar;
		document.formulario.submit()
		}
	}

function buscar_r() {
	
	if (document.buscador.titulo.value == "") {
		window.alert("Por favor, introduce un termino de búsqueda.");
		return false;	
	}
	if (document.buscador.select.value == 0) {
		window.alert("Por favor, selecciona un area.");
		return false;	
	}
	
	if (document.buscador.select.value!=3 && document.buscador.titulo.value.length < 3) {
		window.alert("Por favor, introduce una cadena de tres caracteres como mínimo.");
		return false;	
	}

	var titulo_enviar = escape(window.document.buscador.titulo.value);
	if (document.buscador.select.value==1) {
		document.buscador.action ="/buscador/programas/?termino=" + escape(titulo_enviar);
		document.buscador.submit();
	}
	if (document.buscador.select.value==2) {
		document.buscador.action="/buscador/peliculas/?termino=" + escape(titulo_enviar);
		document.buscador.submit();
	}
	if (document.buscador.select.value==3) {
		document.buscador.action="/buscador/series/?termino=" + escape(titulo_enviar);
		document.buscador.submit();
	}
	if (document.buscador.select.value==4) {
		document.buscador.action="/buscador/gente/?termino=" + escape(titulo_enviar);
		document.buscador.submit();
	}
	if (document.buscador.select.value==5) {
		//document.buscador.action="/buscador/internet/?termino=" + escape(titulo_enviar);
		//document.buscador.submit();

		url = "http://laguiatv.ozu.es/search.php?as_qt=w&as_q="+window.document.buscador.titulo.value;
		window.document.location=url;
		}
	
	return false
}


function registrar_usuario() {
	if (window.document.alta.username.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado el usuario.</p>';	
		document.getElementById('l_usuario').className = 'error';
		window.scrollTo(0,0);
		return;	
	}
	else
		document.getElementById('l_usuario').className = '';
	
	if (window.document.alta.email.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado el email.</p>';
		document.getElementById('l_email').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_email').className = '';					
	
	var expresion_regular=/^.+\@.+\..+$/;
	formato = window.document.alta.email.value.match(expresion_regular);
	if (formato == null){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>El email no tiene el formato correcto.(ejemplo@laguiatv.com).</p>';
		document.getElementById('l_email').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else 
		document.getElementById('l_email').className = '';					
		
	if (window.document.alta.password.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado la contraseña.</p>';	
		document.getElementById('l_password').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else if (window.document.alta.password.value.length < 6){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>La contraseña debe tener al menos seis caracteres.</p>';	
		document.getElementById('l_password').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_password').className = '';
	
	if (window.document.alta.password2.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has confirmado la contraseña.</p>';	
		document.getElementById('l_password2').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_password2').className = '';
			
	//comprobar que son las misma contraseñas
	if (window.document.alta.password.value != window.document.alta.password2.value){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>Las contraseñas no coinciden.</p>';
		window.scrollTo(0,0);
		return;
	}
	
	if (window.document.alta.nombre.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado tu nombre.</p>';
		document.getElementById('l_nombre').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_nombre').className = '';
	
	if (window.document.alta.apellidos.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado tus apellidos.</p>';
		document.getElementById('l_apellidos').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_apellidos').className = '';	
		
	if (!document.alta.ok_uso.checked){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>Es necesario aceptar las condiciones de uso.</p>';
		window.scrollTo(0,0);
		return;
	}
	
	document.getElementById('msg_error').style.display = 'none';	
	window.document.alta.submit();
}


function actualizar_datos_usuario() {
	if (window.document.alta.password.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado la contraseña.</p>';	
		document.getElementById('l_password').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else if (window.document.alta.password.value.length < 6){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>La contraseña debe tener al menos seis caracteres.</p>';	
		document.getElementById('l_password').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_password').className = '';
	
	if (window.document.alta.password2.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has confirmado la contraseña.</p>';	
		document.getElementById('l_password2').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_password2').className = '';
			
	//comprobar que son las misma contraseñas
	if (window.document.alta.password.value != window.document.alta.password2.value){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>Las contraseñas no coinciden.</p>';
		window.scrollTo(0,0);
		return;
	}
	
	if (window.document.alta.nombre.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado tu nombre.</p>';
		document.getElementById('l_nombre').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_nombre').className = '';
	
	if (window.document.alta.apellidos.value==''){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>No has insertado tus apellidos.</p>';
		document.getElementById('l_apellidos').className = 'error';
		window.scrollTo(0,0);
		return;
	}
	else
		document.getElementById('l_apellidos').className = '';	
		
	if (!document.alta.ok_uso.checked){
		document.getElementById('msg_error').style.display = 'block';	
		document.getElementById('cont_msg_error').innerHTML = '<p>Es necesario aceptar las condiciones de uso.</p>';
		window.scrollTo(0,0);
		return;
	}
	
	document.getElementById('msg_error').style.display = 'none';	
	window.document.alta.submit();
	
	
}	