var isNav4, isIE4, isNav6 = false;
var range = "";
var styleObj = "";

if (navigator.appVersion.charAt(0) >= 4) {
	if (navigator.appName == "Netscape") {
		if (navigator.appVersion.charAt(0) >= 5) {
			isNav6 = true;
		}
		else {
			isNav4 = true;
		}
	}
	else {
		isIE4 = true;
		range = "all.";
		styleObj = ".style";
	}
}

var origWidth, origHeight = 0;

function doResize () {
	if ((getWindowInnerWidth() != origWidth) || (getWindowInnerHeight() != origHeight)) {
		if (navigator.platform.indexOf("Win") != -1) {
			window.location.reload();
		}
		else {
			window.history.go(0);
		}
	}
}

function getObject(obj) {
	var theObj;
	if (typeof obj == "string") {
		if (isNav6) {
			theObj = document.getElementById(obj).style;
		}
		else {
			theObj = eval("document." + range + obj + styleObj);
		}
	}
	else {
		theObj = obj;
	}
	return theObj;
}

function shiftTo(obj, x, y) {
	var theObj = getObject(obj);
	if (isNav4)  {
		theObj.moveTo(x,y);	
	}
	else if (isIE4) {
		theObj.pixelLeft = x;
		theObj.pixelTop = y;
	}
	else if (isNav6) {
		theObj.left = x;
		theObj.top = y;
	}
}

function shiftBy (obj, deltaX, deltaY) {
	var theObj = getObject(obj);
	if (isNav4) {
		theObj.moveBy(deltaX, deltaY);
	}
	else if (isIE4) {
		theObj.pixelLeft += deltaX;
		theObj.pixelTop += deltaY;
	}
	else if (isNav6) {
		theObj.left = parseInt(theObj.left) + deltaX;
		theObj.top = parseInt(theObj.top) + deltaY;
	}
}
 
function getObjectLeft(obj) {
	var theObj = getObject(obj);
	if (isNav4) {
		return theObj.left;	
	}
	else if (isIE4) {
		return theObj.pixelLeft;
	}
	else if (isNav6) {
		return parseInt(theObj.left);
	}
}

function getObjectTop(obj) {
	var theObj = getObject(obj);
	if (isNav4) {
		return theObj.top;	
	}
	else if (isIE4) {
		return theObj.pixelTop;
	}
	else if (isNav6) {
		return parseInt(theObj.top);
	}
}

function setObjectLeft(obj, x) {
	var theObj = getObject(obj);
	if (isNav4) {
		theObj.moveTo(x, getObjectTop(theObj));	
	}
	else if (isIE4) {
		theObj.pixelLeft = x;
	}
	else if (isNav6) {
		theObj.left = x;
	}
}

function setObjectTop(obj, y) {
	var theObj = getObject(obj);
	if (isNav4) {
		theObj.moveTo(getObjectLeft(theObj), y);	
	}
	else if (isIE4) {
		theObj.pixelTop = y;
	}
	else if (isNav6) {
		theObj.top = y;
	}
}

function getObjectHeight(obj) {
	if (isNav4) {
	var theObj = getObject(obj);
		return theObj.document.height;
	}
	else if (isIE4) {
		return eval("document.all." + obj + ".clientHeight");
	}
	else if (isNav6) {
		return document.getElementById(obj).offsetHeight;
	}
}

function getObjectWidth(obj) {
	var theObj = getObject(obj);
	if (isNav4) {
		return theObj.document.width;
	}
	else if (isIE4) {
		return eval("document.all." + obj + ".clientWidth");
	}
	else if (isNav6) {
		return document.getElementById(obj).offsetWidth;
	}
}

function show () {
	var theObj;
	for (var i = 0; i < show.arguments.length; i++) {
		theObj = getObject(show.arguments[i]);
		theObj.visibility = "visible";
	}
}

function hide () {
	var theObj;
	for (var i = 0; i < hide.arguments.length; i++) {
		theObj = getObject(hide.arguments[i]);
		theObj.visibility = "hidden";
	}
}

function getWindowInnerHeight () {
	if ((isNav4) || (isNav6)) {
		return window.innerHeight;
	}
	else if (isIE4) {
		return document.body.clientHeight;
	}
}

function getWindowInnerWidth () {
	if ((isNav4) || (isNav6)) {
		return window.innerWidth;
	}
	else if (isIE4) {
		return document.body.clientWidth;
	}
}

