/******************************************************************** 
Cambiar el zoom de la página y empleo de cookies 
*********************************************************************/

function zoomText(Accion){ 
//inicializaciones
var divElements = document.getElementsByTagName('div'); 
var resultado=null;
obj=divElements[0];
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=="reestablecer"){
obj.style.fontSize="100%";
createCookie("fontsize",obj.style.fontSize,30);
resultado=readCookie("fontsize");
}

if(Accion=="aumentar"){
valor=actual+incremento;
if (valor<=200)
{
	obj.style.fontSize=valor+"%";
}
else
{	
	valor=200;
	obj.style.fontSize=valor+"%";
}

createCookie("fontsize",obj.style.fontSize,30);
resultado=readCookie("fontsize");
}

if(Accion=="disminuir"){
valor=actual-incremento;
if (valor>=100)
{
	obj.style.fontSize=valor+"%";
}
else
{	
	valor=100;
	obj.style.fontSize=valor+"%";
}
createCookie("fontsize",obj.style.fontSize,30);
resultado=readCookie("fontsize");
}
}

function loadPage() {
	var resultado = readCookie("fontsize");
	var divElements = document.getElementsByTagName('div'); 
	obj=divElements[0];
	obj.style.fontSize = resultado;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

loadPage();
/****************************************************************
 Impresion:  Abre una ventana nueva que se es la que se encarga 
 de imprimir el contenido de la ventana actual.
****************************************************************/
function imprimir(camino){
	var pagImp = camino + "diseno/paginaImprimir.html";
	window.open(pagImp,"ventanaImprimir","top=0,left=0,width=670,height=500,scrollbars=Yes,resizable=No,directories=No,location=no,menubar=No,status=No,titlebar=No,toolbar=No");
}
