var $j = jQuery.noConflict();

$j(function(){

    $j(".thumbs img").click(function() {

	// see if same thumb is being clicked
	if ($j(this).hasClass("active")) { return; }

	// calclulate large image's URL based on the thumbnail URL
	var url = $j(this).attr("src").replace("_t", "");
	
	// get handle to element that wraps the image
	var wrap = $j("#mainimage");

	// the large image
	var img = new Image();

	// call this function after it's loaded
	img.onload = function() {

		// change the image
		wrap.find("img").attr("src", url);

	};

	img.src = url;

	// activate item
	$j(".thumbs img").removeClass("active");
	$j(this).addClass("active");


}).filter(":first").click();

});
