//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 isFull=false;
var idNum=1;$( document ).ready(function() {initUser();
$("#okDelete").click(function() {$.ajax({data: {"action": "delete",},type: "POST",dataType: "json",url: "../php/ardoraXML.php",success: function(data, textStatus, jqXHR) {var mensa = "";
if (data["status"] == "Ok") {$("#men").css("color", "green"); mensa = ""} else {$("#men").css("color", "red");mensa = "Error"} $("#men").text(mensa);window.open("../index.php", "_self");timer = setTimeout("hideMen()", 3000);}});})
$("#b_close").click(function(){window.open("../index.php", "_self");})
$("#b_fullscreen").click(function (){if (isFull) {isFull=false;fullScreenCancel();}else{isFull=true;fullScreen()}})
$("#b_save").click(function() {$.ajax({data: {"action":"new","type": "0","nameUser":"","idNum" : idNum.toString(),
"paragrafo2" : String(CKEDITOR.instances.paragrafo2.getData()),
},type: "POST",dataType: "json",url: "../php/ardoraXML.php",
success: function(data, textStatus, jqXHR) {var mensa="";if (data["status"]=="Ok"){$("#men").css("color", "green");$("#buttonUp").css("visibility","visible"); mensa=""} else {
$("#men").css("color", "red"); mensa="Error while saving the file"} $("#men").text(mensa);timer = setTimeout("hideMen()", 3000);}
});});});
function initUser(){$.ajax({data: {"action": "getUser"},type: "POST",dataType: "json",url: "ardoraXML.php",
success: function(data, textStatus, jqXHR) {if ($.trim(data["userType"])=="profe" || $.trim(data["userType"])=="admin"){ window.open("introAdmin.php","_self");} else{if ($.trim(data["tiUser"])=="1"){
$("#paragrafo2").text(data["paragrafo2"]);
} else{$("#buttonUp").css("visibility","hidden");}}}});}
function hideMen(){$("#men").text("");clearTimeout(timer);}
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);}}
