$_GETAllVariables();
var hideMenu = $_GET("hideMenu");
var ssedenombre = $_GET("ssedenombre");
var sedeeniframe = $_GET("sedeeniframe");
var showAnalytics = $_GET("showAnalytics");
var tokenForm = $_GET("tokenForm");
var mensajeErrorCustom = xGetElementById("mensajeErrorCustom").value;
var logeoConExito = xGetElementById("logeoConExito").value;
var acceso_correcto = xGetElementById("acceso_correcto").value;
var errorAcceso = xGetElementById("errorAcceso").value;
var errorAuth = xGetElementById("errorAuth").value;
var okGenerico = xGetElementById("okGenerico").value;
var operacion_correcta = xGetElementById("operacion_correcta").value;
var mensajeCabeceraCustom = xGetElementById("mensajeCabeceraCustom").value;


if(sedeeniframe == undefined || sedeeniframe == null || sedeeniframe != 'true'){
	setTimeout(setAltura, 500, "separadorcontenidopie", "separadorcontenidopie", "bannerlateral", 245);  // Para IE se cambia a setTimeout
}
if (mensajeErrorCustom !== "" && mensajeErrorCustom !== "null") {
	mostrarMensajeCustom(true, mensajeErrorCustom);
} else if (logeoConExito != '' && logeoConExito != 'null') {
	mostrarMensajeCustom(false, acceso_correcto);
} else if (errorAcceso != '' && errorAcceso != 'null') {
	mostrarMensajeCustom(true, errorAuth);
} else if (okGenerico != '' && okGenerico != 'null') {
	mostrarMensajeCustom(false, operacion_correcta);
} else if (mensajeCabeceraCustom!= '' && mensajeCabeceraCustom != 'null') {
	mostrarMensajeCustom(false, mensajeCabeceraCustom);
}

if(showAnalytics != undefined && showAnalytics != null && showAnalytics == 'true'){
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', '${analyticsTracker}']);
	_gaq.push(['_trackPageview']);

	//funcion que se ejecuta al instante (funtion(){...})();
	(function() {
		var ga = document.createElement('script');
		ga.type = 'text/javascript';
		ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0];
		s.parentNode.insertBefore(ga, s);
	})();
}


if(hideMenu == 'true'){
	if(xGetElementById('miga') !== undefined){
	   xGetElementById('miga').style.display = 'none';
	}
	if(xGetElementById('titleCabeceraGeneral') !== undefined){
	   xGetElementById('titleCabeceraGeneral').style.display = 'none';
	}
	if(xGetElementById('titlePageDescription') !== undefined){
	   xGetElementById('titlePageDescription').style.display = 'none';
	}
	if(xGetElementById('tituloopcmenuselect') !== undefined && ssedenombre !== undefined && ssedenombre !== ''){
	   xGetElementById('tituloopcmenuselect').innerHTML = decodeURI(ssedenombre);
	}
}

//Añadir a cada formulario el input del token (HTML form without CSRF protection).
//Recorremos todos los formularios de la página y le añadimos el input.
var formularios = document.getElementsByTagName('form');
if (formularios != null && formularios != undefined && formularios.length > 0) {
   for (i = 0; i < formularios.length; i++){
	   formularios[i].appendChild(nuevaOpcionForm("tokenForm", tokenForm));
   }
}

function nuevaOpcionForm(id, value) {
	var elemento = document.createElement("INPUT");
	elemento.setAttribute("name", id);
	elemento.setAttribute("type", "hidden");
	elemento.setAttribute("value", value);
	return elemento;
}

function nobackbutton(){
	window.location.hash="#no-back-button";
	window.location.hash="#Again-No-back-button" //chrome
	//window.onhashchange=function(){window.location.hash="no-back-button";}
	try{
		postOnLoad();
	} catch(err) {}
        history.pushState(null, null, '#no-back-button');
    window.addEventListener('popstate', function(event) {
  history.pushState(null, null, '#no-back-button');
});
}

window.onload = nobackbutton;

