function initMenu() {
	var opc = document.getElementById('opc'+thisPage.getId());
	var opcParent = null;
	if (opc==null) {
		opc = document.getElementById('subopc'+thisPage.getId());
		if (opc!=null) {
			opc.className = 'active';
			opc = opc.previousSibling;
			if (opc!=null) {
				while((opc!=null) && (opc.tagName=='DD' || opc.tagName==null)){
					opc = opc.previousSibling;
				}
			}
			if (opc.tagName=='DT') {
				opc.className = 'sublevel-active';
				opc = opc.nextSibling;
				if (opc!=null) {
					while((opc!=null) && (opc.tagName=='DD' || opc.tagName==null)){
						if (opc.className!='active')opc.className = '';
						opc = opc.nextSibling;
					}
				}
			}
		} else if (arrayPages.length>2) {
			opc = document.getElementById('subopc'+arrayPages[2]);
			if (opc!=null) {
				opc.className = 'active';
				opc = opc.previousSibling;
				if (opc!=null) {
					while((opc!=null) && (opc.tagName=='DD' || opc.tagName==null)){
						opc = opc.previousSibling;
					}
				}
				if (opc.tagName=='DT') {
					opc.className = 'sublevel-active';
					opc = opc.nextSibling;
					if (opc!=null) {
						while((opc!=null) && (opc.tagName=='DD' || opc.tagName==null)){
							if (opc.className!='active')opc.className = '';
							opc = opc.nextSibling;
						}
					}
				}
			}
		}
	} else if (opc!=null) {
		if (opc.className!='sublevel') {
			opc.className = 'active';
		} else {
			opc.className = 'sublevel-active-select';
		}

		opc = opc.nextSibling;
		if (opc!=null) {
			while((opc!=null) && (opc.tagName=='DD' || opc.tagName==null)){
				if (opc.className!='active')opc.className = '';
				opc = opc.nextSibling;
			}
		}
	}
}

function initLanguageChange() {
	var selector = document.getElementById('lenguaje');
	if (selector!=null) {
		selector.onchange = function() {
			document.location.href = selector.value;
			}
	}
}

function initFontSize() {
	var minus = document.getElementById('fileLinkA4');
	var plus = document.getElementById('fileLinkA5');
	if (minus!=null) {
		minus.onclick = function() { thisPage.changeStyles(0); }
		minus.onkeypress = function() { thisPage.changeStyles(0); }
	}
	if (plus!=null) {
		plus.onclick = function() { thisPage.changeStyles(1); }
		plus.onkeypress = function() { thisPage.changeStyles(1); }
	}
}

function trimAll(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function setTxtSearch(id,text,num) {
	if (id!=null && id!="" && text!=null && text!="") {
		if (id == "PWD") {
			if (trimAll(document.getElementById("PWD").value) == "") {
				document.getElementById("PWD").value = "";
				document.getElementById(id).className = "invisible";
				document.getElementById("PWD2").className = "visible";
			}
			if (trimAll(document.getElementById("PWD2").value) == "") {
				document.getElementById("PWD2").value = text;
			}
		} else {
			if (trimAll(document.getElementById(id).value) == "") {
				document.getElementById(id).value = text;
			}
		}
	}
}

function setTxtSearchBlanco(id,text,num) {
	if (id!=null && id!='' && text!=null && text!='') {
		if (trimAll(document.getElementById(id).value) == text) {
			document.getElementById(id).value = "";
			if (num!=null && num==1) {
				document.getElementById(id).className = "invisible";
				document.getElementById("PWD").className = "visible";
				document.getElementById("PWD").focus();
			}
		}
	}
}

function showLogin() {
	var loginform = document.getElementById('loginform');
	if (loginform != null) {
		if (loginform.className == 'invisible') {
			loginform.className = 'visible';
		}
	}
}