var prevVis = 0;
var nextVis = 1;

function hidePrev(id, t)
{
   if ((id == "galPrev") && (prevVis == 1))
   {
       prevVis = 0;
       hide(id, t);	      
   }
   if ((id == "galNext") && (nextVis == 1))
   {
       nextVis = 0;
       hide(id, t);	      
    }   
}

function showPrev(id, t)
{
   if ((id == "galPrev") && (prevVis == 0))
   {
       prevVis = 1;
       show(id, t);	      
   }
   if ((id == "galNext") && (nextVis == 0))
   {
       nextVis = 1;
       show(id, t);	      
    }
} 

function moveGalLeft()
  {
    var idL = "li" + position;    
    var splashL = "splash" + position;
    var posR = position + 4;
    var idR = "li" + posR;
    var splashR = "splash" + posR;
    var speed = 3;
    var timer = 0;
    var widL = 204;
    var widR = 0;

    document.getElementById(splashR).width='0';
    document.getElementById(idR).style.display='';
    
    for(i = 100; i >= 0; i--)
    {
      setTimeout("document.getElementById('"+ splashL + "').width='"+widL+"';document.getElementById('"+ splashR + "').width='"+widR+"';document.getElementById('"+ splashL + "').height='411';document.getElementById('"+ splashR + "').height='411';",(timer * speed));
      widL = widL - 2;
      widR = widR + 2;
      timer++;
    }
    
    setTimeout("document.getElementById('"+ idL + "').style.display='none';document.getElementById('"+ splashL + "').width='204';",(timer * speed));
    position = position + 1;
    
    checkScrollers(position);
  }
  
  function moveGalRight()
  {
    var posR = position + 3;
    var posL = position - 1;
    var idR = "li" + posR;
    var idL = "li" + posL;
    var speed = 3;
    var timer = 0;
    var widR = 204;
    var widL = 0;
    var splashR = "splash" + posR;
    var splashL = "splash" + posL;
    
    document.getElementById(splashL).width='0';
    document.getElementById(idL).style.display='inline-block';
  	       
    for(i = 100; i >= 0; i--)
    {
      setTimeout("document.getElementById('"+ splashR + "').width='"+widR+"';document.getElementById('"+ splashL + "').width='"+widL+"';",(timer * speed));
      widR = widR - 2;
      widL = widL + 2;
      timer++;
    }

    setTimeout("document.getElementById('"+ idR + "').style.display='none';document.getElementById('"+ splashR + "').width='204';document.getElementById('"+ splashL + "').width='204';",(timer * speed));
    timer++;
    
    position = position - 1;        
    checkScrollers(position);
}
      
function checkScrollers(p)
{	      
    if (p > alba.length - 5)
	        hidePrev("galNext",250);
	      else
	        showPrev("galNext", 250);
    if (p <= 1)
	        hidePrev("galPrev",250);
	      else
	        showPrev("galPrev", 250);
}

