Cufon.replace('.cufon-bold', { fontFamily: 'helvetica-bold' });
Cufon.replace('.cufon-regular', { fontFamily: 'helvetica' });
Cufon.replace('.cufon-a', { fontFamily: 'helvetica-bold', hover: true });
Cufon.replace('.cufon-italic', { fontFamily: 'helvetica-italic' });
Cufon.replace('.cufon-bold-italic', { fontFamily: 'helvetica-bold-italic' });

jQuery(function($){
	
	var home_slider_speed = window.home_slider_speed;
	
	$("dt.fact").click(function(){
		var answer = $(this).next("dd");
		if (answer.is(':animated')) {
			return false;
		}
		answer.slideToggle("slow");
	});
	
	function change_slide(idx) {
		clearTimeout(timeout);
		var total = $('#home-slider .slides .slide').length;
		if (total < 2) {
			return false;
		}
		var current = $('#home-slider .slides .slide').index($('#home-slider .slides .slide:visible'));
		if (idx == current || $('#home-slider .slides .slide:animated').length > 0) {
			return false;
		}
		$('#home-slider .slides .slide:visible').fadeOut();
		$('#home-slider .slides .slide:eq(' + idx + ')').fadeIn();
		$('#home-slider .slider-navigation a.active').removeClass('active');
		$('#home-slider .slider-navigation a:eq(' + idx + ')').addClass('active');
		timeout = setTimeout(auto_change_slide, home_slider_speed);
	}
	
	function auto_change_slide() {
		var total = $('#home-slider .slides .slide').length;
		if (total < 2) {
			return false;
		}
		var current = $('#home-slider .slides .slide').index($('#home-slider .slides .slide:visible'));
		if (current < total - 1) {
			current++;
		} else {
			current = 0;
		}
		change_slide(current);
	}
	
	var timeout = setTimeout(auto_change_slide, 3000);
	
	$('.slider-navigation a').click(function() {
		var idx = $('.slider-navigation a').index($(this));
		change_slide(idx);
		return false;
	});
	
	$('#services li:even').addClass('even');
	
	$('#navigation .inactive').click(function() {
		return false;
	});
	
	$('#sidebar .menu a').each(function() {
		var text = $(this).html();
		$(this).html(text + " &raquo;");
	});
	
});

