
var myPhoto = new Array(
"imagenes/background_vinos_4.png",
"imagenes/background_vinos.png",
"imagenes/background_vinos_2.png",
"imagenes/background_vinos_3.png");

var thisPhoto = 0;

var slideShowSpeed = 9000; 

var t;
var jc = 0;
var p = myPhoto.length;

function runSlideShow(){
	opacityFade()
	thisPhoto++;
	if (thisPhoto == myPhoto.length) {
		thisPhoto = 0;
	}
    document.getElementById('contenedor_animacion_fondo').style.background = "url("+myPhoto[thisPhoto]+") no-repeat fixed center #000000";
	opacityShow()
    jc = jc + 1
    if (jc > (p-1)) jc=0
    t = setTimeout('runSlideShow()', slideShowSpeed)
}
function opacityFade() {
	timer2 = 9000;
	for(i = 100; i >= 0; i--) {
		setTimeout("changeOpac(" + i + ")",(timer2));
		timer2=timer2+2;
	}
}
function opacityShow() {
	timer = 9000;
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ")",(timer));
		timer=timer+2;
	}
}

function changeOpac(opacity) {
	var object = document.getElementById('contenedor_animacion_fondo').style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

