
var ie, n4, n5
var coll=""
var coll2=""
var styleObj=""
if (document.all) { ie=true; coll="all."; styleObj=".style" }
else if (document.layers) { n4=true } 
else { n5=true; coll="getElementById('"; coll2="')"; styleObj=".style" }

// Convert object name string or object reference
// into a valid object reference
function getObjectStyle(obj) {
	var theObj
	if (typeof obj == "string") { theObj=eval("document." + coll + obj + coll2 + styleObj) }
	else { theObj=obj }
	return theObj
}

function getObject(obj) {
	var theObj
	if (typeof obj == "string") { theObj=eval("document." + coll + obj + coll2) }
	else { theObj=obj }
	return theObj
}

// Positioning an object at a specific pixel coordinate
function shiftTo(obj, x, y) {
	var theObj=getObjectStyle(obj)
	if (n4||n5) {
		theObj.left=x;theObj.top=y
	} else {
		theObj.pixelLeft=x;theObj.pixelTop=y
	}
}

function getObjWidth(obj) {
	if (n4) {
		return obj.clip.width
	} else if (n5) {
		return obj.style.width
	} else {
		return obj.clientWidth
	}
}

function getObjHeight(obj) {
	if (n4) {
		return obj.clip.height
	} else if (n5) {
		return obj.style.height
	} else {
		return obj.clientHeight
	}
}

// Moving an object by x and/or y pixels
function shiftBy(obj, deltaX, deltaY) {
	var theObj=getObjectStyle(obj)
	var newX=parseInt(theObj.left)+deltaX
	var newY=parseInt(theObj.top)+deltaY
	shiftTo(theObj,newX,newY)
}

// Setting the z-order of an object
function setZIndex(obj, zOrder) {
	var theObj=getObjectStyle(obj)
	theObj.zIndex=zOrder
}

// Setting the background color of an object
// in NS4 you cannot set the color of the div in its style definition
// if you intend to call this function to change it
// or the text in the div will retain that color
// even after you call setBGColor() 
function setBGColor(obj, color) {
	var theObj=getObjectStyle(obj)
	if (n4) {
		theObj.bgColor=color
	} else {
		theObj.backgroundColor=color
	}
}

// Setting the visibility of an object to visible
function show(obj) {
	var theObj=getObjectStyle(obj)
	theObj.visibility="visible"
}

// Setting the visibility of an object to hidden
function hide(obj) {
	var theObj=getObjectStyle(obj)
	theObj.visibility="hidden"
}

// Retrieving the x coordinate of a positionable object
function getObjectLeft(obj)  {
	var theObj=getObjectStyle(obj)
	if (n4) {
		return theObj.left
	} else {
		return theObj.pixelLeft
	}
}

// Retrieving the y coordinate of a positionable object
function getObjectTop(obj)  {
	var theObj=getObjectStyle(obj)
	if (n4) {
		return theObj.top
	} else {
		return theObj.pixelTop
	}
}

function createDiv(n,w,h,bg,c,x,y) {
	td='<DIV ID="'+n+'" STYLE="'
	td+='position: absolute; z-index:0; color:green; '
	if (bg!='') td+='background-color:'+bg+'; layer-background-color:'+bg+'; '
	td+='left:'+x+'px; top:'+y+'px; width:'+w+'px; height:'+h+'px; clip:rect(0,'+w+','+h+',0)'
	td+='>'+c+'dsad</DIV>'
	alert(td)
	document.write(td)
	}

function createDiv(n,w,h,bg,c,x,y) {
	ts='<STYLE>#'+n+'{'
	ts+='position: absolute; z-index:0; '
	ts+='left:'+x+'px; top:'+y+'px; '
	if (h!='') ts+='width:'+w+'px; height:'+h+'px; clip:rect(0,'+w+','+h+',0)'
	ts+='}</STYLE>'
	td='<DIV ID="'+n+'">'+c+'</DIV>'
	//alert(ts+td)
	document.write(ts+td);
	if (bg!='') setTimeout("setBGColor('"+n+"','"+bg+"')",100);
	setTimeout("shiftTo('"+n+"',"+x+","+y+")",100)
	}
