// JavaScript Document

//==SlideShow========================================================================================
	var tss;					// Store the timer
	var jss = 0;				// Used for slideshow loop in pictures
	var kss = 0;				// Used for slideshow loop in links
	var lss = 0;				// Links length
	var pss = 0;				// Pictures length
	var slideShowSpeed = 0;		// Set the slideshow speed (in milliseconds)
	var crossFadeDuration = 0;	// Set the duration of crossfade (in seconds)
	var preLoad = new Array();	// Store all images
	var links = new Array();	// Store all links

	function prepareSlideShow(){
		var iss = 0;
		var qtdes = document.getElementById("hdnQtdeDestaques").value;
		var qtdesLinks = document.getElementById("hdnQtdeLinks").value;
		this.slideShowSpeed = document.getElementById("slideShowSpeed").value;
		this.crossFadeDuration = document.getElementById("crossFadeDuration").value;

		var picture = new Array(); // don't change this

		picture[0] = "";
		for (var i = 1; i <= qtdes; i++) picture[i] = document.getElementById("hdnDestaques_"+i).value;
		this.links[0] = "&nbsp;";
		this.links[1] = "&nbsp;";
		for (var i = 1; i <= qtdesLinks; i++) this.links[i] = document.getElementById("hdnLinks_"+i).value;

		//pictures
		this.jss = 1;
		this.pss = picture.length - 1;
		//links
		this.kss = 1;
		this.lss = this.links.length - 1;

		for (iss = 1; iss <= this.pss; iss++){
//			alert(this.picture[iss]);
			this.preLoad[iss] = new Image();
			this.preLoad[iss].src = picture[iss];
		}
	}

	function runSlideShow(){
		if (document.all){
			with(document.getElementById("pictureBox")){
				style.filter = "blendTrans(duration=2)";
				style.filter = "blendTrans(duration=this.crossFadeDuration)";
				filters.blendTrans.Apply();
			}
		}

		document.getElementById("pictureBox").src = this.preLoad[jss].src;

		if (document.getElementById) document.getElementById("tdLinks").innerHTML = this.links[kss];
		if (document.all) document.getElementById("pictureBox").filters.blendTrans.Play();

		jss++;
		kss++;

		if (jss > (pss)) jss = 1;
		if (kss > (lss)) kss = 1;

		this.tss = setTimeout('runSlideShow()', slideShowSpeed);
	}
//==SlideShow========================================================================================
