$(document).ready(function() {
	// cycle gallery initialize
	$('#slide_0').onImagesLoaded(function(){
		//console.log('images loaded');
		$('#slideshow').fadeIn(function(){
			$('#slideshow').cycle({ 
			    fx: 'fade', 
				speed: 1000,
			    timeout: 6000,
				next: '#slideshow_next',
				prev: '#slideshow_prev',
				pause: 1
			}); // cycle()
		}); // fadeIn();
	}); // onImagesLoaded()
	
	$(function() {
		$('.lightbox_gallery .thumbs a').click(function(){
			gallery = $(this).closest('.lightbox_gallery');
			gallery.children('.main_image').children().attr('src',$(this).attr('rel'));
			//gallery.children('.main_image').attr('href',$(this).attr('rel'));
		});
	});
	
	$('.lightbox_gallery .thumbs').onImagesLoaded(function(){
		//console.log('thumbnail images loaded');
		$('.lightbox_gallery .thumbs').cycle({ 
		    fx: 'scrollLeft', 
		    speed: '300', 
		    timeout: 0,
			next: '.lightbox_gallery .next',
			prev: '.lightbox_gallery .prev'
		}); // cycle()
	}); // onImagesLoaded()
	/*
	*/
	
}); // ready();
