function setup_slide(img){
	if(typeof(img) == 'undefined')
		return false;
    var image = $("<img/>").css('display', 'none').attr('src', thumb_path(img)).attr('border', 0).attr('width', 10).attr('height', 10);
    $("<a/>")
    .css('display', 'block')
    .css('cursor', 'pointer')
    .css('margin-bottom', '4px')
    .html(image)
    .click(function(){ big.attr('src', slide_path(img))})
    .appendTo(thumbs);
    
    image.animate({opacity: "0.1"}, 1200)
    .animate({opacity: 1.0, top: "0", left: "0", height: '84', width: "94"}, "slow");                
}

function thumb_path(img) {
  return 'images/thumbs/' + img;
}

function slide_path(img) {
  return 'images/slides/' + img;
}

function load_slides(atag, img1, img2, img3, img4){
	big = $('#rollimg');
	thumbs = $('.thumbs');
	// Highlight the currently selected link
	$('a.current').removeClass('current');
	$(atag).addClass('current');
	// For the Cufon font library
	if(typeof(Cufon) != 'undefined') Cufon.refresh('.items');
	
    // Clear out the previous images.
    thumbs.html('');
	big.removeAttr('src');
	
    // Add each of the thumbs w/ their links to slides
    setup_slide(img1);
    setup_slide(img2);
    setup_slide(img3);    
    setup_slide(img4);

    big.attr('src', slide_path(img1)).hide()
    .animate({opacity: "0.1"}, 1200)
    .animate({opacity: "1", top: "0", left: "0", height: '346', width: "390"}, "slow");
    
    return false;
}

