$(document).ready(function() {
	cycleBanners();
	setLightbox();
	setTagcloud();
});

// Cycle Banners
function cycleBanners() {	
	

	$(".module_banner").each(function(index) {
		$(this).show();
		var id = "#" + $(this).attr("id");
		var speed = $(this).attr("speed") * 1000;
		$(id).cycle({
			fx: 'fade',
			timeout: speed,
			pause: 1
		});
	});
}

// Set photo lightbox
function setLightbox() {	
	$('[rel=gallery]').lightBox({
		fixedNavigation:true
	});
}

// Set tagcloud
function setTagcloud() {
	
	$("#tagcloud").css("display","none");

	// Format tags
	var tags = "<tags>" + $("#tagcloud").html().toLowerCase() + "</tags>";	
	tags = tags.replace(new RegExp("\\n","g"), "");
	tags = tags.replace(new RegExp("\\t","g"), "");
	tags = tags.replace(new RegExp("sstyle","g"), "style");
	tags = tags.replace(new RegExp("\"","g"), "'");

	var so = new SWFObject("/javascript/tagcloud.swf", "tagcloud", "180", "180", "7", "#ffffff");
	// uncomment next line to enable transparency
	//so.addParam("wmode", "transparent");
	so.addVariable("tcolor", "0x0000CC");
	so.addVariable("mode", "tags");
	so.addVariable("distr", "true");
	so.addVariable("tspeed", "100");
	so.addVariable("tagcloud", tags);
	so.write("flashcontent");
}
