jQuery(document).ready(function() {
	//Carousel
	$("#thumbs div").jCarouselLite({
		btnNext: "#bt_next",
		btnPrev: "#bt_prev",
		visible: 4,
		scroll: 1,
		vertical: true,
		speed: 200,
		circular: false
	});

	$(".jcarousel").jCarouselLite({
		auto: 3000,
		speed: 500,
		btnGo: slides,
		visible: 1,
		scroll: 1,
		beforeStart: function(obj) {
			$(".pagination span").removeClass("selected");
		},
		afterEnd: function(obj) {
			$(".pagination .slide_"+obj.find("img").attr("rel")).addClass("selected");
		}
	});

	// gallery
	$("#thumbs a").click(function(e){
		e.preventDefault();
		show_video(get_index($(this).find("img").attr("id").replace('photo_', '')));
	});
	$("#thumbs a:first").click();
	
	// alpha to pagination
	$(".slide .pagination").css("opacity", 0.75)
});

/*var first_time = true;

function video(video){
	$("#video").flashembed({
		src: video,
		width: 400,
		height: 265,
		allowscriptaccess: "always",
		allowFullScreen: "true",
		wmode: "transparent"
	});
}

function open_video(video){
	if (first_time) {
		autoplay = '&autostart=true';
		first_time = false;
	}else{
		autoplay = "";
	}
	
	$("#player").flashembed({
		src: video + autoplay,
		width: 400,
		height: 265,
		allowscriptaccess: "always",
		allowFullScreen: "true",
		wmode: "transparent"
	});
}

function get_index(id){
	for (var i=0, obj; obj = videos[i]; i++) {
		if (obj.id == id) {
			return i
		}
	};
}

function show_video(i){
	var obj = videos[i];
	$("#video p").html(obj.name + ' &nbsp;&nbsp; <a href="' + webroot + 'video_galleries/video/' + obj.id + '">&raquo; More Info</a>');
	open_video(obj.video);
}
*/

