// JavaScript Document
function anchoPagina() {
  var ancho = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //No-IE
    ancho = window.innerWidth;
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //IE 6+ 'standards compliant mode'
    ancho = document.documentElement.clientWidth;
  } else if( document.body && document.body.clientWidth ) {
    //IE 4
    ancho = document.body.clientWidth;
  }
  
  return ancho;
}

function mostrarImagen(archivo){	
	vista = document.getElementById('vistafoto');
	vista.innerHTML= "<img id=\"foto\" src=\""+ archivo +"\" onClick=\"cerrar();\" onLoad=\"posicionarImagen(this)\">";
}

function posicionarImagen(imagen){
	if(window.pageYOffset){
		despl_top = (window.pageYOffset + 10) +"px";
	}else{
		despl_top = (document.documentElement.scrollTop + 10) +"px";
	}	
	vista = document.getElementById('vistafoto');
	vista.style.top= despl_top;
	vista.style.left = Math.floor((anchoPagina()-imagen.width)/2) +"px";
	//vista.style.left= Math.floor((anchoPagina()-780)/2) +"px";
	vista.style.visibility= "visible";
}

function cerrar(){
	document.getElementById('vistafoto').style.visibility= "hidden";
}


/*function mostrarImagen(archivo){
	image_1 = new Image();
	image_1.src = archivo;
	image_1.onLoad = posicionarImagen();
	
	if(window.pageYOffset){
		despl_top = (window.pageYOffset + 10) +"px";
	}else{
		despl_top = (document.documentElement.scrollTop + 10) +"px";
	}
	
	//alert(image_1.width);
	//alert(image_1.width);
	
	vista = document.getElementById('vistafoto');
	vista.style.visibility= "visible";
	vista.style.top= despl_top;
	vista.style.left = Math.floor((anchoPagina()-image_1.width)/2) +"px";
	//vista.style.left= Math.floor((anchoPagina()-780)/2) +"px";
	vista.innerHTML= "<img id=\"foto\" src=\""+ archivo +"\" onClick=\"cerrar();\">";
}*/
