
function propertyExists(object, name) { return (name in object); }

function windowWidth() {
	if (propertyExists(window, "innerWidth") && parseInt(window.innerWidth) != 0) return parseInt(window.innerWidth);
	if (propertyExists(document, "documentElement") && propertyExists(document.documentElement, "clientWidth") && parseInt(document.documentElement.clientWidth) != 0) return parseInt(document.documentElement.clientWidth);
	if (propertyExists(document, "body") && propertyExists(document.body, "clientWidth") && parseInt(document.body.clientWidth) != 0) return parseInt(document.body.clientWidth);
	return 0;
}
function windowHeight() {
	if (propertyExists(window, "innerHeight") && parseInt(window.innerHeight) != 0) return parseInt(window.innerHeight);
	if (propertyExists(document, "documentElement") && propertyExists(document.documentElement, "clientHeight") && parseInt(document.documentElement.clientHeight) != 0) return parseInt(document.documentElement.clientHeight);
	if (propertyExists(document, "body") && propertyExists(document.body, "clientHeight") && parseInt(document.body.clientHeight) != 0) return parseInt(document.body.clientHeight);
	return 0;
}

