/**
* @author	André Dietisheim (dietisheim@sphere.ch)
* @version 1.0, 2005-05-23 (created on 2005-05-01)
* Copyright (c) 2001-2005 André Dietisheim
*/

function Node( sText, target, iLevel, iW, iH )
{
	this.sText = sText;
	this.target = target;
	this.iLevel = iLevel;

	this.child = null;
	this.sibling = null;
	this.sParent = null;
	this.sPath = null;

	this.iX = 0;
	this.iY = 0;
	this.iW = iW || -1;
	this.iH = iH || -1;
	this.iOffsetX = -1;
	this.iOffsetY = -1;

	this.style = null;
	
	this.xlayer = null;
	this.bHighlightClicked = false;
} 

Node.prototype.setStyle = function( style )
{
	if ( this.iW < 0 )
		this.iW = style.iW;
	if ( this.iH < 0 )
		this.iH = style.iH;
	if ( this.iOffsetX < 0 )
		this.iOffsetX = style.iOffsetX;
	if ( this.iOffsetY < 0 )
		this.iOffsetY = style.iOffsetY;
	
	this.style = style;
}

Node.prototype.instantiateXlayer = function( xparentLayer, events, sSpacerUrl )
{
	this.xlayer = this.style.getXlayer( this.iX, this.iY, this.iW, this.iH, this.iLevel, xparentLayer, events, sSpacerUrl, this.child, this.sText );
}

Node.prototype.createXlayer = function()
{
	this.xlayer.create();
}

Node.prototype.setVisibility = function( bVisibility )
{
	this.xlayer.setVisibility( bVisibility );
}

Node.prototype.isVisible = function()
{
	return this.xlayer.isVisible();
}

Node.prototype.highlightClicked = function( bHighlight )
{
	this.bHighlightClicked = bHighlight;
	this.style.highlightClicked( bHighlight, this.xlayer );
}

Node.prototype.isHighlightClicked = function()
{
	return this.bHighlightClicked;
}

Node.prototype.highlight = function( bHighlight )
{	
	this.style.highlight( bHighlight, this.xlayer );
}

Node.prototype.setPos = function( iX, iY )
{
	this.xlayer.setPos( iX, iY );
}

Node.prototype.getX = function()
{
	return this.xlayer.x;
}

Node.prototype.getY = function()
{
	return this.xlayer.y;
}

