function winMaximize()
	{
	top.window.moveTo(0,0);
	if (document.all)
		{
		top.window.resizeTo(screen.availWidth,screen.availHeight);
		}
	else if (document.layers||document.getElementById)
		{
		if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
			{
			top.window.outerHeight = screen.availHeight;
			top.window.outerWidth = screen.availWidth;
			}
		}
	self.focus();
	}

function objMaximize(objWindow)
	{
	objWindow.moveTo(0,0);
	if (document.all)
		{
		objWindow.resizeTo(screen.availWidth,screen.availHeight);
		}
	else if (document.layers||document.getElementById)
		{
		if (objWindow.outerHeight<screen.availHeight||objWindow.outerWidth<screen.availWidth)
			{
			objWindow.outerHeight = screen.availHeight;
			objWindow.outerWidth = screen.availWidth;
			}
		}
	objWindow.focus();
	}


function left(str, n)
	{
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		return String(str).substring(0,n);
	}

function right(str, n)
	{
	if (n <= 0)
		return "";
	else if (n > String(str).length)
		return str;
	else
		{
		var iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
		}
	}

function winOPEN(sURL, sTITLE) {
	var dummy = window.open(sURL, sTITLE, "toolbar=no,status=no,location=no,directories=no,menubar=no,titlebar=no,scrollbars=yes,resizable=yes,left=0,top=0,width=640,height=480");
//	doCheckPopupBlocked(winOPEN);
	setTimeout(function() {
		doCheckPopupBlocked(dummy);
	}, 1000);

}

function checkPopupBlocked(poppedWindow) {
	setTimeout(function() {
		doCheckPopupBlocked(poppedWindow);
	}, 5000);
}

function doCheckPopupBlocked(poppedWindow) {

    var result = false;

    try {
        if (typeof poppedWindow == 'undefined') {
            // Safari with popup blocker... leaves the popup window handle undefined
            result = true;
        }
        else if (poppedWindow && poppedWindow.closed) {
            // This happens if the user opens and closes the client window...
            // Confusing because the handle is still available, but it's in a "closed" state.
            // We're not saying that the window is not being blocked, we're just saying
            // that the window has been closed before the test could be run.
            result = false;
        }
        else if (poppedWindow && poppedWindow.outerWidth == 0) {
            // This is usually Chrome's doing. The outerWidth (and most other size/location info)
         // will be left at 0, EVEN THOUGH the contents of the popup will exist (including the
         // test function we check for next). The outerWidth starts as 0, so a sufficient delay
         // after attempting to pop is needed.
            result = true;
        }
        else if (poppedWindow && poppedWindow.test) {
            // This is the actual test. The client window should be fine.
            result = false;
        }
        else {
            // Else we'll assume the window is OK
            result = false;
        }

    } catch (err) {
        //if (console) {
        //    console.warn("Could not access popup window", err);
        //}
    }

    if(result)
    	alert("The popup was blocked. You must allow popups to use this site.");
//    else
//    	alert("The popup was NOT blocked!");
}

