

function mensajeModal (mensaje, titulo)
{
	if(!titulo){var titulo="";} // No hay parametro por defecto  

	if (titulo ==""){
		$("#dialog").html("");
		$("#dialog").dialog({ 
			buttons: {
				"Aceptar": function() { $(this).dialog("close");}
			}, 
			modal:true,
			title: "<p>"+mensaje+"</p>" 
		});
	}
	else{
		$("#dialog").html("<p>"+mensaje+"</p>");
		$("#dialog").dialog({ 
			buttons: {
				"Aceptar": function() { $(this).dialog("close");}
			}, 
			modal:true,
			title: titulo 
		});
	}
}

function confirmacionModal (mensaje, titulo, objeto)
{
	var url = $(objeto).attr("href"); 
	
	if(!titulo){var titulo="";} // No hay parametro por defecto  

	if (titulo ==""){
		$("#dialog").html("");
		$("#dialog").dialog({ 
			buttons: {
			"Aceptar": function() { $(this).dialog("close");location.href = url;},
			"Cancelar": function() { $(this).dialog("close");}
			}, 
			modal:true,
			title: "<p>"+mensaje+"</p>" 
		});
	}
	else{
		$("#dialog").html("<p>"+mensaje+"</p>");
		$("#dialog").dialog({ 
			buttons: {
				"Aceptar": function() { $(this).dialog("close");location.href = url;},
				"Cancelar": function() { $(this).dialog("close");}
			}, 
			modal:true,
			title: titulo 
		});
	}
	
	return false;
}

function goBusAvanzado(rutaHtml, buscador)
{
	if (buscador == "libros" || buscador == "audiovisuales")
	{
		window.location.href = rutaHtml+"/busqueda/buscadorAvanzado.php?tipo="+buscador;
	}
	else if (buscador == "ebooks")
	{
		window.location.href = rutaHtml+"/busqueda/buscador-ebooks.php";
	}
	else if (buscador == "objetos")
	{
		window.location.href = rutaHtml+"/busqueda/buscadorObjetos.php";
	}
}

function abre_ventana(elemento, ancho, alto, scroll)
{
	var ventana=window.open(elemento.href, "_blank", "width="+ancho+"px, height="+alto+"px, scrollbars="+scroll);
	return ventana==undefined;
}

