$(window).ready(function() {
	$('.set_container').mousemove(function(e) {
		var location_list = skim_locations[$(this).attr('id')], photo_count = location_list.length - 1, offset = $(this).offset(), mouse_location = Math.ceil(e.pageX - offset.left), photo_position = Math.ceil(mouse_location / ($(this).width() / photo_count));
		
		if (typeof location_list[photo_position] != 'undefined')
			$(this).css('background', 'url(' + location_list[photo_position] + ')');
	});
	
	$('.set_container').bind('mouseout', function() {
		if (typeof skim_locations[$(this).attr('id')][0] != 'undefined')
			$(this).css('background', 'url(' + skim_locations[$(this).attr('id')][0] + ')');
	});
});

function start_preloading_images()
{
	if (typeof skim_locations != 'undefined')
	{
		for (set_id in skim_locations)
		{
			for (key in skim_locations[set_id])
			{
				var url = skim_locations[set_id][key];
				var img = new Image();
				img.src = url;
			}
		}
	}
}