function saveCookie(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;
}

function deleteCookie(name) {
		saveCookie(name,"",-1);
	}

function abrirIssue(num){
	 //var especificaciones="top=0, left=0, toolbar=no,location=no, status=no,menubar=no,scrollbars=no, resizable=no, width=400,height=400"
	
	if (num==32) window.location.href="http://www.lux-mag.com"; 
	else window.open('http://www.lux-mag.com/history/'+num+'/index.php', '_blank'); 
	saveCookie('numIssue',num,1);
		
	
}
function backHome(num){
	
	if (num < 32){
		document.getElementById('back2').style.display ='inline';
		document.getElementById('back1').style.display ='none'; 
	}
	else {
		document.getElementById('back1').style.display ='inline';
		document.getElementById('back2').style.display ='none'; 
		
	}

}

function mostrarCapa(i){
	
	if (i == "inline"){	// fem petit
		
		document.getElementById('sign2').style.display ='inline';
		document.getElementById('sign1').style.display ='none'; 
		document.getElementById('listIssue').style.display ='none';
		saveCookie('back',1,1);
	}
	else{ //fem gran
		document.getElementById('sign1').style.display ='inline'; 
		document.getElementById('sign2').style.display ='none';
		document.getElementById('listIssue').style.display ='block';
		saveCookie('back',0,1);
	}
	
}


var LEwm;
var LEwmO = 59;
var LEwmT = 0;
var LEwmtm,LEwmstm;
var LEwmi, LEwmem, LEwmcpos;
var LEwmsx,LEwmsy;  // screen x & y
var LEwmwx,LEwmpx;
var LEwmdf;



function LEwmover()
{
  LEwm.style.visibility  = "hidden";
}

function LEwmout()
{
  LEwm.style.visibility  = "visible";
}

function LEwmin()
{
  LEwm = new LEwmgo('backIssues');
  
  LEwmss();
  LEwmwx = parseInt(LEwm.style.width);
  LEwmpx = (LEwmsx - (LEwmwx+LEwmO+18));
  LEwm.style.top= LEwmT + "px";
 //LEwm.style.left= LEwmpx + "px";
  LEwmtm   = setInterval("moveLEwm()",250);
    
}

function LEwmss()
{
  if (self.innerHeight) { LEwmsx = self.innerWidth;LEwmsy = self.innerHeight; }
  else if (document.documentElement && document.documentElement.clientHeight)
  { LEwmsx = document.documentElement.clientWidth; LEwmsy = document.documentElement.clientHeight; LEwmsx = LEwmsx+18; }
  else if (document.body)
  { LEwmsx = document.body.clientWidth; LEwmsy = document.body.clientHeight; LEwmsx = LEwmsx+18; }
}

function LEwmgo(name)
{
  if (document.getElementById)
  { this.obj = document.getElementById(name); this.style = document.getElementById(name).style; }
  else if (document.all)
  { this.obj = document.all[name]; this.style = document.all[name].style; }
  else if (document.layers)
  { this.obj = document.layers[name]; this.style = document.layers[name]; }
}

function LEwmad(LEwmel,LEwmpy)
{
  clearInterval(LEwmtm);
  LEwmem = LEwmel; LEwmi = LEwmpy;
  LEwmstm = setInterval("LEwmsl(LEwmem,LEwmi);",30);
}

function LEwmsl(LEwmel2,LEwmpy2)
{
   LEwmcpos = parseInt(LEwmel2.style.top);
   if( Math.abs(LEwmpy2 - LEwmcpos) < 2)
   {
     LEwmel2.style.top = parseInt(LEwmpy2) + "px";
     clearInterval(LEwmstm);
     // handle resizing of screen here
     //LEwmss();
     //LEwmpx = (LEwmsx - (LEwmwx+LEwmO+18));
     //LEwm.style.left= LEwmpx + "px";
     LEwmtm = setInterval("moveLEwm()",250);
   }
   else
   { 
     LEwmdf = ((LEwmpy2 - LEwmcpos) / 2);
     LEwmel2.style.top = parseInt( LEwmcpos +  LEwmdf ) + "px"; 
   }

}

function moveLEwm()
{
  if (window.innerHeight)
  { LEwmso = window.pageYOffset }
  else if (document.documentElement && document.documentElement.scrollTop)
  { LEwmso = document.documentElement.scrollTop }
  else if (document.body)
  { LEwmso = document.body.scrollTop }
  if (LEwmso < LEwmT) LEwmso = LEwmT;
  else LEwmso += LEwmT;
  if (LEwmso == LEwmO)
  { 
    LEwmad(LEwm,LEwmso); 
  }
  LEwmO = LEwmso;
}
