var isIE = (window.navigator.appName == "Microsoft Internet Explorer");
var isNS = (window.navigator.appName == "Netscape");

function getInnerWidth() {
	if(window.innerWidth) return window.innerWidth;
	var x = document.body.parentElement;
	if(x&&x.clientWidth) return x.clientWidth;
	return 1024;
}

function getInnerHeight() {
	if(window.innerHeight) return window.innerHeight;
	var x = document.body.parentElement;
	if(x&&x.clientHeight) return x.clientHeight;
	return 768;
}

function getWindowLeft() {
	if(window.left) return window.left;
	if(window.screenX) return window.screenX;
	return 0;
}

function getWindowTop() {
	if(window.left) return window.top;
	if(window.screenX) return window.screenY;
	return 0;
}

// Append "px" suffix if not present
function px(str) {
	if(str.length==0) {
		return "0px";
	}
	str = ""+str;
	if(str.endsWith("px")) return str;
	return str+"px";
}

// Strip "px" suffix if present
function nopx(str) {
	if(str.length==0) {
		return 0;
	}
	str = ""+str;
	if(str.endsWith("px")) return parseInt(str.substr(0,str.indexOf("px")));
	return parseInt(str);
}

// Sum passed parameters; each parameter is assumed to have "px" suffix.
function sumpx() {
	var x=0;
	for(var i=0;i<arguments.length;++i) x+=nopx(arguments[i]);
	return px(x);
}

