function docid(elementId)  { if (document.getElementById) { return document.getElementById(elementId); } else if (document.all) { return document.all[elementId]; } else if (document.layers) { return document.layers[elementId]; } }
noflashMsg = '';
pageLoaded = false;

/*  Override JavaScript defined text with a message from resource bundles set outside of this script.
	Since the object may or may not exist within the DOM existence is checked until page has loaded.
																		author: obacher@pironet-ndh.com */
langFlashMsg = new function() {
	this.hasRunCheck = false; // call it only once (avoid dupe call by fixFloats)	
	this.call = function call() {
		var tmpA = docid('calculators_noflashmsg_content');
		if (noflashMsg && tmpA && !this.hasRunCheck) {
			tmpA.innerHTML   = noflashMsg;
			this.hasRunCheck = true;
		}
		else if (!window.pageLoaded) setTimeout("langFlashMsg.call();",100);
	}
};
langFlashMsg.call();

/*  HACK: checks for the existence of div 'page_bgcol_fix' to update backgroundColor of 'page_content'.
	This check is repeatedly performed untill the page has completely loaded or both divs are available. 
																		author: obacher@pironet-ndh.com */
fixBackColor = new function() {
	this.hasRunCheck = false; // call it only once (avoid dupe call by fixFloats)
	this.call = function call() {
		var tmpA = docid('page_content');
	    var tmpB = docid('page_bgcol_fix');
		if (tmpA && tmpB && !this.hasRunCheck) {
			tmpA.style.backgroundColor = tmpB.style.backgroundColor;
			this.hasRunCheck = true;
		}
		else if (!window.pageLoaded) setTimeout("fixBackColor.call();",100);
	}
};
fixBackColor.call();

/*  HACK: incorrect usage of floating divs (not clearing floats correctly) is corrected with this quickfix.
	It sets the vertical page spacer to the height of 'page_content' avoiding content overlapping footer.
	Besides that it has the honorable job informing the other functions that the page completed loading.
																		author: obacher@pironet-ndh.com */
fixFloats = new function() {
    this.orig = window.onload;
    this.call = function call() {
    	var tmpA = docid('page_spacer');
    	var tmpB = docid('page_content_start');
    	if (tmpA && tmpB) {
	        if (tmpA.offsetHeight<tmpB.offsetHeight) tmpA.style.height = tmpB.offsetHeight+"px";
	        pageLoaded = true;
	        fixBackColor.call(); 						// ensure these functions get called at least...
	        langFlashMsg.call(); 						// ... once after the page has completely loaded.
	        if (typeof this.orig=="function") this.orig(); // call original window.onload function.
	    }
    }
    window.onload = function(){ fixFloats.call(); }     
};