
/*This file created to add site js functions */

//Video Popup
var modalWindow;

function popPage(source, width, height)
{
if (width == null)
	width = 600;
if (height == null)
	height = 400;
modalWindow.windowId = "Modal";
modalWindow.width = width;
modalWindow.height = height;
modalWindow.content = "<iframe allowTransparency='true' width='" + width + "' height='" + height + "' frameborder='0' scrolling='no' src='" + source + "'></iframe>";
modalWindow.open();
};

modalWindow = {
parent: "body",
windowId: null,
content: null,
width: null,
height: null,
close: function()
{
	$(".modal-window").remove();
	$(".modal-overlay").remove();
},
open: function()
{
	//margin-top:-" + (this.height / 2) + "px;
	var modal = "";
	modal += "<div id=\"modalBack\" class=\"modal-overlay\" onmousewheel=\"return false;\"></div>";
	modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"position:absolute;width:" + this.width + "px; height:" + this.height + "px; margin-top:0px;  margin-left:-" + (this.width / 2) + "px;\">";
	modal += this.content;
	modal += "</div>";

	$(this.parent).append(modal);
	
	/* adds a button to the html, button is now in flash, so HTML button is unnecessary
	var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
			if(isIE6)
			{
	        	$(".modal-window").append("<div style=\"position:absolute;bottom:357px;left:437px;\"><a class=\"close-window\" href=\"#\"><img src=\"/PublishingImages/btn_close.gif\" /></a></div>");
	        }
	        else
	        {
	        	$(".modal-window").append("<div style=\"position:absolute;bottom:361px;left:428px;\"><a class=\"close-window\" href=\"#\"><img src=\"/PublishingImages/btn_close.gif\" /></a></div>");	        	
	        }
	 */

	
	$(".close-window").click(function() { modalWindow.close(); });
	$(".modal-overlay").click(function() { modalWindow.close(); });
}
};

function closePopup() 
{
	//modal exists in an iframe, for flash to call this, it must 
	//refere to the parent to close the modal. Otherwise closing can
	//be done by applying the above style .close-window
		parent.modalWindow.close();
}

