var imgCounter=0;
var imgCounterVenda=3;
var serverLocation = 'http://194.8.30.191:8080/186/Definarea/';
var slideShowSpeed = 5000
var preLoad = new Array();
var intObject=0;

/*
function initSlideShowArrendamento() {
  var imgIndex; 
  for(imgIndex=0; imgIndex<arImagem.length; imgIndex++) {
    preLoad[imgIndex] = new Image()
    preLoad[imgIndex].src = serverLocation + arImagem[imgIndex]
  }
  runSlideShowArrendamento();
}
function runSlideShowArrendamento() {
  if(document.all) {
  	document.images.slideImage.style.filter="blendTrans(duration=2)"
    document.images.slideImage.style.filter="blendTrans(duration=crossFadeDuration)"
    document.images.slideImage.filters.blendTrans.Apply()
  }
  document.images.slideImage.src = preLoad[imgCounter].src
  document.all.lbReferencia.innerText = arReferencia[imgCounter];
  document.all.lbTipoImovel.innerText = arTipo[imgCounter];
  document.all.lbTipologia.innerText = arTipologia[imgCounter];
  document.all.lbConcelho.innerText = arConcelho[imgCounter];
  document.all.lbFreguesia.innerText = arFreguesia[imgCounter];
  document.all.lbPreco.innerText = arPreco[imgCounter];
  document.all.hlImagem.href = "Imovel.aspx?ID="+arHyperlink[imgCounter];
  if (document.all){
    document.images.slideImage.filters.blendTrans.Play()
  }
  imgCounter++;
  if(imgCounter > (arImagem.length-1)) imgCounter=0
  setTimeout('runSlideShowArrendamento()', slideShowSpeed)
}
*/
function initSlideShowVenda() {
  var imgIndex; 
  for(imgIndex=0; imgIndex<arImagem.length; imgIndex++) {
    preLoad[imgIndex] = new Image()
    preLoad[imgIndex].src = serverLocation + arImagem[imgIndex]
  }
  setTimeout('runSlideShowVenda();', slideShowSpeed)
}
function runSlideShowVenda() {
  if(document.all) {
	document.getElementById("slideImage"+intObject).style.filter="blendTrans(duration=2)"
	document.getElementById("slideImage"+intObject).style.filter="blendTrans(duration=crossFadeDuration)"
	document.getElementById("slideImage"+intObject).filters.blendTrans.Apply()
  }
  document.getElementById("slideImage"+intObject).src = preLoad[imgCounterVenda].src
  document.getElementById("lbReferencia"+intObject).innerText = arReferencia[imgCounterVenda];
  document.getElementById("lbTipoImovel"+intObject).innerText = arTipo[imgCounterVenda];
  
  var strTipologia = "";
  if (arTipologia[imgCounterVenda] != "ST") strTipologia = " - " + arTipologia[imgCounterVenda];
  
  document.getElementById("lbTipologia"+intObject).innerText = arTipologia[imgCounterVenda];
  document.getElementById("lbConcelho"+intObject).innerText = arConcelho[imgCounterVenda];
  document.getElementById("lbFreguesia"+intObject).innerText = arFreguesia[imgCounterVenda];

  var strPreco = "";
  if (parseFloat(arPreco[imgCounterVenda]) > 0) strPreco = arPreco[imgCounterVenda] + " €";
  
  document.getElementById("lbPreco"+intObject).innerText = arPreco[imgCounterVenda];
  document.getElementById("hlImagem"+intObject).href = "Imovel.aspx?ID="+arHyperlink[imgCounterVenda];

  var strTooltip = arTipo[imgCounterVenda];
  if (arTipologia[imgCounterVenda] != "ST") strTooltip += " " + arTipologia[imgCounterVenda];
  strTooltip += ", Ref. " + arReferencia[imgCounterVenda];
  document.getElementById("hlImagem" + intObject).title = strTooltip;
 
 
 
 
  if (document.all){
    document.getElementById("slideImage"+intObject).filters.blendTrans.Play()
  }
  imgCounterVenda++;
  intObject++;
  if(imgCounterVenda > (arImagem.length-1)) imgCounterVenda=0;
  if(intObject == 3) intObject=0;
  setTimeout('runSlideShowVenda()', slideShowSpeed)
}
