$(document).ready(function () {
	$('.faq-item').addClass('faq-item-js');
	$('.faq-item .question').click(function(){
		var id = $(this).attr('id');
		$('#'+id).toggleClass('open-q');
		$('#'+id+'txt').toggleClass('open-a');
	});
	$(".lightbox").lightbox({fitToScreen: false});
	
	$('#carousel').css("height", "52px");
	$('#carousel').css("overflow", "hidden");
	
	$('#carousel').jcarousel({
		auto: 2,
		scroll: 1,
		vertical: true,
		visible: 1,
		wrap: 'last',
		initCallback: carousel_initCallback
	});
	
	$(".applet").each(function() {
		$(this).click(function() {
			window.open(this.href, "applet", "status=0,toolbar=0,location=0,menubar=0,resizable=1,width=1000,height=666");
			return false;
		});
	});
	
	buildMultiselects();
});

$('#slideshow IMG:last').ready(function(){
	$('#slideshow').cycle({fx:'fade',speed: 5000});
});

function carousel_initCallback(carousel) {
	// Disable autoscrolling if the user clicks the prev or next button.
	carousel.buttonNext.bind('click', function() {
		carousel.startAuto(0);
	});
	carousel.buttonPrev.bind('click', function() {
		carousel.startAuto(0);
	});
	// Pause autoscrolling if the user moves with the cursor over the clip.
	carousel.clip.hover(function() {
		carousel.stopAuto();
	}, function() {
		carousel.startAuto();
	});
};