// --------------------------------------------------------------------------
// Name        : pseutils.js
// Created     : 12/09/2001
// Author      : Peter Ebdon, Professional Software Engineering Ltd (peter.ebdon@pseltd.com)
// Purpose     : Generic javascript utlility finctions
// Copyright   : Copyright (c) 2002 Professional Software Engineering Ltd
// ---------------------------------------------------------------------------------------
// Revision History
// 
// --------------------------------------------------------------------------

var gstrAgent = window.navigator.userAgent;
var gstrAgentVers = parseInt(gstrAgent.charAt(gstrAgent.indexOf("/")+1),10);

function is_explorer()
{
	return gstrAgent.indexOf("MSIE") > 0;
}
	
function is_macexplorer()
{
	if (gstrAgent.indexOf("Mac") <= 0)
		return false;
	else
		return gstrAgent.indexOf("MSIE") > 0;
}
	
function is_macnetscape()
{
	if (gstrAgent.indexOf("Mac") <= 0)
		return false;
	else
		return !(gstrAgent.indexOf("MSIE") > 0);
}
	
function is_macie4()
{
	if ((gstrAgent.indexOf("Mac") > 0) && (gstrAgent.indexOf("MSIE") > 0) && (gstrAgentVers < 5))
		return true;
	else
		return false;
}

function is_pcnetscape()
{
	if (gstrAgent.indexOf("Mac") > 0)
		return false;
	else
		return !(gstrAgent.indexOf("MSIE") > 0);
}
	
function is_aol()
{
	return gstrAgent.indexOf("AOL") > 0;
}

// Popup window handling

var gwinPopup = "none";

// Open a window in either the topleft or topright screen corner

function openPSEWin(url,w,h,l,t)
{
	var secs = new Date();
	closePopupIfOpen();
//	if fixed == 0//		{
		gwinPopup=window.open(url,'popup'+secs.getTime(),'width='+w+',height='+h+',left='+l+',top='+t+',toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes');
//		}
//	else
//		{//		gwinPopup=window.open(url,'popup'+secs.getTime(),'width='+w+',height='+h+',left='+l+',top='+t+',toolbar=no,location=no,status=no,scrollbars=yes,resizable=no');
//		}}

// If the popup window has been opened, close it now
function closePopupIfOpen()
{	
	if (gwinPopup)
	{
		if (!is_macie4())
			{
				if (typeof(gwinPopup) == "object")
				{
					if (gwinPopup.closed == false)
					{
						gwinPopup.close();
					}
					gwinPopup="none";
				}
			}
		else
			{
				if (typeof(gwinPopup) == "object")
				{
					gwinPopup="none";
				}
			}
	}
}// establish current windows' widthfunction getWindowWidth() {
	if (is_explorer)	{
		return top.window.outerWidth;	}
	else
	{
		return self.innerWidth;	}}

// establish current windows' widthfunction getWindowHeight() {
		if (is_explorer)	{		return top.window.outerHeight;	}
	else
	{
		return self.innerHeight;	}}
