var Pic = new Array();
var pie = new Array();
pie[0] = 'Piede foto 1'
Pic[0] = 'imgs18/fotoDefault.jpg'
var speed = 4000
var t
var j = 0
var p = Pic.length
var V=100;
var timerID = 0;  

var preLoad = new Array()

for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}


function Opacidad()
{
switch (V)
  {
  case 100:
    sentido = -1;
    break;
  case 0:
    sentido = 1;
  }
V+=sentido;	 //segun sea el sentido aumenta o disminuye el valor

window.document.getElementById('VU').style.filter = "alpha(opacity: " + V + ")";
window.document.getElementById('VU').style.MozOpacity=V/50.0;
timerID=setTimeout("Opacidad()",20);
}


function runSlideShow(opc,cargaHome){

if(cargaHome == "-1" || cargaHome == "2" ){
	if(opc=="on"){
	
	   document.images.SlideShow.src = preLoad[j].src
		document.getElementById('pie_de_foto').innerHTML =pie[j];
	   j = j + 1
	   if (j > (p-1)) j=0
	  
//	  Opacidad()
	  t = setTimeout('runSlideShow("on",'+cargaHome+')', speed);

	}else if(opc=="off"){
	   document.images.SlideShow.src = preLoad[j].src
	   j = j + 1
	   if (j > (p-1)) j=0
			return false;
	 }

}else{

return false;

	}
}

function mueveImage(opc){
    clearTimeout(t);

if(opc == "atras" ){
j = j -1;
	if(j<=0){
		 if(j==0){ j = preLoad.length -1 ; }
		 if(j<0) { j = preLoad.length -2 ; }
	}else{j = j -1;}

}else{
j = j -1;
j = j + 1;
}
	//j= i;
	
	setTimeout('runSlideShow("on", 2)', 0);
}



