// JavaScript Document
var isNav4;
var isIE4;
var range = "";
var styleObj = "";
if (navigator.appVersion.charAt(0) == "4") {
	if (navigator.appName == "Netscape") {
		isNav4 = true;
	}
	else if (navigator.appVersion.indexOf("MSIE") != -1) {
		range = "all.";
		styleObj = ".style";
//		alert("IE");
		isIE4 = true;
	}
}

function XGetObj(objectName) {
	var e;
	if(typeof(objectName)!='string')
		return objectName;
	if(document.getElementById)
		e=document.getElementById(objectName);
	else if(document.all)
		e=document.all[objectName];
	else e=null;
	return e;	
}

function shiftTo(obj, x, y) {
	var theObj;
	theObj = XGetObj(obj);
	if (isNav4) {
		theObj.moveTo(x,y);
	}
	else if (isIE4){
		theObj.style.pixelLeft = x;
		theObj.style.pixelTop = y;
	}
	else {
		theObj.style.left = x + "px";
		theObj.style.top = y + "px";
	}
}
function shiftBy(obj, deltaX, deltaY) {
	var theObj = XGetObj(obj)
	if (isNav4) {
		theObj.moveBy(deltaX, deltaY);
	}
	else if (isIE4) {
		theObj.style.pixelLeft += deltaX;
		theObj.style.pixelTop += deltaY;
	}
	else {
		theObj.style.left += x + "px";
		theObj.style.top += y + "px";
	}
}
function XShow(obj) {
	var theObj = XGetObj(obj);
	if (isIE4)
		theObj.style.visibility = "visible";
	else
		theObj.visibility = "visible";
}
function XHide(obj) {
	var theObj = XGetObj(obj);
	theObj.style.visibility = "hidden";
}
function cmIsTRNode (obj) {
	var tagName = obj.tagName;
	return tagName == "TR" || tagName == "tr" || tagName == "Tr" || tagName == "tR";
}
function getObjectLeft(obj) {
	var theObj = XGetObj(obj);
	if (isNav4) {
		return theObj.style.left;
	}
	else {
		return theObj.pixelLeft;
	}
}
function getObjectTop(obj) {
	var theObj = XGetObj(obj);
	if (isNav4) {
		return theObj.style.top;
	}
	else {
		return theObj.pixelTop;
	}
}
function getObjWidth (obj) {	
	var width = obj.offsetWidth;
	if (width > 0 || !cmIsTRNode (obj))
		return width;
	if (!obj.firstChild)
		return 0;
	return obj.lastChild.offsetLeft - obj.firstChild.offsetLeft + getObjWidth (obj.lastChild);
}
function getObjHeight (obj) {
	var height = obj.offsetHeight;
	if (height > 0 || !cmIsTRNode (obj))
		return height;
	if (!obj.firstChild)
		return 0;
	return obj.firstChild.offsetHeight;
}
function getLeftToCenter (obj) {
	var body = document.body;
	var widthscreen = 0;
	if (window.innerWidth)
		widthscreen = window.innerWidth;
	else if (body.clientWidth)
		widthscreen = body.clientWidth;
	else
		widthscreen = screen.width;
	var widthobj = getObjWidth(obj);
	var left = parseInt((widthscreen - widthobj)/2);
	return left;
}
function getTopToMiddle (obj) {
	var body = document.body;
	var heightscreen = 0;
	if (window.innerHeight) {
		heightscreen = window.innerHeight;
	}
	else if (body.clientHeight) {
		heightscreen = body.clientHeight;
	}
	else
		heightscreen = screen.height - 168;
	var heightobj = getObjHeight(obj);
	var top = parseInt((heightscreen - heightobj)/2);
	return top;
}
function XMoveObjToX (obj, xposition) {
	var topobj = getObjectTop(obj);
	shiftTo(obj, xposition, topobj);
}
function XShiftCenter (obj) {
	var left = getLeftToCenter(obj);
//	alert("Widthscreen: " + widthscreen + " Widthobj: " + widthobj + " Left:" + left);
	XMoveObjToX (obj, left);
}
function XMoveObjToY (obj, yposition) {
	var leftobj = getObjectLeft(obj);
	shiftTo(obj, leftobj, yposition);
}
function XShiftMiddle (obj) {
	var top = getTopToMiddle(obj);
//	alert("Heightscreen: " + heightscreen + " Heightobj: " + heightobj + " Top:" + top);
	XMoveObjToY (obj, top);
}
function XShiftCenterMiddle (obj) {
	var theObj = XGetObj(obj);
	var left = getLeftToCenter(theObj);
	var top = getTopToMiddle(theObj);
	shiftTo(theObj, left, top);
}
