function fleft(offset) {
	current_img_idx += offset;
	fsee_normal_image(current_img_idx < 0 ? archivos.length - 1 : current_img_idx);
}

function fright(offset) {
	current_img_idx += offset;
	fsee_normal_image(current_img_idx >= archivos.length ? 0 : current_img_idx);
}

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

function getInnerWH() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  	//IE 6+ in 'standards compliant mode'
  	myWidth = document.documentElement.clientWidth;
  	myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  	//IE 4 compatible
  	myWidth = document.body.clientWidth;
  	myHeight = document.body.clientHeight;
  }
  return [ myWidth, myHeight ];
}

function fsee_normal_image(idx) {
	if (pantalla && imagen && idx >= 0 && idx < archivos.length) {
		current_img_idx = idx;
		var offset = getScrollXY();
		var inner = getInnerWH();
		pantalla.style.top = offset[1] + 'px';
		pantalla.style.left = '0px';
		pantalla.style.width = inner[0] + 'px';
		pantalla.style.height = inner[1] + 'px';
		var nodo = imagen.getElementsByTagName('td')[0];
// 		var titulo = document.createTextNode(titulos[idx]);
// 		nodo.replaceChild(titulo, nodo.firstChild);
		nodo.innerHTML = titulos[idx];
		img = imagen.getElementsByTagName('img')[1];
		img.src = preurl + archivos[idx];
		var anc = anchos[idx] + add_x;
		var alt = altos[idx] + add_y;
		imagen.style.width = anc + 'px';
		imagen.style.height = alt + 'px';
		imagen.style.left = ((inner[0] - anc) / 2) + 'px';
		imagen.style.top = ((inner[1] - alt) / 2) + 'px';
	} else {
		alert('Ocurrió un error.');
	}
}

function frestore() {
	if (pantalla && imagen) {
		imagen.style.top = pantalla.style.top = imagen.style.left = pantalla.style.left = '-500px';
		imagen.style.width = pantalla.style.width = imagen.style.height = pantalla.style.height = '450px';
	}
}
