var isID     = false;
var isAll    = false;
var isLayers = false;

/*  
function startUp() {
}
*/ 
initializeDOM();

function initializeDOM() {
	if (document.getElementById) {
		isID = true;
	} else {
		if (document.all) {
			isAll = true;
		} else {
			browserVersion = parseInt(navigator.appVersion);
			if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {
				isLayers = true;
			}
		}
	}
}

function width() {
	if (window.innerWidth != null) return window.innerWidth;
	if (document.body.clientWidth) return document.body.clientWidth;
}

function height() {
	if (window.innerHeight != null) return window.innerHeight;
	if (document.body.clientHeight) return document.body.clientHeight;
}

function objectHeight(objectID) {
    var oObject = getObject(objectID);
    if (oObject.offsetHeight) return oObject.offsetHeight;
    if (oObject.clip.height)  return oObject.clip.height;
}

function objectWidth(objectID) {
    var oObject = getObject(objectID);
    if (oObject.offsetWidth) return oObject.offsetWidth;
    if (oObject.clip.width)  return oObject.clip.width;
}

function getObject(objectID) {
	if (isID)     return document.getElementById(objectID);
	if (isAll)    return document.all[objectID];
	if (isLayers) return document.layers[objectID]; 
}

function getObjectStyle(objectID) {
	if (isID)     return document.getElementById(objectID).style;
	if (isAll)    return document.all[objectID].style;
	if (isLayers) return document.layers[objectID]; 
}


function setAvailableSize() {        

    var screenWidth = screen.width;
    var screenHeight = screen.height;
    var ratio = screenHeight / screenWidth;
    
    var availableWidth = objectWidth('content');
    if (availableWidth > screenWidth) {
        availableWidth  = screenWidth - 100;
    }
    var availableHeight = Math.round(ratio * availableWidth);

    var oAvailableWidth = getObject('ctl00_AvailableWidth');
    var oAvailableHeight = getObject('ctl00_AvailableHeight');
    
    oAvailableWidth.value = availableWidth - 50; 
    oAvailableHeight.value = availableHeight - 350; 
    
    return true;
}


