var ssImageDuration;
var ssFadeDuration  = 2;
var sst;
var ssj = 0;
var ssp = 0;
var sspreLoad = new Array();
var allCached = false;
var firstTime = false;

function runSlideShow(){
  if ( ssp>0 ) {
    if (firstTime==false){
      sst = setTimeout('runSlideShow()', 1000);
      firstTime = true;
      ImageDuration = 4000;
    } else {
      if (document.all){
//  alert();
        document.images.SlideShow.style.filter="blendTrans(duration=FadeDuration)";
        document.images.SlideShow.filters.blendTrans.Apply();
      }
      document.images.SlideShow.src = sspreLoad[ssj].src;
      if (document.all){
        document.images.SlideShow.filters.blendTrans.Play();
      }
      ssj = ssj + 1;
      if (ssj > (ssp-1)) {
        ssj=0;
        allCached = true;
      }
      if (allCached==false) {
        sspreLoad[ssj].src = Pic[ssj];
      }
      sst = setTimeout('runSlideShow()', ImageDuration)
      ImageDuration = 4000;
    }
  }
}
function switchImage(parElID, parImgSrc){
  var obj = document.getElementById(parElID);
  if (obj!=undefined){
    obj.src = parImgSrc;
  }
}
function switchHomeImage(parImg,parTLR) {
  switchImage("SlideShow","/cmdata/images/" + parImg);
  ssj = parTLR;
  if (ssj > (ssp-1)) {
    ssj=0;
  }
  clearTimeout(sst);
  sst = setTimeout('runSlideShow()', 5000)
}
function showThumb(parElID) {
  var obj = document.getElementById(parElID);
  if (obj!=undefined){
//    obj.style.visibility = "visible";
    obj.style.display = "inline";
	}
}
function hideThumb(parElID) {
  var obj = document.getElementById(parElID);
  if (obj!=undefined){
//    obj.style.visibility = "hidden";
    obj.style.display = "none";
  }
}

function showBlowup(parElID,parImg,parA,parSource,parTitle) {
  var obj = document.getElementById(parElID);
  var i = document.getElementById(parElID+"Img");
  var a = document.getElementById(parElID+"A");
  if (obj!=undefined){
	  if (i!=undefined && parImg != undefined){
			i.src = parImg;
			i.alt = parTitle;
		}
	  if (a!=undefined && parA != undefined){
			a.href = parA;
			a.title = parTitle;
		}
		if ( parSource != undefined ) {
			var source = document.getElementById(parSource);
			var x, y;
			if ( parElID=='colorPopup' ) {
				x = -39; //-39;
				y = -100; //-39;
			}
			if ( parElID=='collectiePopup' ) {
				x = -25;
				y = -25;
			}
			obj.style.top = source.offsetTop + y + "px"; //
			obj.style.left = source.offsetLeft + x + "px"; //
} else {
//	alert(parSource);
		}
    obj.style.display = "inline";
	}
}
function hideBlowup(parElID,parImg) {
  var obj = document.getElementById(parElID);
  var i = document.getElementById(parElID+"Img");
  if (obj!=undefined){
    obj.style.display = "none";
  }
	if (i!=undefined && parImg != undefined){
		i.src = parImg;
	}
}
