﻿var g_isIE = (document.all) ? true : false;
var g_isDHTML = (document.getElementById || document.all) ? true : false;
var g_standardBody = (document.documentElement) ? document.documentElement : document.body;
var g_isOffline = window.location.href.indexOf('http') == -1;

//Initialization
if(!g_isIE) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = getMouseCoords;

//Public Methods
function getElement(id)
{
    if(g_isIE)
    {
        return document.getElementById(id);
    }
   else
   {
        return document.getElementById(id);
   } 
}

function getWindowSize()
{
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    
    return{ width:windowWidth, height:windowHeight };
}

function getMouseCoords(e)
{
    var posX = 0;
    var posY = 0;

    if(g_isIE)
    {
       try
       { 
            //Get mouse coordinates in IE.
            posX = event.clientX + document.body.scrollLeft;
            posY = event.clientY + document.body.scrollTop;
        }
        catch(e){} //Suppress these errors, they mean nothing.
    }
    else
    {
        //Get mouse coordinates in Netscape.
        posX = e.pageX;
        posY = e.pageY;
    }

    return{ x:posX, y:posY };
}

function getElementPos(id)
{
    var o = document.getElementById(id);
    var posX = 0;
    var posY = 0;
	
    while(o.offsetParent != null)
    {
        posX += o.offsetLeft;
        posY += o.offsetTop;
	
        o = o.offsetParent;
    }
	
    return{ x:posX, y:posY };
}

function PopHelp(url){
	var HelpWindow = window.open(url, "HelpWindow","height=600,width=700,location=no,menubar=no,scrollbars=yes, resizable=yes, title=no, status=yes");
	if (HelpWindow == null || typeof (HelpWindow) == "undefined") {
		alert("Help is unavailable due to your pop-up blocking software. Please turn your pop-up blocking software for this site. We use pop-ups for informational purposes only.");
	} else {
		HelpWindow.focus();
	}
	alert(url);
}
