// JavaScript Document

function elements($object)
{
	this.element = $object;					// getting the object data


	// getting the left co-ordinate of the object
	this.left = function()
	{

	    var x = 0;
	    var elm;
	    p_elm = this.element;
	    if(typeof(p_elm) == "object"){
	      elm = p_elm;
	    } else {
	      elm = document.getElementById(p_elm);
	    }

	    while (elm != null) {
	      x+= elm.offsetLeft;
	      elm = elm.offsetParent;
	    }

	    return parseInt(x);
	} // end of the function




	// Getting the width of the any element
	this.width = function()
	{

	    var x = 0;
	    var elm;

	    p_elm = this.element;
	    if(typeof(p_elm) == "object")
	    {
	      elm = p_elm;
	    }
	    else
	    {
	     elm = document.getElementById(p_elm);
	    }

	    return parseInt(elm.offsetWidth);

	} // end of the function



	// get the top co-ordinte of the component
	this.top = function()
	{
		var y = 0;
		var elm;

	    p_elm = this.element;

		if(typeof(p_elm) == "object")
		{
			elm = p_elm;
		}
		else
		{
			elm = document.getElementById(p_elm);
		}

		while (elm != null)
		{
			y+= elm.offsetTop;
			elm = elm.offsetParent;
		}

		return parseInt(y);

	} // end of the function


	// get the height co-ordinte of the component
	this.height = function()
	{

		var y = 0;
		var elm;

	    p_elm = this.element;


		if(typeof(p_elm) == "object")
		{
			elm = p_elm;
		}
		else
		{
			elm = document.getElementById(p_elm);
		}

		return parseInt(elm.offsetHeight);

	} // end of the function



} // end of the class
