var tipoDeElemento = 2;
var wantedToRun = 1;

function mostrarNC(n)
{
	llamarasincrono('sections/libro/mostrarNC.php?id='+n, 'libroinformacion');
}

function mostrarPA(n)
{
	llamarasincrono('sections/libro/mostrarPA.php?id='+n, 'libroinformacion');
}

function mostrarLaboratorio(n)
{
	llamarasincrono('sections/libro/mostrarLaboratorio.php?id='+n, 'libroinformacion');
}

function mostrarGT(n)
{
	llamarasincrono('sections/libro/mostrarGT.php?id='+n, 'libroinformacion');
}
	

function listarNC()
{
	llamarasincrono2('sections/libro/main.php', 'content', 'sections/libro/listarNC.php', 'libroinformacion');
}


function runLibro()
{
	if(leerCookie("MedicamentosRothlinLegal")=="")
	{
		wantedToRun = 1;
//		openAgreementContract();
		window.open('includes/agreement.php?id=','mr','height=624,width=611,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no');					

		return;
	}
	
	llamarasincrono2('sections/libro/main.php', 'content', "sections/libro/fillSelector.php?", 'libroSelectDiv');
	setActiveItem('demo_nav_libro');
	
}

function listarPA()
{
	//document.getElementById('changeablebanner').style.backgroundImage = 'url(images/03_el-libro.jpg)';
	llamarasincrono2('sections/libro/main.php', 'content', 'sections/libro/listarPA.php', 'libroinformacion');
}

function fillSelectorLibro(str, tipo)
{
	query = 'sections/libro/fillSelector.php?like='+str+'&tipo='+tipo;
	llamarasincrono(query, 'libroSelectDiv');	
}

function mostrarInformacion(seleccion)
{
	var seleccionado=seleccion.options[seleccion.selectedIndex].value;	
	var tabla=seleccion.options[seleccion.selectedIndex].getAttribute("tabla");	
	
	if(tabla==1) mostrarNC(seleccionado);
	else if(tabla==2) mostrarPA(seleccionado);
		else if(tabla==3) mostrarLaboratorio(seleccionado);
			else if(tabla==4) mostrarGT(seleccionado);
			else alert("Aun no implementado");
	
}