Galeria.prototype.Instalaciones = new Array();
Galeria.prototype.Entrantes = new Array();
Galeria.prototype.Pescados = new Array();
Galeria.prototype.Carnes = new Array();
Galeria.prototype.Postres = new Array();
Galeria.prototype.CategoryStr = new Array();

Galeria.prototype.Category = 0;
Galeria.prototype.Index = 0;
Galeria.prototype.menuIndex = 0;

function Galeria()
{
	this.Instalaciones[0] = "images/galeria/instalaciones/1.jpg";
	this.Instalaciones[1] = "images/galeria/instalaciones/2.jpg";
	this.Instalaciones[2] = "images/galeria/instalaciones/3.jpg";
	this.Instalaciones[3] = "images/galeria/instalaciones/4.jpg";
	this.Instalaciones[4] = "images/galeria/instalaciones/5.jpg";
	this.Instalaciones[5] = "images/galeria/instalaciones/6.jpg";
	this.Instalaciones[6] = "images/galeria/instalaciones/7.jpg";
	this.Instalaciones[7] = "images/galeria/instalaciones/8.jpg";
	this.Instalaciones[8] = "images/galeria/instalaciones/9.jpg";
	this.Instalaciones[9] = "images/galeria/instalaciones/10.jpg";
	this.Instalaciones[10] = "images/galeria/instalaciones/11.jpg";
	this.Instalaciones[11] = "images/galeria/instalaciones/12.jpg";
	this.Instalaciones[12] = "images/galeria/instalaciones/13.jpg";
	this.Instalaciones[13] = "images/galeria/instalaciones/14.jpg";
}

Galeria.prototype.setCategory = function(cat)
{
	this.Category = cat;
	this.Index = 0;
	this.menuIndex = 0;
	var cat = this.getCategory();
	
	var str = "<div id='buttons'><table height='28' border='0' cellpadding='0' cellspacing='0'><tr height='28'>";
	var len = 0;
	if (cat.length > 14) len=14;
	else len=cat.length;
	
	for (var i = 0; i < len; i++)
	{
		if (i == 0) str += "<td align='center' valign='middle' bgcolor='#717949' width='28'><div id='button"+(i+1)+"'><a href='javascript:setPhoto("+i+");' style='text-decoration:none'><font class='v10wb'>"+(i+1)+"</font></a></div></td>";
		else str += "<td align='center' valign='middle' bgcolor='#717949' width='28'><div id='button"+(i+1)+"'><a href='javascript:setPhoto("+i+");' style='text-decoration:none'><font class='v10yb'>"+(i+1)+"</font></a></div></td>";
		if (i != len-1) str += "<td width='4'></td>";							
	}
	str += "</tr></table></div>";
	document.getElementById('botonesGalery').innerHTML = str;
	
	var img = new Image(498,345);
	img.src = cat[this.Index];
	if (document.images)
		document.images['gphoto'].src = cat[this.Index];
	//document.getElementById('galeryPhoto').innerHTML = "<img src='"+cat[this.Index]+"' name='gphoto' width='498' height='343'>";
}

Galeria.prototype.getCategory = function()
{
	return this.Instalaciones;

}

Galeria.prototype.nextPhoto = function()
{
	var cat = this.getCategory();
	if (this.menuIndex + 14 < cat.length && cat.length > 14)
	{
		var len = 0;
		if (cat.length > 14) len=14;
		else len=cat.length;
		
		this.menuIndex ++;
		
		for (var i = 0; i < len; i++)
		{
			if (this.Index == this.menuIndex + i) document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10wb'>"+(this.menuIndex+i+1)+"</font></a>";
			else document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10yb'>"+(this.menuIndex+i+1)+"</font></a>";
		}
	}
}

Galeria.prototype.previousPhoto = function()
{
	var cat = this.getCategory();
	if (this.menuIndex > 0 && cat.length > 14)
	{
		var len = 0;
		if (cat.length > 14) len=14;
		else len=cat.length;
		
		this.menuIndex --;
		
		for (var i = 0; i < len; i++)
		{
			if (this.Index == this.menuIndex + i) document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10wb'>"+(this.menuIndex+i+1)+"</font></a>";
			else document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10yb'>"+(this.menuIndex+i+1)+"</font></a>";
		}
	}
}

Galeria.prototype.setPhoto = function(idx)
{
	var cat = this.getCategory();
	this.Index = idx;
	var len = 0;
	if (cat.length > 14) len=14;
	else len=cat.length;
	var img = new Image(498,345);
	img.src = cat[this.Index];
	if (document.images)
	{
		for (var i = 0; i < len; i++)
		{
			if (this.Index == this.menuIndex + i) document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10wb'>"+(this.menuIndex+i+1)+"</font></a>";
			else document.getElementById(("button"+(i+1))).innerHTML = "<a href='javascript:setPhoto("+(this.menuIndex+i)+");' style='text-decoration:none'><font class='v10yb'>"+(this.menuIndex+i+1)+"</font></a>";
		}
		document.images['gphoto'].src = cat[this.Index];
		//document.getElementById('galeryPhoto').innerHTML = "<img src='"+cat[this.Index]+"' name='photo' width='498' height='345'>";
	}
}
