function popups(){
	var _popups = $('div.container');
	var _close = $('#main .close');
	var _new = $('#main .magnify');
	var _logo = $('.logo-close');
	var _imageMap = $('.image-map');
	var _cur = 0;

	_popups.removeClass('active').eq(_cur).addClass('active');
	_close.click(function(){
		_cur=1;
		_popups.removeClass('active').eq(_cur).addClass('active');
		return false;
	});
	_new.click(function(){
		_cur=2;
		_popups.removeClass('active').eq(_cur).addClass('active');
		return false;
	});
	_logo.click(function(){
		_cur--;
		_popups.removeClass('active').eq(_cur).addClass('active');
		return false;
	});
	_imageMap.click(function(){
		_cur = 0;
		_popups.removeClass('active').eq(_cur).addClass('active');
		return false;
	})
}

$(function(){
	popups();
});


/*
Supersized - Fullscreen Slideshow jQuery Plugin
By Sam Dunn (www.buildinternet.com // www.onemightyroar.com)
Version: supersized.2.0.js // Relase Date: 5/7/09
Website: www.buildinternet.com/project/supersized
Thanks to Aen for preloading, fade effect, & vertical centering
Modified for use on Shetland.org
*/

(function($){

	//Resize image on ready or resize
	$.fn.supersized = function() {
		$.inAnimation = false;
		$.paused = false;
		var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options);
		
		$(window).bind("load", function(){
			$('#loading').hide();
			$('#image').fadeIn('fast');
		});
				
		$(document).ready(function() {
			$('#image').resizenow(); 
		});
		
	
		$(window).bind("resize", function(){
			$('#image').resizenow(); 
		});
		
		$('#image').hide();
	};
	
	//Adjust image size
	$.fn.resizenow = function() {
		var options = $.extend($.fn.supersized.defaults, $.fn.supersized.options);
	  	return this.each(function() {
	  		
			//Define image ratio
			var ratio = options.startheight/options.startwidth;
			
			//Gather browser and current image size
			var imagewidth = $(this).width();
			var imageheight = $(this).height();
			var browserwidth = $(window).width();
			var browserheight = $(window).height();
			var offset;

			//Resize image to proper ratio
			if ((browserheight/browserwidth) > ratio){
			    $(this).height(browserheight);
			    $(this).width(browserheight / ratio);
			    $(this).children().height(browserheight);
			    $(this).children().width(browserheight / ratio);
			} else {
			    $(this).width(browserwidth);
			    $(this).height(browserwidth * ratio);
			    $(this).children().width(browserwidth);
			    $(this).children().height(browserwidth * ratio);
			}
			if (options.vertical_center == 1){
				$(this).children().css('left', (browserwidth - $(this).width())/2);
				$(this).children().css('top', (browserheight - $(this).height())/2);
			}
			return false;
		});
	};
	
	$.fn.supersized.defaults = { 
			startwidth: 1280,  
			startheight: 960,
			vertical_center: 0,
			slideshow: 0,
			navigation:0,
			transition: 1, //0-None, 1-Fade, 2-slide top, 3-slide right, 4-slide bottom, 5-slide left
			pause_hover: 0,
			slide_counter: 0,
			slide_captions: 0,
			slide_interval: 25000
	};
	
})(jQuery);