/**
* StickySPY Javascripts for Joomla CMS
* Requires Prototype framework and Scriptaculous libraries
*/


// Check for Browser version
var Browser = {
Version: function() {
	var version = 999; // we assume a sane browser
	if (navigator.appVersion.indexOf("MSIE") != -1)
	// bah, IE again, lets downgrade version number
		version = parseFloat(navigator.appVersion.split("MSIE")[1]);
		return version;
	}
}

// Hide DIV
function HideContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "none";
}

// Show DIV
function ShowContent(d) {
	if(d.length < 1) { return; }
	document.getElementById(d).style.display = "block";
}

// Reverse Display of DIV
function ReverseContentDisplay(d) {
	if(d.length < 1) { return; }
	if(document.getElementById(d).style.display == "none") { 
		document.getElementById(d).style.display = "block";
	} else {
		document.getElementById(d).style.display = "none";
	}
}



// Cross fade DIV. Need following on page level to create looping slideshow
/**
* define counter as global variable
* function startSlideshow() { counter = SlideShow(array,counter); }
* setInterval("startSlideshow()", wait);
*/
function SlideShow(this_array,counter) {
	if (Browser.Version() == 999) {
		new Effect.Fade(this_array[counter], { duration:1, from:1.0, to:0.0 });
		counter++; if (counter == this_array.length) counter = 0;
		new Effect.Appear(this_array[counter], { duration:1, from:0.0, to:1.0 });
		return counter;
	} else {
		HideContent(this_array[counter]); counter++;
		if (counter == this_array.length) counter = 0;
		ShowContent(this_array[counter]); return counter;
	}
}