
// ****** general ******

function getStyleObj(which)
	{
	return "document.getElementById('" + which + "').style"
	}
	
function getCurrentStyleObj(which)
	{
	return "document.getElementById('" + which + "').currentStyle"
	}
	
function exists(which)
	{
	if (document.getElementById(which))
		{
		return true
		}
	else
		{
		return false
		}
	}
	
	
// ****** document dimensions ******	
	
function bodyEl(which)
	{
	return eval("document.body.client" + which)
	}
	
function win(which)
	{
	return eval("document.body.offset" + which)
	}
		
function page(which)
	{
	return eval("document.body.scroll" + which)
	}
		
	
// ****** display ******

function toggleDisplay(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elDisplay = elStyleObj.display
	elDisplay == "none" ? elDisplay = "" : elDisplay = "none"
	elStyleObj.display = elDisplay
	}
	
function reveal(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.display = ""
	}
	
function conceal(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.display = "none"
	}
		
	
// ****** colours ******

function getColor(which,type)
	{
	elCurrentStyleObj = eval(getCurrentStyleObj(which))
	theColour = eval("elCurrentStyleObj." + type + "Color")
	return theColour
	}

function shiftColor(theColour,degree)
	{
	var colourChars = new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f')
	var newColour = "#"
	var newChar = ""
	for (i=0 ; i<theColour.length ; i++)
		{
		colourLoop:
		for(j=0 ; j<colourChars.length ; j++)
			{
			if (colourChars[j] == theColour.charAt(i))
				{
				newChar = (j+degree > colourChars.length-1) ? colourChars[colourChars.length-1] : (j+degree > 0) ? colourChars[j+degree] : 0
				break colourLoop
				}
			}
		newColour += newChar
		}
	return newColour
	}
	
		
// ****** visibility ******

function toggleVisibility(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elVisibility = elStyleObj.visibility
	elVisibility == "visible" ? elVisibility = "hidden" : elVisibility = "visible"
	elStyleObj.visibility = elVisibility
	}
	
function show(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.visibility = "visible"
	}
	
function hide(which)
	{
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.visibility = "hidden"
	}
		
	
// ****** z-index ******

function setZindex(which,Zindex)
	{
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.zIndex = Zindex
	}
	
	
// ****** height & width ******

function getElHeight(which)
	{	
		return document.getElementById(which).clientHeight
	}
	
function getElWidth(which)
	{	
	return document.getElementById(which).clientWidth
	}
	
function setElHeight(which,height)
	{	
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.height = height
	}
	
function setElWidth(which,width)
	{	
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.width = width
	}
		
	
// ****** top & left ******

function getElTop(which)
	{
	return document.getElementById(which).offsetTop
	}
	
function getElLeft(which)
	{
	return document.getElementById(which).offsetLeft
	}
	
function setElLeft(which,left)
	{	
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.left = left
	}
	
function setElTop(which,top)
	{	
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.top = top
	}

	
// ****** background position ******

function setElBGPos(which, position)
	{	
	elStyleObj = eval(getStyleObj(which))
	elStyleObj.backgroundPosition = position
	}
