view docs/candydoc/util.js @ 206:d3c148ca429b

Major moving of files. all src now goes into src, all docs in docs.
author Anders Johnsen <skabet@gmail.com>
date Tue, 12 Aug 2008 18:14:56 +0200
parents doc/candydoc/util.js@4c121c2aa844
children
line wrap: on
line source

/* This file is a part of CanDyDOC fileset.
   File is written by Victor Nakoryakov and placed into the public domain.

   This file is javascript with cross-browser utility functions. */

function getLeft(elem)
{
    var ret = 0;
	while (elem.offsetParent)
	{
		ret += elem.offsetLeft;
		elem = elem.offsetParent;
	}

	return ret;
}

function getTop(elem)
{
    var ret = 0;
	while (elem.offsetParent)
	{
		ret += elem.offsetTop;
		elem = elem.offsetParent;
	}

	return ret;
}

function getWindowHeight()
{
    var ret = 0;
    if (typeof(window.innerHeight) == "number")
        ret = window.innerHeight;
    else if (document.documentElement && document.documentElement.clientHeight)
        ret = document.documentElement.clientHeight;
    else if (document.body && document.body.clientHeight)
        ret = document.body.clientHeight;
    
    return ret;
}