



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(maxtam)
{
  LEwm = new LEwmgo('foto_destacats');
  
  if (parseInt(navigator.appVersion)>3) {
 if (navigator.appName=="Netscape") {
   maxtam=window.innerHeight-370;
 }
 if (navigator.appName.indexOf("Microsoft")!=-1) {
   maxtam=document.body.offsetHeight-470;
 }
} 
  
  LEwmss();
  LEwmwx = parseInt(LEwm.style.width);
  LEwmpx = (LEwmsx - (LEwmwx+LEwmO+18));
  LEwm.style.top= LEwmT + "px";
 //LEwm.style.left= LEwmpx + "px";
  LEwmtm   = setInterval("moveLEwm("+maxtam+")",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,maxtam)
{
  clearInterval(LEwmtm);
  LEwmem = LEwmel; LEwmi = LEwmpy;
  LEwmstm = setInterval("LEwmsl(LEwmem,LEwmi,"+maxtam+");",30);
}

function LEwmsl(LEwmel2,LEwmpy2,maxtam)
{
   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("+maxtam+")",250);
   }
   else
   { 
     LEwmdf = ((LEwmpy2 - LEwmcpos) / 2);
     LEwmel2.style.top = parseInt( LEwmcpos +  LEwmdf ) + "px"; 
   }

}

function moveLEwm(maxtam)
{
 if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) 
 // capture x.x portion and store as a number
  if (ieversion==6){
	posicio=470;
  }else {
  posicio=460;
}

 
  if (window.innerHeight)
  { LEwmso = window.pageYOffset-posicio }
  else if (document.documentElement && document.documentElement.scrollTop)
  { LEwmso = document.documentElement.scrollTop-posicio }
  else if (document.body)
  { LEwmso = document.body.scrollTop-posicio  }
  if (LEwmso < LEwmT) LEwmso = LEwmT;
  else LEwmso += LEwmT;
  if (LEwmso == LEwmO)
  { 
  		if (document.all) ventana=document.documentElement.offsetHeight+100;
else ventana=(window.outerHeight-78);
		
		if (ventana>485) LEwmad(LEwm,LEwmso,maxtam); 
	
	
  }
  
  LEwmO = LEwmso;
  
}



