//function pasar_valores(img,img_small,n){
function pasar_valores(img,tit){

/*
tit=document.getElementById('titulo-'+n).value;
com=document.getElementById('comentario-'+n).value;
fecha=document.getElementById('fecha-'+n).value;
tit=escape(tit);
com=escape(com);
fecha=escape(fecha);
*/

img=img;
//img_small=img_small;

//visor_grafica(img,img_small,tit,com,fecha)

tit=escape(tit);
visor_grafica(img,tit)
}

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

//function visor_grafica(i,i2,t,c,f){
function visor_grafica(i,t){

imagen=i;
//imagen_small=i2;

tit=t;
//comentario=c;
//fecha=f;

img = new Image();
img.src = imagen;

//img_small = new Image();
//img_small.src = imagen_small;

checkImg_b();

}

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function checkImg_b(){





if(img.complete){

alto=img.height;
ancho=img.width;
//alert(alto+"+"+ancho);

/*
condicion=255
if(alto<ancho){
//ancho_2=(condicion)*1
ancho_2=condicion
alto_2=alto*condicion/ancho
}
condicion=215
if(alto>ancho){
alto_2=condicion
ancho_2=ancho*condicion/alto
}
*/

/*
condicion=120
alto_2=condicion;
ancho_2=ancho*condicion/alto
*/

alto_2=alto;
ancho_2=ancho;
//alert(ancho_2+"-"+alto_2);

document.getElementById('elementos_precarga').innerHTML=''

document.getElementById('visor_precarga').style.top='-9999px';
document.getElementById('visor_precarga').style.width='0%';
document.getElementById('visor_precarga').style.height='0%';
document.getElementById('visor_precarga').style.zIndex='0';

/*
document.getElementById('imagen_def').innerHTML='<a href="'+img_small.src+'" target="_blank"><img src="'+ img.src +'"width="'+ ancho_2 +'" height="'+ alto_2 +'" border="0"></a>'
*/

document.getElementById('imagen_def').innerHTML='<img src="'+ img.src +'"width="'+ ancho_2 +'" height="'+ alto_2 +'" border="0">'

document.getElementById('titulo_def').innerHTML=unescape(tit)
//document.getElementById('comentario_def').innerHTML=unescape(comentario)
//document.getElementById('fecha_def').innerHTML=unescape(fecha)

document.getElementById('visor1').style.top='0';
document.getElementById('visor1').style.width='100%';
document.getElementById('visor1').style.height='100%';
document.getElementById('visor1').style.zIndex='500';

document.getElementById('visor2').style.top='0';
document.getElementById('visor2').style.width='100%';
document.getElementById('visor2').style.height='100%';
document.getElementById('visor2').style.zIndex='500';

this.opacitytimer=setInterval('sergio2()',25);
}





else{
document.getElementById('visor1').style.top='0';
document.getElementById('visor1').style.width='100%';
document.getElementById('visor1').style.height='100%';
document.getElementById('visor1').style.zIndex='500';

document.getElementById('visor_precarga').style.top='0';
document.getElementById('visor_precarga').style.width='100%';
document.getElementById('visor_precarga').style.height='100%';
document.getElementById('visor_precarga').style.zIndex='500';

document.getElementById('elementos_precarga').innerHTML='<img src="../img/logo_samyl_cargando.png" width="190" height="70" class="cargando_datos"> <br><br> <b>Cargando ...</b>'
setTimeout('checkImg_b()',1000);
}





}

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

function cerrar(){
document.getElementById('visor1').style.top='-9999px';
document.getElementById('visor1').style.width='0%';
document.getElementById('visor1').style.height='0%';
document.getElementById('visor1').style.zIndex='0';

document.getElementById('visor2').style.top='-9999px';
document.getElementById('visor2').style.width='0%';
document.getElementById('visor2').style.height='0%';
document.getElementById('visor2').style.zIndex='0';

document.getElementById('imagen_def').innerHTML='';
//document.getElementById('comentario_def').innerHTML='';

sergio2()
}

///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////

var ELM = (document.getElementById);
var IE5 = ((ELM) && (navigator.userAgent.toLowerCase().indexOf('msie')!=-1) && (! window.opera));
var GKO = (navigator.userAgent.toLowerCase().indexOf('gecko')!=-1);
var contador=0;

function sergio2(){
if (GKO) document.getElementById('visor2').style.MozOpacity = .5*(contador);
if (IE5) document.getElementById('visor2').style.filter="alpha(opacity=" + (50*(contador)) + ")";
contador+=0.5;

if(contador<2){
contador=contador;
}//if

if(contador>2){
clearInterval(this.opacitytimer);
contador=0;
}

}
