var MoveUnit = 854
var MaxFoto
var PosInit
var Pages
var MaxMove

function MoveLeft()
{
	var posx = Element.cumulativeOffset($('Thumbs'))[0] 
	/*alert(posx);*/
	
	if (posx<0) {
    new Effect.MoveBy('Thumbs', 0, MoveUnit , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.sinoidal, queue: 'end'
                              });
	}
	else
	{
	new Effect.MoveBy('Thumbs', 0, -MaxMove , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.sinoidal, queue: 'end'
                              });
	}
}

function MoveRight()
{
    var posx = Element.cumulativeOffset($('Thumbs'))[0]
	/*alert(posx);*/
	if ((posx-PosInit)>-MaxMove) {
	new Effect.MoveBy('Thumbs', 0, -MoveUnit , 
                              {
                                  duration: 0.4,  
                                  transition: Effect.Transitions.sinoidal, queue: 'end'
                              });
	}
}
function LoadPic(img)
{
	/*new Effect.Fade('Photo');*/
	Element.hide('Photo');
	$('Photo').src=$(img).href;
	new Effect.Appear('Photo');
}
function OverThumb(img)
{
	/*Element.hide(img);*/
	new Effect.Puff(img);
	window.setTimeout('Effect.Appear(img, {duration:.3})',2500);
}
function ItnPreload()
{
	links=$("Thumbs").getElementsByTagName("a");
	$('Photo').src=links[0].href;
	
	for(i=0;i<links.length;i++)
	{
	$('thumb'+i).src=links[i].href;
    }
	MaxFoto = i;
	PosInit = Element.cumulativeOffset($('Thumbs'))[0];
	Pages = Math.round((MaxFoto / 7)-0.5)
	MaxMove = Pages * MoveUnit
	/*
	alert(MaxFoto);
	alert(PosInit);
	alert(Pages);
	alert(MaxMove);*/
}

function PadDigits(n, totalDigits) 
{ 
	n = n.toString(); 
	var pd = ''; 
	if (totalDigits > n.length) 
	{ 
		for (i=0; i < (totalDigits-n.length); i++) 
		{ 
			pd += '0'; 
		} 
	} 
	return pd + n.toString(); 
}
function mouseDown(e) {
 if (parseInt(navigator.appVersion)>3) {
  var clickType=1;
  if (navigator.appName=="Netscape") clickType=e.which;
  else clickType=event.button;
  if (clickType!=1) {
   alert ('Sorry, right mouse button is disabled.');
   return false;
  }
 }
 return true;
}
if (parseInt(navigator.appVersion)>3) {
 document.onmousedown = mouseDown;
 if (navigator.appName=="Netscape") 
  document.captureEvents(Event.MOUSEDOWN);
}
 