
$(document).ready(function(){ 
jQuery("#otrasnoticias").hide()
jQuery("#not").toggle(function() {
jQuery("#otrasnoticias").show('slow');
}, function() {
    jQuery("#otrasnoticias").hide('slow');
});


$("a[rel='external']").click(function(){

		this.target = "_blank";

	});
	
		/*FORMULARIO BUSQUEDA FONDO VIANA*/
  /* jQuery(function($) {
	  //$("#autor").mask("99/99/9999");
	 $('#desde').mask('9999');
      $('#hasta').mask('9999');	  
   });*/
if(jQuery("input[@name='fecha']:checked").val()=="todos")
{
$('#hasta').attr('disabled', 'disabled');
$('#desde').attr('disabled', 'disabled'); 
}
jQuery(".fecha").click(function(){

if(jQuery("input[@name='fecha']:checked").val()=="todos")
{					
$('#desde').attr('value','');
$('#hasta').attr('value','');
$('#hasta').attr('disabled', 'disabled');
$('#desde').attr('disabled', 'disabled'); 
}
else
{
$('#hasta').attr('disabled', '');
$('#desde').attr('disabled', ''); 
}

})
	
});
function reiniciarv()
{
$('.divresultados').hide();
setTimeout("window.location='fviana.asp'",0);
}
function reiniciart()
{
$('.divresultados').hide();
setTimeout("window.location='ftorres.asp'",0);
}
function reiniciarb()
{
$('.divresultados').hide();
setTimeout("window.location='fbiblioteca.asp'",0);
}

function buscarv()
{

var titulo=$('#title').attr('value');
var autor=$('#autor').attr('value');
var signatura=$('#signatura').attr('value');
var categoria=$('#categoria').attr('value');
var desde=$('#desde').attr('value');
var hasta=$('#hasta').attr('value');

if(titulo=="" && autor=="" && signatura=="" && categoria=="" && desde=="" && hasta=="" )
{
jAlert("Debe rellenar al menos un dato del formulario","Datos incorrectos");
return false;
}
if(jQuery("input[@name='fecha']:checked").val()!="todos")
{

if(desde=="")
	{
	jAlert("Debe rellenar la fecha inicial","Datos incorrectos");
	return false;
	error=error+1;}
	if(hasta=="")
	{jAlert("Debe rellenar la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	if(parseInt(desde)>parseInt(hasta))
	{jAlert("La fecha inicial no debe ser mayor que la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	var desde=desde;
	var hasta=hasta;
	
	if (!/^([0-9])*$/.test(desde)) {
	jAlert("La fecha inicial debe ser numerica.","Datos incorrectos");
	return false;
	}
	if (!/^([0-9])*$/.test(hasta)) {
	jAlert("La fecha final debe ser numerica.","Datos incorrectos");
	return false;
	}
	
}
}
/*BUSCAR FONDO TORRES CABRERA*/
function buscart()
{

var titulo=$('#title').attr('value');
var signatura=$('#signatura').attr('value');
var desde=$('#desde').attr('value');
var hasta=$('#hasta').attr('value');

if(titulo=="" && signatura=="" && desde=="" && hasta=="" )
{
jAlert("Debe rellenar al menos un dato del formulario","Datos incorrectos");
return false;
}
if(jQuery("input[@name='fecha']:checked").val()!="todos")
{

if(desde=="")
	{
	jAlert("Debe rellenar la fecha inicial","Datos incorrectos");
	return false;
	error=error+1;}
	if(hasta=="")
	{jAlert("Debe rellenar la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	if(parseInt(desde)>parseInt(hasta))
	{jAlert("La fecha inicial no debe ser mayor que la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	var desde=desde;
	var hasta=hasta;
	
	if (!/^([0-9])*$/.test(desde)) {
	jAlert("La fecha inicial debe ser numerica.","Datos incorrectos");
	return false;
	}
	if (!/^([0-9])*$/.test(hasta)) {
	jAlert("La fecha final debe ser numerica.","Datos incorrectos");
	return false;
	}
	
}
}

/*BUSCAR FONDO BIBLIOTECA HISTORICA*/
function buscarb()
{

var titulo=$('#title').attr('value');
var autor=$('#autor').attr('value');
var lugar=$('#lugar').attr('value');
var edicion=$('#edicion').attr('value');
var desde=$('#desde').attr('value');
var hasta=$('#hasta').attr('value');

if(titulo=="" && autor=="" && lugar=="" && edicion=="" && desde=="" && hasta=="" )
{
jAlert("Debe rellenar al menos un dato del formulario","Datos incorrectos");
return false;
}
if(jQuery("input[@name='fecha']:checked").val()!="todos")
{

if(desde=="")
	{
	jAlert("Debe rellenar la fecha inicial","Datos incorrectos");
	return false;
	error=error+1;}
	if(hasta=="")
	{jAlert("Debe rellenar la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	if(parseInt(desde)>parseInt(hasta))
	{jAlert("La fecha inicial no debe ser mayor que la fecha final","Datos incorrectos");
	return false;
	error=error+1;}
	var desde=desde;
	var hasta=hasta;
	
	if (!/^([0-9])*$/.test(desde)) {
	jAlert("La fecha inicial debe ser numerica.","Datos incorrectos");
	return false;
	}
	if (!/^([0-9])*$/.test(hasta)) {
	jAlert("La fecha final debe ser numerica.","Datos incorrectos");
	return false;
	}
	
}
}

