var vEvAnterior;
vEvAnterior=1;
function imprimir(que) {
	var ventana = window.open("", "", "");
	var contenido = "<html><link rel='stylesheet' type='text/css' href='css/estilos.css' /><body style='background:#FFFFFF' onload='window.print();window.close();'><div style='width:570ppx; background:#FFFFFF'>" + document.getElementById(que).innerHTML + "</div></body></html>";
	ventana.document.open();
	ventana.document.write(contenido);
	ventana.document.close();
}
function zoomText(Accion,Elemento)
{	var obj=document.getElementById(Elemento);
	var max = 200 //tamaño máximo del fontSize
	var min = 70 //tamaño mínimo del fontSize
	if (obj.style.fontSize=="")
	{	obj.style.fontSize="100%";
	}
	actual=parseInt(obj.style.fontSize); //valor actual del tamaño del texto 
	incremento=10;// el valor del incremento o decremento en el tamaño 

	//accion sobre el texto 
	if( Accion=="normal" ){
		obj.style.fontSize="100%"
	}
	if( Accion=="aumentar" && ((actual+incremento) <= max )){
		valor=actual+incremento;
		obj.style.fontSize=valor+"%"
	}
	if( Accion=="disminuir" && ((actual+incremento) >= min )){
		valor=actual-incremento;
		obj.style.fontSize=valor+"%"
	}
} 
function NewWindow(mypage,myname,w,h,scrollbar,resi)
{	LeftPosition = (screen.width-w)/2
	TopPosition = (screen.height-h)/2 
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbar+',resizable='+resi+',toolbar=no,directories=no,menubar=no,status=no'
	//window.open(mypage,myname,settings);
	
	var vent ;
	 vent =open(mypage,vent,settings);
	 vent.focus();
}
function changeSize(pVal)
{	var eventos = new Array();
	var pTxtSalida;
	eventos[0] = "disminuir";
	eventos[1] = "normal";
	eventos[2] = "aumentar";
	if(pVal!="3")
	{	switch(pVal)
		{	case 0:
				if((vEvAnterior=="1")||(vEvAnterior=="0"))
				{	document.getElementById("Tamizar").innerHTML='Tama&ntilde;o texto <a href="javascript:changeSize(3);" class="zoom10" title="Disminuir">A</a> <a href="javascript:changeSize(1);" class="zoom11" title="Normal">A</a> <a href="javascript:changeSize(2);" class="zoom12" title="Agrandar">A</a>';	}
				else
				{	document.getElementById("Tamizar").innerHTML='Tama&ntilde;o texto <a href="javascript:changeSize(0);" class="zoom10" title="Disminuir">A</a> <a href="javascript:changeSize(3);" class="zoom11" title="Normal">A</a> <a href="javascript:changeSize(2);" class="zoom12" title="Agrandar">A</a>';	}
				break;
			case 1:	document.getElementById("Tamizar").innerHTML='Tama&ntilde;o texto <a href="javascript:changeSize(0);" class="zoom10" title="Disminuir">A</a> <a href="javascript:changeSize(3);" class="zoom11" title="Normal">A</a> <a href="javascript:changeSize(2);" class="zoom12" title="Agrandar">A</a>';break;
			case 2:	
				if((vEvAnterior=="1")||(vEvAnterior=="2"))
				{	document.getElementById("Tamizar").innerHTML='Tama&ntilde;o texto <a href="javascript:changeSize(0);" class="zoom10" title="Disminuir">A</a> <a href="javascript:changeSize(1);" class="zoom11" title="Normal">A</a> <a href="javascript:changeSize(3);" class="zoom12" title="Agrandar">A</a>';	}
				else
				{	document.getElementById("Tamizar").innerHTML='Tama&ntilde;o texto <a href="javascript:changeSize(0);" class="zoom10" title="Disminuir">A</a> <a href="javascript:changeSize(3);" class="zoom11" title="Normal">A</a> <a href="javascript:changeSize(2);" class="zoom12" title="Agrandar">A</a>';	}
				break;
		}
		zoomText(eventos[pVal],"Lectura");
		vEvAnterior=pVal;
	}
}

function visibilidad(pIntVal)
{	if(pIntVal=="1")
	{	document.getElementById("buscador").style.visibility="hidden";	}
	if(pIntVal=="2")
	{	document.getElementById("buscador").style.visibility="visible";	}
}

function verCapa(pStrCapa,pIntVal)
{	if(pIntVal=="1")
	{	document.getElementById(pStrCapa).style.visibility="hidden";	}
	if(pIntVal=="2")
	{	document.getElementById(pStrCapa).style.visibility="visible";	}
}

var Utf8 = {

	// public method for url encoding
	encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	},

	// public method for url decoding
	decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;

		while ( i < utftext.length ) {

			c = utftext.charCodeAt(i);

			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}

		}

		return string;
	}

}
