este es el codigo:
Código PHP:
var temporal=0;
var dir="/vp/imagenes/";
function aleatorio(){
var numPosibilidades = img_vp.length-1;
var aleat = Math.random() * numPosibilidades
aleat = Math.round(aleat)
return aleat;
};
var tmp_img_g=new Image();
var tmp_img_id;
var guia=0;
var guia_str;
function aver(f){
window["guia"]++;
document.getElementById("ver").innerHTML="<font color=\"#FFFFFF\"><b>"+f+" "+window["guia"]+"</b></font>";
};
function chk_img(){
var tmp_img=new Image();
tmp_img=window["tmp_img_g"];
if(tmp_img.complete){
clearTimeout(window["tmp_img_id"]);
document.getElementById('fotelis').style.backgroundImage="url("+tmp_img.src+");";
//document.getElementById("foteli").style.display="";
}else
window["tmp_img_id"]=setTimeout("chk_img();",100);
};
function pone(tt){
document.getElementById("ver").innerHTML=tt;
tt=window["dir"]+tt;
var tmp_img=new Image();
document.getElementById('fotelis').style.backgroundImage="url(cargando.gif)";
//document.getElementById("foteli").style.display="none";
tmp_img.src=tt;
window["tmp_img_g"]=tmp_img;
chk_img();
return;
};
function ini(){
var v=aleatorio();
pone(img_vp[v]);
};
function cambiaf(b){
window["guia"]=0;
if(b==1){
if((window["temporal"]+1)==window["img_cant"]){
window["temporal"]=0;
}
else{
window["temporal"]++;
}
}
else{
if((window["temporal"]-1)<0){
window["temporal"]=(window["img_cant"]-1);
}
else{
window["temporal"]--;
}
}
var u=window["temporal"];
pone(img_vp[u]);
};
window.onload=ini;