function openPopup(url, name, attr)
{
	if (url != '' && name != '')
	{
		window.open(url, name, attr);
	}
}


function getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function showMask()
{
	if (typeof document.body.style.maxHeight === "undefined") //if IE 6
	{
		$("body","html").css({height: "100%", width: "100%"});
		$("html").css("overflow","hidden");

		if (document.getElementById("hideSelect") === null) //iframe to hide select elements in ie6
		{
			$("body").append("<iframe id='hideSelect'></iframe><div id='overlay'></div>");
		}
	}
	else //all others
	{
		if(document.getElementById("overlay") === null)
		{
			$("body").append("<div id='overlay'></div>");
		}
	}
	
	if(detectMacXFF())
	{
		$("#overlay").addClass("overlayMacFFBGHack");//use png overlay so hide flash
	}
	else
	{
		$("#overlay").addClass("overlayBG");//use background and opacity
	}

	document.onkeydown = function(e){
		if (e == null) // ie
		{
			keycode = event.keyCode;
		}
		else // mozilla
		{
			keycode = e.which;
		}

		if(keycode == 27) // close
		{
			removeMask();
		}
	};
}

function removeMask()
{
	if ($("#overlay"))
	{
		$("#overlay").remove();
	}

	if ($("#hideSelect"))
	{
		$("#hideSelect").remove();
	}

	if (typeof document.body.style.maxHeight == "undefined") //if IE 6
	{
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}

	document.onkeydown = "";
	document.onkeyup = "";

	return false;
}

function detectMacXFF()
{
	var userAgent = navigator.userAgent.toLowerCase();

	if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1)
	{
		return true;
	}
}
