var blnAll = document.all;
var blnEbi = document.getElementById;
var blnLay = document.layers;

function getRef(strId) {
    if (eval('document.' + strId)) return eval('document.' + strId);
    if (document.all[strId]) return document.all[strId];
    if (document.getElementById(strId)) return document.getElementById(strId);
    return null;
}

function getPageTopY() {
    return document.body.scrollTop;
}

function getPageWidth() {
	/*if (window.innerHeight && window.scrollMaxY) {	
		intPageWidth = document.body.scrollWidth;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		intPageWidth = document.body.scrollWidth;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		intPageWidth = document.body.offsetWidth;
	}*/
	//return intPageWidth;
	return document.body.clientWidth;
}

function getPageHeight() {
	/*if (window.innerHeight && window.scrollMaxY) {	
		intPageHeight = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		intPageHeight = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		intPageHeight = document.body.offsetHeight;
	}*/
	//return intPageHeight;
    return document.body.clientHeight;
}

function DHTMLObject(strId) {
    this.blnInit = false;
    this.objRef = getRef(strId);
	if (this.objRef && this.objRef.style) this.blnInit = true;
}

DHTMLObject.prototype.setInnerHTML = function(strContent) {
    if (this.blnInit) {
        //this.objRef.innerHTML = strContent;
		
		this.objRef.innerHTML = '';
		var objNewDiv = document.createElement("div");
		objNewDiv.innerHTML = strContent;
		this.objRef.appendChild(objNewDiv);

    }
}

DHTMLObject.prototype.setDisplay = function(blnDisplay) {
    if (this.blnInit) {
        this.objRef.style.display = ((blnDisplay)?'inline':'none');
    }
}

DHTMLObject.prototype.switchDisplay = function() {
    if (this.blnInit) {
        this.objRef.style.display = ((this.objRef.style.display == 'none')?'inline':'none');
    }
}

DHTMLObject.prototype.setVisibility = function(blnVisibility) {
    if (this.blnInit) {
        this.objRef.style.visibility = ((blnVisibility)?'visible':'hidden');
    }
}

DHTMLObject.prototype.switchVisibility = function() {
    if (this.blnInit) {
        this.objRef.style.visibility = ((this.objRef.style.visibility == 'hidden')?'visible':'hidden');
    }
}

DHTMLObject.prototype.setXY = function(intX, intY) {
    if (this.blnInit) {
        this.objRef.style.left = intX;
        this.objRef.style.top = intY;
    }
}

DHTMLObject.prototype.setX = function(intX) {
    if (this.blnInit) {
        this.objRef.style.left = intX;
    }
}

DHTMLObject.prototype.setY = function(intY) {
    if (this.blnInit) {
        this.objRef.style.top = intY;
    }
}

DHTMLObject.prototype.getHeight = function() {
    if (this.blnInit) {
        return this.objRef.clientHeight;
    } else {
        return null;
    }
}

DHTMLObject.prototype.getWidth = function() {
    if (this.blnInit) {
        return this.objRef.clientWidth;
    } else {
        return null;
    }
}

DHTMLObject.prototype.setWidth = function(strWidth) {
    if (this.blnInit) {
        this.objRef.style.width = strWidth;
    }
}
DHTMLObject.prototype.setHeight = function(strHeight) {
    if (this.blnInit) {
        this.objRef.style.height = strHeight;
    }
}
DHTMLObject.prototype.centerHorizontal = function() {
	if (this.blnInit) {
		intPageWidth = getPageWidth();
		this.setX(parseInt((intPageWidth / 2) - (this.getWidth() / 2)));
	}
}

