// JavaScript Document
var MyImageIndex = 0;
var NumImages = 24;
var PageLimit = 12;
var ini =  PageLimit * ActualPage;
var end = ini + PageLimit - 1;
if(NumImages>ini && NumImages<=end)
{
	end = NumImages-1;	
}
var MyImages = MultiDimensionalArray(NumImages,2);
var ImageDir= "galeria_fotografica/incatour2005/";

var lock = false;
var id_interval;
MyImages[0][0] = "001.jpg"
MyImages[0][1] = "Alonso Burgos showing knitting machine at Incalpaca TPX"

MyImages[1][0] = "002.jpg"
MyImages[1][1] = "Looking at dyeing lab at Inca Tops"

MyImages[2][0] = "003.jpg"
MyImages[2][1] = "Ted and Barb Atkins at Inca Tops"

MyImages[3][0] = "004.jpg"
MyImages[3][1] = "Lunch at Arequipa"

MyImages[4][0] = "005.jpg"
MyImages[4][1] = "Albert, Kirsten, Barb and Connie at Colca Canyon"

MyImages[5][0] = "006.jpg"
MyImages[5][1] = "Inca Tour 2005 at Colca Lodge"

MyImages[6][0] = "007.jpg"
MyImages[6][1] = "Mrs. Beauvais taking pictures at Alpaca cave paintings"

MyImages[7][0] = "008.jpg"
MyImages[7][1] = "Inspecting Alpacas at Pacomarca"

MyImages[8][0] = "009.jpg"
MyImages[8][1] = "Albert & Kirsten Olsen inspecting champion at Pacomarca"

MyImages[9][0] = "010.jpg"
MyImages[9][1] = "Alonso Burgos explaining sorting techniques at Pacomarca"

MyImages[10][0] = "011.jpg"
MyImages[10][1] = "Connie Beauvois with Paco-Vicuņa"

MyImages[11][0] = "012.jpg"
MyImages[11][1] = "Connie and Kirsten giving out sweets up in the Andes"

MyImages[12][0] = "013.jpg"
MyImages[12][1] = "Connie Beauvois showing kaleidoscope to Andean kids"

MyImages[13][0] = "014.jpg"
MyImages[13][1] = "Alpacas in the Andes"

MyImages[14][0] = "015.jpg"
MyImages[14][1] = "Alpacas at Bofedal"

MyImages[15][0] = "016.jpg"
MyImages[15][1] = "Alpacas in the Andes"

MyImages[16][0] = "017.jpg"
MyImages[16][1] = "A Wasi with shepherd"

MyImages[17][0] = "018.jpg"
MyImages[17][1] = "Inca Tour 2005 with Suris at Alianza"

MyImages[18][0] = "019.jpg"
MyImages[18][1] = "Albert & Kirsten Olsen and Mrs. Beauvois at Pacomarca"

MyImages[19][0] = "020.jpg"
MyImages[19][1] = "Ted Atkins, Kirstan Olsen and Connie Beauvois inspecting sweater production at Incalpaca TPX"

MyImages[20][0] = "021.jpg"
MyImages[20][1] = "Inca Tour 1005 participants and Alonso Burgos during Vicuņa sorting at Incalpaca TPX"

MyImages[21][0] = "022.jpg"
MyImages[21][1] = "Inspecting Alpacas at a small brederīs ranch"

MyImages[22][0] = "023.jpg"
MyImages[22][1] = "Kirsten Olson sharing out sweets among children at 14,000 feet"

MyImages[23][0] = "024.jpg"
MyImages[23][1] = "Albert, Kirsten, Connie and Barb with Alpaca herdsman up in the Andes"

function showImage(index)
{
	document.getElementById('placeholder').src = ImageDir + MyImages[index][0].substr(3,10); 	
	document.getElementById('desc').childNodes[0].nodeValue = MyImages[index][1];
	window.location = "#placeholder";
	MyImageIndex = index;
}
function NextImage()
{
	if(document.getElementById)
	{
		if(++MyImageIndex == (end +1))
		{
			MyImageIndex=ini;
		}
		//document.getElementById('placeholder').src = ImageDir + MyImages[MyImageIndex][0].substring(3,10);
		showImage(MyImageIndex);
	}
}
function PreviusImage()
{
	if(document.getElementById)
	{
		if(--MyImageIndex == ini -1)
		{
			MyImageIndex=end;
		}
		//document.getElementById('placeholder').src = ImageDir + MyImages[MyImageIndex][0].substring(3,10);
		showImage(MyImageIndex);
	}
}

function CreateThumbs()
{
	document.write("<TABLE width='99%' border='0' cellspacing='0' cellpadding='0'>"	);
	document.write("<TR><TD width='150'>&nbsp;</TD><td width='128'>&nbsp;</td><td width='150'>&nbsp;</td><td width='154'>&nbsp;</td></TR>");

	for(var i=ini;i<=end;i++)
	{
		document.write("<TR>");
		document.write("<td width='150' height='112' bgcolor='#B4C2A5'><a href=javascript:popImage('"+ ImageDir+ MyImages[i][0] +"','')><img src=" + ImageDir + "small/" + MyImages[i][0] + " border='0' class='image_main' name='img_" + i + "' hspace='5' vspace='5'></a></td>");
		document.write("<td class='text_thumbs'><p id='txt_"+ i + "'>" +  MyImages[i][1] + "<p></td>");
		++i;
		if(i<=end)
		{
			document.write("<td width='150' height='112' bgcolor='#B4C2A5'><a href=javascript:popImage('" + ImageDir+ MyImages[i][0] + "','')><img src=" + ImageDir + "small/" + MyImages[i][0] + " border='0' class='image_main' name='img_" + i + "' hspace='5' vspace='5'></a></td>")
			document.write("<td class='text_thumbs'><p id='txt_"+ i + "'>" +  MyImages[i][1] + "<p></td>");
			document.write("</TR>")
			document.write("<TR><TD width='150'>&nbsp;</TD><td width='128'>&nbsp;</td><td width='150'>&nbsp;</td><td width='154'>&nbsp;</td></TR>");
		}
	}
	document.write("</TABLE>");

}
function MultiDimensionalArray(iRows,iCols) 
{ 
var i; 
var j; 
   var a = new Array(iRows); 
   for (i=0; i < iRows; i++) 
   { 
       a[i] = new Array(iCols); 
       //for (j=0; j < iCols; j++) 
       //{ 
       //    a[i][j] = ""; 
       //} 
   } 
   return(a); 
}

function AutoPlay()
{
	if(lock==false)
	{
		lock=true;	
		document.images['b_auto'].src="galeria_fotografica/navegar/stop.jpg";
		id_interval = setInterval("NextImage()",3600);
	}
	else
	{
		lock=false;	
		window.clearInterval(id_interval);
		document.images['b_auto'].src="galeria_fotografica/navegar/auto.jpg";
	}
}
