
$(document).ready(function() {
		
	//functions to get the current window dimensions
	var winWidth = function() { return document.body.clientWidth };
	var winHeight = function() { return $.browser.msie ? document.body.clientHeight : window.innerHeight; };
	
	var setSize = function() {
		var newWidth = winWidth();
		var newHeight = winHeight();
		$('#fullscreen').width(newWidth);
		$('#fullscreen').height(newHeight);
		
	};
	setSize();	//set the initial window size

	//add event listener to detect when the window is resized and resize the div accordingly
	$(window).resize(setSize);
	
	var album_id = window.location.hash.split("=")[1];
	if(album_id)
		openalbum(album_id);
});

function openalbum(id)
{
	//set flash vars
	var flashvars = false;
	var params = {
	  wmode: "transparent",
	  allowFullScreen: "true",
	  swliveconnect: "true",
	  allowScriptAccess: "always"
	};
	var attributes = {
	  id: "myDynamicContent",
	  name: "myDynamicContent"
	};
	
	swfobject.embedSWF("/flash/gallery.swf?site="+root_path+"&id="+id, "flashcontainer", "100%", "100%", "9.0.0","/flash/expressInstall.swf", flashvars, params);
	$('#fullscreen').fadeIn();
	
	window.location.hash = "#a="+id;
	return false;
}

function closealbum()
{
	$('#fullscreen').fadeOut("fast", function() {
		$(this).html('<div id="flashcontainer"></div>')
	});
}