//Creado con Ardora - www.webardora.net
//bajo licencia Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
//para otros usos contacte con el autor
var indexList=[];var isFull=false;var index=0;
$(document).ready(function() {
makeIndex();
$("#goRightBut").click(function() {index++;goArrows();});
$("#goLeftBut").click(function() {index--;goArrows();});
$("#b_edit").click(function() {window.open("php/introdatos.php","_self");});
$("#b_fullscreen").click(function (){if (isFull) {isFull=false;fullScreenCancel();}else{isFull=true;fullScreen()}})
});
function makeIndex(){$.ajax({data: {"action": "indexList",},type: "POST",dataType: "json",async: false,url: "php/ardoraXMLread.php",
success: function(data, textStatus, jqXHR) {if (data!=null){ $.each(data, function(k, v){if (data[k]!="." && data[k]!=".."){
indexList.push(data[k].substr(0,data[k].length-4));
}});} goArrows();}});makeMenu();}
function goArrows(){$("#goRightBut").hide();$("#goLeftBut").hide();if (indexList.length>0){showItem(indexList[index]);if (index>0){$("#goLeftBut").show()} if (index<indexList.length-1){$("#goRightBut").show()}}}
function makeMenu(){$("#buttonUp").html("");if (indexList.length>0){var newHtml="<p id='menuBut' class='butfont butLe'>X</p><ul>";
for (i=0;i<indexList.length;i++){newHtml=newHtml+'<li class="submenu"><a href="javascript:goItem('+i.toString()+')">'+indexList[i]+'</a></li>';}
newHtml=newHtml+"</ul>";$("#buttonUp").html(newHtml);}}
function goItem(num){index=num;goArrows();}
function showItem(indexKey){$.ajax({data: {"action": "read","indexKey": indexKey,},type: "POST",dataType: "json",url: "php/ardoraXMLread.php",success: function(data, textStatus, jqXHR) {
$("#paragrafo2").html($.parseHTML(data["paragrafo2"]));
}});}
function fullScreen() {var docElement,request;docElement = document.documentElement;request = docElement.requestFullScreen || docElement.webkitRequestFullScreen || docElement.mozRequestFullScreen || docElement.msRequestFullScreen;if(typeof request!="undefined" && request){request.call(docElement);}}
function fullScreenCancel() {var docElement, request;docElement=document;request = docElement.cancelFullScreen|| docElement.webkitCancelFullScreen || docElement.mozCancelFullScreen || docElement.msCancelFullScreen || docElement.exitFullscreen;if(typeof request!="undefined" && request){request.call(docElement);}}
