jQuery(function() {
	jQuery('body').hide().fadeIn();

	// page features
	/*if (jQuery('.cyclehome').children('.feature').size()) {
		jQuery('.cyclehome').cycle({
			fx:     'scrollUp',
			timeout: 15000,
			random: 1
		});
	}*/

	// page features
	if (jQuery('.cycle').children('.feature').size()) {
		jQuery('.cycle').cycle({
			fx:     'scrollUp',
			timeout: 6000,
			random: 1
		});
	}

	// external links
	jQuery('a[rel=external]').attr('target', '_blank')

	jQuery('#nav li a').not('.active').hover(function() {
		jQuery(this).stop().animate({'background-color': '#7fb215'}, 200);
	}, function() {
		jQuery(this).stop().animate({'background-color': '#f2534a'}, 500);
	});

	jQuery('.gallery img').hover(function() {
		jQuery(this).fadeTo(100, 0.6);
	}, function() {
		jQuery(this).fadeTo(500, 1);
	}).click(function() {
		image = jQuery(this).attr('src').replace('images/', 'images/big-');

		jQuery('#bigpicture').fadeOut(100, function() {
			jQuery(this).attr('src', image).fadeIn();
		});
	});

	jQuery('.home img, .partnerlogos a, .introimage img').hover(function() {
		jQuery(this).fadeTo(100, 0.6);
	}, function() {
		jQuery(this).fadeTo(500, 1);
	});

//
	// map points

	// hide descriptions as we'll do something nicer with them
	jQuery('.maplist dd').hide();

	// add info box
	jQuery('.map').append('<div class="mapinfo"></div>');
	jQuery('.mapinfo').hide();

	// add interactivity to list
	jQuery('.maplist dt').hover(function() {
		// work out what point position we're over'
		listpoint = jQuery(this).children('span').attr('class').split(' ').slice(-1);

		// find this point on the map
		mappoint = jQuery('.map .column3 .'+listpoint);
		left = parseInt(mappoint.css('left')) + 22;
		topp = parseInt(mappoint.css('top')) - 12;
		colour = mappoint.css('background-color');

		// get the content of the point we hovered over
		content = jQuery(this).next().html();

		//jQuery('.mapinfo').stop().animate({left: left, top: top, opacity: 1}, 500, 'easeOutBack').html(content);
		jQuery('.mapinfo').stop().animate({left: left, top: topp, opacity: 1}, 500, 'easeOutBack').html(content);
		jQuery('.mapinfo h4').css({color: colour});
		mappoint.addClass('activepoint');
	}, function() {
		mappoint.removeClass('activepoint');
	});

	// fade info in and out based on hovering over the entire list, not individual items
	jQuery('.maplist').hover(function() {
		jQuery('.mapinfo').fadeTo(200, 1);
	}, function() {
		jQuery('.mapinfo').stop().fadeTo(200, 0);
	});

});
