var bibleUtils = {

	rectangle: function(x,y,width,height)
	{
	    this.x = x;
	    this.y = y;
	    this.width = width;
	    this.height = height;
	    return this;
	},
	getPos:function(item)
    {
        var rectangle = new bibleUtils.rectangle(0,0,0,0);
        try
        {
            //var item = document.getElementById(id);
            if (item)
            {
                rectangle.x = item.offsetLeft;
                rectangle.y = item.offsetTop;
                var parentElem = item.offsetParent;
                var hasOffsetParent = true;
                if (!parentElem)
                {
                    parentElem = item.parent;
                    hasOffsetParent = false;
                }
                while (parentElem)
                {                
                    rectangle.x += parentElem.offsetLeft;
                    rectangle.y += parentElem.offsetTop;
                    if (hasOffsetParent)
                        parentElem = parentElem.offsetParent;
                    else
                        parentElem = parentElem.parent;
                }
                rectangle.width = item.offsetWidth;
                rectangle.height = item.offsetHeight;
            }
        }
        catch (exception)
        {
            alert(exception);
        }
        return bibleUtils.rectangle;
    },

	windowSize:function()
    {
        var width;
        var height;
        var winX;
        var winY;
        if (window.innerWidth)
        {
              width = window.innerWidth;
              height = window.innerHeight;
              winX = window.pageXOffset;
              winY = window.pageYOffset;
        }
        else
        {
            if( document.documentElement)
            {            
              if (document.documentElement.clientWidth || 
                  document.documentElement.clientHeight )
              {
                width = document.documentElement.clientWidth;
                height = document.documentElement.clientHeight;
                winX = document.documentElement.scrollLeft;
                winY = document.documentElement.scrollTop;
              }
            }
            else if (document.body)
            {
              width = document.body.clientWidth;
              height = document.body.clientHeight;
              if (document.body.scrollTop || document.body.scrollLeft)
              {
                winX = document.body.scrollLeft;
                winY = document.body.scrollTop;
              }
            }
            
        }
        return new bibleUtils.rectangle(winX, winY, width, height);
    },
    getParameter:function(name)
    {
    	var url = new String(window.location);
    	var paramStart = url.indexOf(name + "=");
        var varEnd = url.indexOf("#");
        if (varEnd < 0) varEnd = url.length;
    	if (paramStart > -1)
    	{
    		paramStart += name.length + 1;
    		paramEnd = url.indexOf("&", paramStart);
    		if (paramEnd < 0)
    			return decodeURIComponent(url.substring(paramStart, varEnd));
    		else
    			return decodeURIComponent(url.substring(paramStart, paramEnd));
    	}
    	return "";
    }
};
