﻿
// 20090616 - Lauren Smith (ISM)
//
// Overlay/popup script adapted from: http://yensdesign.com/2008/09/how-to-create-a-stunning-and-smooth-popup-using-jquery/
// Much improvement could be made here by making these functions multi-purpose, i.e. instead of tying everything to a single
// set of overlay objects we could make these functions accept parameters to turn off or on multiple things per page. Since
// the current spec doesn't call for anything more complicated we'll leave it at this for now.

var ismOverlayIsActive = false;

function ismOverlayLoad()
{
	if(!ismOverlayIsActive)
	{
		$("#ismOverlayBG").css({	"opacity": "0.7"});
		$("#ismOverlayBG").fadeIn("slow");
		$("#ismOverlay").fadeIn("slow");
		ismOverlayIsActive = true;
	}
}

function ismOverlayDisable()
{
	if(ismOverlayIsActive)
	{
		$("#ismOverlayBG").fadeOut("slow");
		$("#ismOverlay").fadeOut("slow");
		ismOverlayIsActive = false;
	}
}

function ismOverlayPosition()
{
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = $("#ismOverlay").height();
	var popupWidth = $("#ismOverlay").width();

	$("#ismOverlay").css
	({
		//"position": "absolute",
		//"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});

	// IE6 hack:
	$("#ismOverlayBG").css
	({
		"height": windowHeight
	});
}