jQuery(function($) {
	function slider_initCallback (carousel) {
	
		$('.slider-nav a').bind('click', function() {
			carousel.scroll($.jcarousel.intval($(this).text()));
			carousel.stopAuto();
			return false;
		});
	}
	
	function slider_firstInCallback(carousel, item, idx, state) {
		$('.slider-nav a').removeClass('active');
		$('.slider-nav a').eq(idx-1).addClass('active');
	}

	$('.home-slider, .inner-slider').jcarousel( {
		initCallback: slider_initCallback,
		itemFirstInCallback: slider_firstInCallback,
		scroll: 1,
		wrap : 'both',
		auto : 3,
		// This tells jCarousel NOT to autobuild prev/next buttons
		buttonNextHTML: null,
		buttonPrevHTML: null
	});
	
	$('.blink')
		.focus(function(){
			if( $(this).val() == $(this).attr('title') ) {
				$(this).val('');
			}
		})
		.blur(function(){
			if( $(this).val() == '' ) {
				$(this).val( $(this).attr('title') );
			}
		});
	$('#footer .menu span:first').remove();
	
	function change_location_point(point_id) {
		$('.big-map a.loc-point-active').removeClass('loc-point-active');
		$('.big-map a.loc-point[href=' + point_id + ']').addClass('loc-point-active');
		$('.big-map .loc-box:visible').hide();
		$('.big-map ' + point_id).show();
	}
	
	$('.big-map a.loc-point, #content p.nav > a').click(function() {
		change_location_point($(this).attr('href'));
		return false;
	});
	
	$('.question > a').click(function() {
		$('.question .question-body').slideUp();
		$(this).next().slideToggle();
		return false;
	});
	
});
