// JavaScript Document

var actual1 = 0;
var actual2 = 0;

var actualsub1 = 0;
var actualsub2 = 0;


function submenu1(num)
{
	sbmnu = document.getElementById("submenu" + num);

	if ((actual1 > 0) && (actual1 != num)) document.getElementById("submenu" + actual1).style.display = "none";
	if (sbmnu.style.display == "block") {  sbmnu.style.display = "none"; }
	else { sbmnu.style.display = "block";}
	actual1 = num;
}
function submenu2(num)
{
	sbmnu = document.getElementById("submenu" + num);
	imagen = document.getElementById("imagen" + num);

	if ((actual2 > 0) && (actual2 != num))
	{
		document.getElementById("submenu" + actual2).style.display = "none";
		document.getElementById("imagen" + actual2).src = "/graficos/mas.gif";
	}
	if (sbmnu.style.display == "block")
	{
		sbmnu.style.display = "none";
		imagen.src = "/graficos/mas.gif";
	}
	else
	{
		sbmnu.style.display = "block";
		imagen.src= "/graficos/menos.gif";
	}
	actual2 = num;
}





function subsubmenu1(num)
{
	sbmnu = document.getElementById("subsubmenu" + num);

	if ((actualsub1 > 0) && (actualsub1 != num)) document.getElementById("subsubmenu" + actualsub1).style.display = "none";
	if (sbmnu.style.display == "block") {  sbmnu.style.display = "none"; }
	else { sbmnu.style.display = "block";}
	actualsub1 = num;
}
function subsubmenu2(num)
{
	sbmnu = document.getElementById("subsubmenu" + num);
	imagen = document.getElementById("imagensub" + num);

	if ((actualsub2 > 0) && (actualsub2 != num))
	{
		document.getElementById("subsubmenu" + actualsub2).style.display = "none";
		document.getElementById("imagensub" + actualsub2).src = "/graficos/mas.gif";
	}
	if (sbmnu.style.display == "block")
	{
		sbmnu.style.display = "none";
		imagen.src = "/graficos/mas.gif";
	}
	else
	{
		sbmnu.style.display = "block";
		imagen.src= "/graficos/menos.gif";
	}
	actualsub2 = num;
}




var imgs = new Array();
var ancho = 0;
var alto = 0;
var anchofinal = 400;

function centrarcapa(capa)
{
	var interfaz = document.getElementById(capa).style;
	var anchoventana = 0; 
	var altoventana = 0; 
	
	if (typeof(window.innerHeight) == 'number')
	{
		altoventana = parseInt(window.innerHeight);
		anchoventana = parseInt(window.innerWidth);
	}
	else if (document.body && document.body.clientHeight)
	{
		altoventana = parseInt(document.body.clientHeight);
		anchoventana = parseInt(document.body.clientWidth);
	}
	x = (anchoventana - parseInt(interfaz.width)) / 2;
	if (x < 0) x = 0;
	y = (altoventana - parseInt(interfaz.height)) / 2;
	if (y < 0) y = 0;
	interfaz.left = x;
	interfaz.top = y;
}

function ventanapopup(enlace, nombre, w, h, l, t, centrado, parametros)
{
	if (centrado)
	{
		l = (screen.width - w) / 2;
		t = (screen.height - h) / 2;
	}
	if (parametros.length == 0) parametros = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no";
	parametros = "width=" + w + "px,height=" + h + "px,left=" + l + "px,top=" + t + "px," + parametros;
	ventana = window.open(enlace, nombre, parametros);
	ventana.moveTo(l, t);
	ventana.focus();
}

var croquis_imagen = new Image();
var croquis_num = 1;

function croquis_cargar(titulo, ubicacion, modelo, num)
{
	if (croquis_imagen.complete == true)
	{
		w = croquis_imagen.width + 50;
		if (num > 1) h = croquis_imagen.height + 80 + 50;
		else h = croquis_imagen.height + 80;
		l = (screen.width - w) / 2;
		t = (screen.height - h) / 2;
		parametros = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes";
		parametros = "width=" + w + "px,height=" + h + "px,left=" + l + "px,top=" + t + "px," + parametros;
		ventana = window.open("http://www.artwellness.com/es/croquis.php?titulo=" + titulo + "&ubicacion=" + ubicacion + "&modelo=" + modelo + "&num=" + num, "croquis", parametros);
		ventana.moveTo(l, t);
		ventana.focus();
	}
	else
	{
		setTimeout("croquis_cargar('" + titulo + "', '" + ubicacion + "', '" + modelo + "', " + num + ")", 1);
	}
}

function croquis_popup(titulo, ubicacion, modelo, num)
{
	if (num > 1) croquis_imagen.src = "/imagenes/" + ubicacion + "/" + modelo + "1.gif";
	else croquis_imagen.src = "/imagenes/" + ubicacion + "/" + modelo + ".gif";
	croquis_num = 1;	
	croquis_cargar(titulo, ubicacion, modelo, num);
}

function croquisatras(ubicacion, modelo, num)
{
	if (croquis_num > 0) croquis_num--;
	document.getElementById("croquis").src = "../imagenes/" + ubicacion + "/" + modelo + croquis_num + ".gif";
	document.getElementById("croquisinfo").innerHTML = croquis_num + " de " + num + " im&aacute;genes";
}

function croquisadelante(ubicacion, modelo, num)
{
	if (croquis_num < num) croquis_num++;
	document.getElementById("croquis").src = "../imagenes/" + ubicacion + "/" + modelo + croquis_num + ".gif";
	document.getElementById("croquisinfo").innerHTML = croquis_num + " de " + num + " im&aacute;genes";
}

function changesize()
{
	var i = new Image();
	
	i.src = "../imagenes/" + tipofoto + c + ".jpg";
	if (i.width > 400) 
	{
		ancho = anchofinal;
		alto = (ancho * i.height) / i.width;
	}
	else
	{
		ancho = i.width;
		alto = i.height;
	}	
}

function viscapa(ncapa, capas)
{
	if (ncapa <= capas && ncapa > 0)
	{
		for (i = 1; i <= capas; i++)
		{
			capa = document.getElementById("esquemacapa" + i);
			td = document.getElementById("esquematd" + i);
			if (i != ncapa)
			{
				capa.style.display = "none";
				td.className = "categoriae";
			}
			else
			{
				capa.style.display = "block";
				td.className = "categoria";
			}
		}
	}
}

function initScrollLayer()
{
	try
	{
		var wndo = new dw_scrollObj("wn", "lyr1", "t1");
		dw_scrollObj.GeckoTableBugFix("wn"); 
	}
	catch(e)
	{

	}
}

function cargarimagen(nombre)
{
	document.getElementById("imagenpresentacion").src = nombre;	
}

function cargarimagen2(nombre, grande, texto)
{
	document.getElementById("imagenpresentacion1").src = nombre;
	document.getElementById("imagenpresentacion2").src = nombre;
	document.getElementById("imagenpresentacion_texto").innerHTML = texto;
	if (grande)
	{
		document.getElementById("imagenpresentacion_a").href = grande;
		document.getElementById("div_imagenpresentacion1").style.display = "block";
		document.getElementById("div_imagenpresentacion2").style.display = "none";
	}
	else
	{
		document.getElementById("imagenpresentacion_a").href = nombre;
		document.getElementById("div_imagenpresentacion1").style.display = "none";
		document.getElementById("div_imagenpresentacion2").style.display = "block";
	}
	document.getElementById("imagenpresentacion_a").title = texto;
}

function cargarvideo(nombre)
{
	ventana = window.open("/es/video.php?pres=" + nombre, "VideoPresentacion", "width=650px,height=514px,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");
	l = (screen.width - 650) / 2;
	t = (screen.height - 514) / 2;
	ventana.moveTo(l, t);
}

function mostrarinfopopup(nombre)
{
	document.getElementById(nombre).style.visibility = "visible";
}

function ocultarinfopopup(nombre)
{
	document.getElementById(nombre).style.visibility = 'hidden';
}

