function BambooLabCode( oDomain )
{
	var domain = oDomain;

	var path = oDomain + "index.php/";

	this.getDomain = function ( )
	{
		return domain;
	};

	this.getPath = function ( )
	{
		return path;
	};

	this.id = function( oId )
	{
		return document.getElementById( oId );
	};

	this.name = function( oName )
	{
		return document.getElementsByName( oName );
	};

	this.tag = function( oTag )
	{
		return document.getElementsByTagName( oTag );
	};

	this.isArray = function ( oElement )
	{
		return ( oElement.length != 0 && oElement.length != "undefined" );
	};

	this.isSelectTag = function ( oElement )
	{
		return ( oElement.tagName != null && oElement.tagName.toLowerCase() == "select" );
	};

	this.createXHR = function( )
	{
		if ( window.XMLHttpRequest )
		{
			var oXHR = new XMLHttpRequest();
		}
		else if ( window.ActiveXObject )
		{
			var oXHR = new ActiveXObject( 'Microsoft.XMLHTTP' );
		}

		return oXHR;
	};

	this.addEvent = function( oElement, oEventType, oFunction )
	{
		if ( window.attachEvent )
		{
			if ( ! this.isArray ( oElement ) || this.isSelectTag( oElement ) )
			{
				oElement.attachEvent( oEventType, oFunction );
			}
			else
			{
				for ( var i=0; i<oElement.length; i++ )
				{
					oElement.item(i).attachEvent( oEventType, oFunction );
				}
			}
		}
		else if ( window.addEventListener )
		{
			if ( ! this.isArray ( oElement ) || this.isSelectTag( oElement ) )
			{
				oElement.addEventListener( oEventType.substring(2), oFunction, false );
			}
			else
			{
				for ( var i=0; i<oElement.length; i++ )
				{
					oElement.item(i).addEventListener( oEventType.substring(2), oFunction, false );
				}
			}
		}
	};

	this.removeEvent = function( oElement, oEventType, oFunction )
	{
		if ( window.detachEvent )
		{
			if ( ! this.isArray ( oElement ) )
			{
				oElement.detachEvent( oEventType, oFunction );
			}
			else
			{
				for ( var i=0; i<oElement.length; i++ )
				{
					oElement.item(i).detachEvent( oEventType, oFunction );
				}
			}
		}
		else if ( window.removeEventListener )
		{
			if ( ! this.isArray ( oElement ) )
			{
				oElement.removeEventListener( oEventType.substring(2), oFunction, false );
			}
			else
			{
				for ( var i=0; i<oElement.length; i++ )
				{
					oElement.item(i).removeEventListener( oEventType.substring(2), oFunction, false );
				}
			}
		}
	};

	this.cancelEvent = function( event )
	{
		if ( window.attachEvent )
		{
			event.cancelBubble = true;
		}
		else if ( window.addEventListener )
		{
			event.stopPropagation();
		}
	};

	this.stopEvent = function ( event )
	{
		if ( window.attachEvent )
		{
			window.event.returnValue = false;
		}
		else if ( window.addEventListener )
		{
			event.preventDefault();
		}
	};

	this.getTarget = function( event )
	{
		var oEvent = event ? event : window.event;

		var oTarget = oEvent.target ? oEvent.target : oEvent.srcElement;

		return oTarget;
	};

	this.getScrollTop = function ( ) // y
	{
		return document.body.scrollTop;
	};

	this.getScrollLeft = function ( )  // x
	{
		return document.body.scrollLeft;
	};

	this.getBodyHeight = function() // all page height
	{
		var oBody = document.getElementsByTagName( "body" ).item(0);

		var oFullHeight = 0;

		var oChild = oBody.firstChild;

		do
		{
			oFullHeight += oChild.offsetHeight;

			oChild = oChild.nextSibling;

		} while( oChild != null );

		return oFullHeight;
	}

	this.getBodyTop = function() // merge scrollbar
	{
		var oBody = document.getElementsByTagName( "body" ).item(0);

		var oTop = ( oBody.clientHeight * 10 ) / 100

		return oTop + this.getScrollTop();
	};

	this.createTag = function ( oName ) // name, text, attr = array()
	{
		return document.createElement( oName );
	};

	this.createAttribute = function ( oName, oValue )
	{
		var oAttr = document.createAttribute( oName );

		oAttr.nodeValue = oValue;

		return oAttr;
	};

	this.createTextNode = function ( oText )
	{
		return document.createTextNode( oText );
	};
}

var bamboo = new BambooLabCode ( "http://localhost/function/" );
