$(document).ready(function() {
//console.log("ready!");
const inicio = "/index.html";
const indice = "/";
const organigrama = "/organigrama.html";
const funciones = "/funciones.html";
const tramites = "/tramites.html";
const documentos = "/documentos.html";
const estadocuenta = "/EstadoCuenta.html";
const antecedentes = "/antecedentes.html";
readTextFile("js/textos.json", function(text) {
var data = JSON.parse(text);
//console.log(data);
datap = data;
for(let i = 0; i < Object.keys(datap["menu_izq"]).length; i++)
{
let html= '
'+data['menu_izq'][i].texto+
''
$('#menu_izq').append(html)
}
if ((window.location.pathname === inicio)||(window.location.pathname === indice)) {
(data["Variables"]["index"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["index"]["seccion"][1]) : $("#seccion").load(data["Variables"]["index"]["seccion"][1]);
(data["Variables"]["index"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["index"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["index"]["cuerpo"][1]);
}
if (window.location.pathname === organigrama) {
(data["Variables"]["organigrama"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["organigrama"]["seccion"][1]) : $("#seccion").load(data["Variables"]["organigrama"]["seccion"][1]);
(data["Variables"]["organigrama"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["organigrama"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["organigrama"]["cuerpo"][1]);
}
if (window.location.pathname === funciones) {
(data["Variables"]["funciones"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["funciones"]["seccion"][1]) : $("#seccion").load(data["Variables"]["funciones"]["seccion"][1]);
(data["Variables"]["funciones"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["funciones"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["funciones"]["cuerpo"][1]);
}
if (window.location.pathname === tramites) {
(data["Variables"]["tramites"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["tramites"]["seccion"][1]) : $("#seccion").load(data["Variables"]["tramites"]["seccion"][1]);
(data["Variables"]["tramites"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["tramites"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["tramites"]["cuerpo"][1]);
}
if (window.location.pathname === documentos) {
(data["Variables"]["documentos"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["documentos"]["seccion"][1]) : $("#seccion").load(data["Variables"]["documentos"]["seccion"][1]);
(data["Variables"]["documentos"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["documentos"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["documentos"]["cuerpo"][1]);
}
if (window.location.pathname === estadocuenta) {
(data["Variables"]["estadocuenta"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["estadocuenta"]["seccion"][1]) : $("#seccion").load(data["Variables"]["estadocuenta"]["seccion"][1]);
(data["Variables"]["estadocuenta"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["estadocuenta"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["estadocuenta"]["cuerpo"][1]);
Persona.setpub_key();
}
if (window.location.pathname === antecedentes) {
(data["Variables"]["antecedentes"]["seccion"][0] ==="text") ? $('#seccion').text(data["Variables"]["antecedentes"]["seccion"][1]) : $("#seccion").load(data["Variables"]["antecedentes"]["seccion"][1]);
(data["Variables"]["antecedentes"]["cuerpo"][0] ==="text") ? $('#cuerpo').text(data["Variables"]["antecedentes"]["cuerpo"][1]) : $("#cuerpo").load(data["Variables"]["antecedentes"]["cuerpo"][1]);
}
});
});
$( window ).on( "load", function() {
const estadocuenta = "/estadocuenta.html";
if (window.location.pathname === estadocuenta) {
LoginSACI()
}
});
let datap = []
function readTextFile(file, callback) {
var rawFile = new XMLHttpRequest();
rawFile.overrideMimeType("application/json");
rawFile.open("GET", file, true);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 && rawFile.status == "200") {
callback(rawFile.responseText);
}
}
rawFile.send(null);
}
function LoginSACI(){
$("#loginUAEH").click(function() {
Persona.Login();
});
}