var LayerRef;
var StyleRef;

function GetLayer( ID ) {
	if( document.getElementById )
		LayerRef = document.getElementById( ID );
	else if( document.all )
		LayerRef = document.all[ ID ];
	else if( document.layers )
		LayerRef = document.layers[ ID ];
	return LayerRef;
}

function GetLayerStyle( ID ) {
	if( document.getElementById ) {
		LayerRef = document.getElementById( ID );
		StyleRef = LayerRef.style;
	} else if( document.all )
		StyleRef = document.all[ ID ].style;
	else if( document.layers )
		StyleRef = document.layers[ ID ];
	return StyleRef;
}

function GetProperties( WhatObject ) {
	Props = "";
	for( var Prop in WhatObject ) Props += Prop + "\n";
	return Props;
}

function MoveLayer( Name, XPos, YPos ) {
	Ref = GetLayerStyle( Name );
	Ref.left = XPos;
	Ref.top = YPos;
}

function MoveLayerBy( Name, XDist, YDist ) {
	Ref = GetLayerStyle( Name );
	MoveLayer( Name, parseInt( Ref.left ) + XDist, parseInt( Ref.top ) + YDist );
}

function SetLayerXPos( Name, Pos ) {
	Ref = GetLayerStyle( Name );
	Ref.left = Pos;
}

function SetLayerYPos( Name, Pos ) {
	Ref = GetLayerStyle( Name );
	Ref.top = Pos;
}

function GetLayerXPos( Name ) {
	Ref = GetLayerStyle( Name );
	return parseInt( Ref.left );
}

function GetLayerYPos( Name ) {
	Ref = GetLayerStyle( Name );
	return parseInt( Ref.top );
}

function GetLayerWidth( Name ) {
	Ref = GetLayer( Name );
	if( document.layers )
		what = parseInt( Ref.document.width );
	else if( document.all ) {
		what = parseInt( Ref.style.width );
		if( isNaN( what ) ) what = Ref.offsetWidth;
	} else
		what = Ref.offsetWidth;
	return what;
}

function GetLayerHeight( Name ) {
	Ref = GetLayer( Name );
	if( document.layers )
		what = parseInt( Ref.document.height );
	else if( document.all ) {
		what = parseInt( Ref.style.height );
		if( isNaN( what ) ) what = Ref.offsetHeight;
	} else
		what = Ref.offsetHeight;
	return what;
}

function ShowLayer( Name ) {
	Ref = GetLayerStyle( Name );
	Ref.visibility = "visible";
}

function HideLayer( Name ) {
	Ref = GetLayerStyle( Name );
	Ref.visibility = "hidden";
}

function LayerIsVisible( Name ) {
	Ref = GetLayerStyle( Name );
	visibility = new String( "" + Ref.visibility );
	visibility = visibility.toLowerCase();
	visible = !( visibility.indexOf( "hid" ) > -1 );
	return visible;
}

function ChangeLayerImage( Name, ImageName, ImageSrc ) {
	Ref = GetLayer( Name );
	ImagesRef = ( Ref.document ) ? Ref.document.images : Ref.ownerDocument.images;
	ImagesRef[ ImageName ].src = ImageSrc
}