var initialPositionMap = Array();
var initialPositionMapRel = Array();
/**
 * setNamedStyle(name):
 *
 *
 *
 */
function setNameStyle(name,property,value) {
	obj=DHTML.getElement(name);
	DHTML.setStyle(obj, property, value);
	
}



/**
 * hideObj(obj)
 *
 *
 *
 */
function hideObj(obj) {
	if (obj==undefined) return;
	DHTML.setStyle(obj, "visibility", "'hidden'");
}


/**
 * showObj(obj)
 *
 *
 *
 */
function showObj(obj) {
	if (obj==undefined) return;
	DHTML.setStyle(obj, "visibility", "'visible'");
}


function showElement(obj, visible)
{
	if (visible) 
		DHTML.showObj(obj);
	else 
		DHTML.hideObj(obj);
}


/**
 * getWidth(obj):
 *
 *
 *
 */

function getX(obj)
{
    return DHTML.getX(obj);
}

/**
 * getHeight(obj):
 *
 *
 *
 */
function getY(obj)
{
    return DHTML.getY(obj);
}

/**
 * getWidth(obj):
 *
 *
 *
 */

function getWidth(obj)
{
    return DHTML.getWidth(obj);
}

/**
 * getHeight(obj):
 *
 *
 *
 */
function getHeight(obj)
{
    return DHTML.getHeight(obj);
}

/**
 * setHeight(obj, x):
 *
 *
 *
 */
function setHeight(obj, h) {
	if (h<0) h=0;
	DHTML.setStyle(obj, "height", h);
}


/**
 * showY(obj, y)
 *
 *
 *
 */
function setWidth(obj, w) {
	if (w<0) w=0;
	DHTML.setStyle(obj, "width", w);
}

/**
 *
 *
 *
 */
function setXRelTo(obj, x, objRel) {
	var xrel = DHTML.getX(objRel);
	DHTML.setX(obj, x + xrel);
}

/**
 *
 *
 *
 */
function setYRelTo(obj, y, objRel) {
	var yrel = DHTML.getY(objRel);
	DHTML.setY(obj, y + yrel);
}

/**
 *
 *
 *
 */
function setX(obj, x) {
	DHTML.setX(obj, x);
}


/**
 *
 *
 *
 */
function setY(obj, y) {
	DHTML.setY(obj, y);
}


// ======================================================================================
// ======================================================================================
// ======================================================================================
function setX_compat(obj, x) {
	var xorg = initialPositionMap[obj.id+'_xorg'];
	if (xorg==null) {
	 	var xorg = DHTML.getX(obj);
		initialPositionMap[obj.id+'_xorg'] = xorg;
	}
	
	DHTML.setX(obj, x - xorg);
}

function setY_compat(obj, y) {
	var yorg = initialPositionMap[obj.id+'_yorg'];
	
	if (yorg==null) {
	 	var yorg = DHTML.getY(obj);
		initialPositionMap[obj.id+'_yorg'] = yorg;
	}
	
	
	DHTML.setY(obj, y - yorg);
}

function setScroll(x, y)
{
	window.scroll(x,y);
}



// ======================================================================================
// ======================================================================================
// ======================================================================================




DHTML = new DHTML();

function DHTML()
{
	if (browserDetector.isIE) {
		this.getElement				= getElement_IE;
		this.setStyle				= setStyle_IE;
		this.cancelBubble			= cancelBubble_IE;

		this.getHeight				= getHeight_IE;
		this.getWidth				= getWidth_IE;

		this.getX					= getX_IE;
		this.getY					= getY_IE;
		this.getXRel				= getXRel_IE;
		this.getYRel				= getYRel_IE;
		
		this.setX					= setX_IE;
		this.setY					= setY_IE;
		this.setXRel			= setXRel_IE;
		this.setYRel			= setYRel_IE;
		
		this.get_ParentContainer 	= get_ParentContainer_IE;
		this.get_ParentForm		 	= get_ParentForm_IE;
		
		this.get_EventSource		= get_EventSource_IE;
		
		this.setFocus				= setFocus_IE;
		
		this.Write					= write_IE;
		
		this.UpdateState	= UpdateState_IE;
		
		this.DHTML					= DHTML_IE;
		
		this.getWindowWidth = getWindowWidth_IE;
		this.getWindowHeight = getWindowHeight_IE;
		
	}
	else if (browserDetector.isOpera) {
		this.getElement			= getElement_OP;
		this.setStyle			= setStyle_OP;
		this.cancelBubble		= cancelBubble_OP;
		
		this.getHeight			= getHeight_OP;
		this.getWidth			= getWidth_OP;
		
		this.getX			= getX_OP;
		this.getY			= getY_OP;
		this.getXRel			= getXRel_OP;
		this.getYRel			= getYRel_OP;
		
		this.setX			= setX_OP;
		this.setY			= setY_OP;
		this.setXRel			= setXRel_OP;
		this.setYRel			= setYRel_OP;
		
		this.get_ParentContainer 	= get_ParentContainer_OP;
		this.setFocus			= setFocus_OP;
		this.Write			= write_OP;

		
		this.UpdateState		= UpdateState_OP;
		
		this.DHTML			= DHTML_OP;
	}
	else if (browserDetector.isMozilla) {
		this.getElement			= getElement_Mozilla;
		this.setStyle			= setStyle_Mozilla;
		this.cancelBubble		= cancelBubble_Mozilla;
		
		this.getHeight			= getHeight_Mozilla;
		this.getWidth			= getWidth_Mozilla;
		
		this.get_EventSource		= get_EventSource_Mozilla;
		
		this.getX			= getX_Mozilla;
		this.getY			= getY_Mozilla;
		this.getXRel			= getXRel_Mozilla;
		this.getYRel			= getYRel_Mozilla;
				
		this.setX			= setX_Mozilla;
		this.setY			= setY_Mozilla;
		this.setXRel			= setXRel_Mozilla;
		this.setYRel			= setYRel_Mozilla;
		
		this.get_ParentContainer 	= get_ParentContainer_Mozilla;
		this.get_ParentForm 	= get_ParentForm_Mozilla;
		this.setFocus			= setFocus_Mozilla;
		this.Write			= write_Mozilla;
		
		this.UpdateState		= UpdateState_Mozilla;
		
		this.DHTML			= DHTML_Mozilla;
		
		this.getWindowWidth = getWindowWidth_Mozilla;
		this.getWindowHeight = getWindowHeight_Mozilla;
	}
	else if (browserDetector.isNetscape) {
		this.getElement		= getElement_NS6;
		this.setStyle		= setStyle_NS6;
		this.cancelBubble	= cancelBubble_NS6;
		
		this.getHeight		= getHeight_NS6;
		this.getWidth		= getWidth_NS6;
		
		this.getX			= getX_NS6;
		this.getY			= getY_NS6;
		this.getXRel		= getXRel_NS6;
		this.getYRel		= getYRel_NS6;
		
		this.setX			= setX_NS6;
		this.setY			= setY_NS6;
		this.setXRel	= setXRel_NS6;
		this.setYRel	= setYRel_NS6;
		
		this.UpdateState	= UpdateState_NS6;
		
		this.DHTML			= DHTML_NS6;
	}
	else if (browserDetector.isNavigator) {
		this.getElement		= getElement_NS;
		this.setStyle		= setStyle_NS;
		this.cancelBubble	= cancelBubble_NS;
		
		this.getHeight		= getHeight_NS;
		this.getWidth		= getWidth_NS;
		
		this.getX			= getX_NS;
		this.getY			= getY_NS;
		this.getXRel		= getXRel_NS;
		this.getYRel		= getYRel_NS;
		
		this.setX			= setX_NS;
		this.setY			= setY_NS;
		this.setXRel	= setXRel_NS;
		this.setYRel	= setYRel_NS;
		
		this.UpdateState	= UpdateState_NS;
		
		this.DHTML			= DHTML_NS;
		
		
	}
	
	this.setNameStyle	=	setNameStyle;
	
	this.hideObj		=	hideObj;
	this.showObj		=	showObj;
	
	this.showElement	=	showElement;
	
	this.setHeight		=	setHeight;
	this.setWidth		=	setWidth;
	
	this.setXRelTo		=	setXRelTo;
	this.setYRelTo		=	setYRelTo;
	
}