//This class is buildt for the internet Explorer document object model

function CDocumentObjectModel( sObjectName )
{
	if( sObjectName && document.getElementById )
	{
		this.oObject = document.getElementById( sObjectName );
		
		if( this.oObject != null )
		{
			this.oStyle = document.getElementById( sObjectName ).style;
		}
	}
	else if( sObjectName && document.all )
	{
		this.oObject = document.all[sName];
		this.oStyle = document.all[sName].style;
	}

	this.GetLeft = CDocumentObjectModel_GetLeft;
	this.GetTop = CDocumentObjectModel_GetTop;
	this.GetWidth = CDocumentObjectModel_GetWidth;
	this.GetHeight = CDocumentObjectModel_GetHeight;
	this.GetVisiblity = CDocumentObjectModel_GetVisiblity;
	this.SetVisiblity = CDocumentObjectModel_SetVisiblity;
	this.SetLeft = CDocumentObjectModel_SetLeft;
	this.SetTop = CDocumentObjectModel_SetTop;
	this.GetScreenWidth = CDocumentObjectModel_GetScreenWidth;
	this.GetScreenHeight = CDocumentObjectModel_GetScreenHeight;
	this.SetClip = CDocumentObjectModel_SetClip;
	this.GetOffset = CDocumentObjectModel_GetOffset;
	this.GetAbsouluteTop = CDocumentObjectModel_GetAbsouluteTop;
	this.GetAbsouluteLeft = CDocumentObjectModel_GetAbsouluteLeft;	
}

function CDocumentObjectModel_GetScreenWidth()
{
	return document.body.clientWidth;
}

function CDocumentObjectModel_GetScreenHeight()
{
	return document.body.clientHeight;
}

function CDocumentObjectModel_GetLeft()
{
	return this.oStyle.pixelLeft;
}

function CDocumentObjectModel_GetTop()
{
	return this.oStyle.pixelTop;
}

function CDocumentObjectModel_GetAbsouluteTop()
{
	return ( this.oObject.y ) ? this.oObject.y : GetAbsoulutePosition( this.oObject, "Top" );
}

function CDocumentObjectModel_GetAbsouluteLeft()
{
	return ( this.oObject.x ) ? this.oObject.x : GetAbsoulutePosition( this.oObject, "Left" );
}

function CDocumentObjectModel_SetTop(nYpos)
{
	this.oStyle.pixelTop = nYpos;			
}

function CDocumentObjectModel_SetLeft(nXpos)
{
	this.oStyle.pixelLeft = nXpos;
}

function CDocumentObjectModel_GetWidth()
{
	return this.oStyle.pixelWidth;
}

function CDocumentObjectModel_GetHeight()
{
	return this.oStyle.pixelHeight;
}

function CDocumentObjectModel_GetVisiblity()
{
	return this.oStyle.visibility;	
}

function CDocumentObjectModel_SetVisiblity(bType)
{
	var sType = (bType) ? "visible" : "hidden";
	this.oStyle.visibility = sType;	
}

function CDocumentObjectModel_GetOffset()
{
	return this.oObject.offsetHeight + 20;
}

function CDocumentObjectModel_SetClip( nMaskX, nMaskY, nMaskWidth, nMaskHeight )
{	
	this.oStyle.clip = 'rect('+ nMaskY +' '+ nMaskWidth +' '+ nMaskHeight + ' ' + nMaskX + ')';
}

function GetAbsoulutePosition( oObject, sPosition ) {
	nPosition = 0;
	while ( oObject != null ) {
		nPosition += oObject[ "offset" + sPosition ];
		oObject = oObject.offsetParent;
	}	
	return nPosition;
}

function GetScreenWidth()
{
	return document.body.clientWidth;
}

function GetScreenHeight()
{
	return document.body.clientHeight;
}

