jQuery.noConflict();
jQuery(document).ready(function($) {
	if ($('.slideshow').cycle) {
		$('.slideshow').after($('<div/>').addClass('pager'));
	    $('.slideshow').cycle({
			fx: 'fade',
			pager: '.pager'
		});
	}
});

var $j = jQuery.noConflict(); 

$j(document).ready(function() {
	$j("div.loopImgs").children().each(function() {
		var oki = false;
		var tn = this.tagName.toLowerCase();
		if (tn == 'img') {
			oki = true;
		}
		if (tn == 'a') {
			$j(this).children().each(function() {
				if (this.tagName.toLowerCase() == 'img') {
					oki = true;
				}
			});
		}
		if (oki == true) {
			$j(this).wrap("<div class=\"image\"></div>");
			loopImgsNum++;
		} else {
			$j(this).remove();
		}
	});
});

var loopImgsIndex = -1;
var loopImgsNum = 0;
var loopCounter = 0;
function loopImgsNext () {
	if (loopImgsIndex != null) {
		$j("div.loopImgs div.image:eq(" + loopImgsIndex + ")").fadeOut("slow");
	}
	loopImgsIndex++;
	if (loopImgsIndex==loopImgsNum) {
		loopCounter++;
		loopImgsIndex = 0;
	}

	$j("div.loopImgs div.image:eq(" + loopImgsIndex + ")").fadeIn("slow", function () {
		if (loopCounter <= 2) {
			setTimeout("loopImgsNext();", 3000);
		};
	});
}

$j(window).bind('load', function () {
	$j("div.loopImgs div.image").fadeOut();
	loopImgsNext();
});
