﻿

var img_src_grande = new Array();
var img_src = new Array();
var nmtitulo = new Array();
var index = 0;
var max_foto = 2;

var SlideShowSpeed = 5000;
var CrossFadeDuration = 3;
var tss;
var iss;
var preLoad = new Array();
var preLoadTitulo = new Array();
var stop = false;

function initSlideShow()
{
    for (iss = 0; iss < img_src.length; iss++)
    {    
	    preLoad[iss] = new Image();
	    preLoad[iss].src = img_src[iss];
    }
    runSlideShow();
}

function runSlideShow()
{			                    	
	if(!stop)
	{	
	    img = document.getElementById('img_produto');
    	
	    imglink = document.getElementById('img_link');

	    titulo = document.getElementById('titulo');
    		
	    if (document.all)
	    {
		    img.style.filter="blendTrans(duration=2)";
		    img.style.filter="blendTrans(duration=CrossFadeDuration)";
		    img.filters.blendTrans.Apply();
	    }
	    img.src = preLoad[index].src;
	    imglink.href = img_src_grande[index];
	    titulo.innerHTML = nmtitulo[index];
    	
	    //if (document.getElementById)
		    //document.getElementById("CaptionBox").innerHTML= Caption[jss];
	    if (document.all)
		    img.filters.blendTrans.Play();
    	
	    index = index + 1;
	    if (index > (img_src.length-1)) index = 0;    		    
	}
	tss = setTimeout('runSlideShow()', SlideShowSpeed);
}

function foto(i)
{
	stop = true;
	
	index = index + i;
	
	if(index < 0)
		index = img_src.length - 1;
		
	if(index  >= img_src.length)
		index = 0;	
		
	document.getElementById('img_produto').src = img_src[index];
	document.getElementById('img_link').href = img_src_grande[index];
    document.getElementById('titulo').innerHTML = nmtitulo[index];
	stop = false;
		
	//alert(img_src[index]);
}





