/** * Form convenience Functions**  &copy;Copyright Mike Brockington 2004 - 2010 All rights reserved.*  Build Number:24:* This version, Copyright: 27/03/2007*/
/** @function Make results area visible if not already*/
function checkResultsVisible(){if(outputHidden){var strDivID="outputBlock";toggleHiddenDiv2(strDivID);outputHidden=false;}return true;}/**  Use object methods instead*/
var allResults="";/** Delete a DOM element, such as the context menu block
*  Function*  Nothing.*/
function removeElement(elementID){var target=document.getElementById(elementID);if(target){target.parentNode.removeChild(target);}else{logMsg("[20015A] Target element ("+elementID+") not found.", params={level:"error"});}}/** Create a menu block, adjacent to the DIV where the mouse was clicked*  Function*  Nothing.*/
function showContextMenu(callingObjectID, commandList)
{if(showOverlay){showOverlay();}thisCalculator.currentMenuRef=callingObjectID;if(document.getElementById("contextMenu") ){removeElement("contextMenu");}var target=document.getElementById(callingObjectID);var baseDiv=document.createElement("div");baseDiv.className="contextMenu";baseDiv.id="contextMenu";
if(commandList){var menuList=document.createElement("ul");var first=true;for(var i=0;i<commandList.length;i++){var menuItem=document.createElement("li");menuItem.className=commandList[i].icon+"Link";if(first){menuItem.className+=" first";first=false;}var thisLink=document.createElement("a");thisLink.setAttribute("href", "#");thisLink.setAttribute("name", "menuItem"+i);
thisLink.onclick=commandList[i].funcObj;thisLink.appendChild( document.createTextNode(commandList[i].caption));menuItem.appendChild( thisLink );menuList.appendChild( menuItem );}}var menuItem=document.createElement("li");var closeLink=document.createElement("a");closeLink.setAttribute("href", "#");closeLink.setAttribute("name", "hrefClose");
closeLink.onclick=close_menu_link;closeLink.appendChild( document.createTextNode("Close this menu"));menuItem.className="last";menuItem.appendChild( closeLink );menuList.appendChild( menuItem );baseDiv.appendChild( menuList );target.appendChild(baseDiv);if(!document.all){
baseDiv.style.top=target.offsetTop+"px";baseDiv.style.left=target.offsetLeft+target.offsetWidth+"px";}if(adjustOverlaySize){adjustOverlaySize();}}/** Remove the context menu from view*  Function*  Nothing.*/
function close_menu_link(){hideOverlay();removeElement('contextMenu');return true;}/**  Use 'appSettings' instead*/
var outputHidden=true;/*
* Application specific settings*/
var appSettings={outputHidden:true,logLevel:"all",oddLogLine:true,firstRun:true};/** Extends the Number prototype to give formatted output.*  String (Usually a) single character representing the currency in use.*  Function*  String: Formatted number, pre-fixed with given symbol.*/
Number.prototype.toCurrency=function(charCurrencySymbol){if(charCurrencySymbol)
{}else{charCurrencySymbol="";}return charCurrencySymbol+this.toFixed(2).addSeperators();}/** Extends the String prototype to give formatted output.*  String (Usually a) single character representing the currency in use.*  Function*  String: Formatted number, pre-fixed with given symbol.*/
String.prototype.toCurrency=function(charCurrencySymbol){var fltValue=parseFloat(this);
return fltValue.toCurrency(charCurrencySymbol);}/** Extends the Number prototype to give formatted output.* Uses String.prototype.addSeperators() to carry out formatting.*  String A single character to seperate each group of digits.*  Function*  String: Formatted number.*/
Number.prototype.addSeperators=function(charSeperator){if(charSeperator){return this.toString().addSeperators(charSeperator);}else{return this.toString().addSeperators();}}/*
* Extends the String prototype to give formatted output.*  String A single character to seperate each group of digits.*  Function*  String: Formatted number.*/
String.prototype.addSeperators=function(charSeperator){if(charSeperator){}else{charSeperator=",";}if(this.indexOf(".") > -1){if((this.indexOf(".") < 4) || (this.length < 4)){return this;
}var numParts=null;if(this.indexOf(".") > -1){numParts=this.split(".");}else{numParts=[this, ""];}return addSeperator(numParts[0], charSeperator)+"."+numParts[1];}else{return addSeperator(this, charSeperator);}}/** Used recursively to add numeric group seperators.*  String Collection of digits.*  String Character to use to seperate each group of digits.*  Function*  String: Formatted number.
*/
function addSeperator(strInput, charSeperator){if(charSeperator){}else{charSeperator=",";}if(strInput.length > 3){var front=strInput.slice(0,-3);var back=strInput.slice(-3);if(front.length > 3){return addSeperator(front, charSeperator)+charSeperator+back;}else{return front+charSeperator+back;}}else{return strInput;
}}/** deprecated*  Function*  Nothing.*/
function addResults(strResults){allResults+="<br>"+strResults;var outArea=document.getElementById("txtOutput");outArea.value+="\n"+strResults;}/** deprecated*  Function*  Nothing.*/
function addDecoration(strItem){switch(strItem){case "rule":allResults+="<hr>";var outArea=document.getElementById("txtOutput");outArea.value+="\n- - - - - - - - - - - - - - - - - -";
break;}}/** Record a message to the on-screen console*  Function*  Nothing.*/
function logMsg(strMessage, objParams){var outArea=document.getElementById("divConsole");var CSSclassName="logEntry";if(objParams && objParams.CSSclassName && (objParams.CSSclassName !="")){CSSclassName=objParams.CSSclassName;}if(appSettings.oddLogLine){appSettings.oddLogLine=false;CSSclassName+=" evenLogLine";
}else{appSettings.oddLogLine=true;CSSclassName+=" oddLogLine";}if(appSettings.logLevel){var logEntry=document.createElement("p");logEntry.appendChild( document.createTextNode( strMessage ));logEntry.className=CSSclassName;outArea.appendChild(logEntry);}}/** Update the on-screen Progress Indicator*  Function*  Nothing.*/
function updateProgress(indicName, objParams){
var thisProgress=document.getElementById(indicName);var barMarker=document.getElementById("barMarker");if(objParams && objParams.newValue && (isFinite(objParams.newValue) )){CR.progressBars[indicName].current=objParams.newValue;}else{CR.progressBars[indicName].current++;}if(objParams && objParams.maxValue && (isFinite(objParams.maxValue) )){CR.progressBars[indicName].max=objParams.maxValue;
barMarker.style.backgroundColor="#006600";}if(CR.progressBars[indicName].current > CR.progressBars[indicName].max){CR.progressBars[indicName].max=CR.progressBars[indicName].max * 1.5;}var thisVal=(100 * CR.progressBars[indicName].current / CR.progressBars[indicName].max );barMarker.style.width=thisVal+"%";var strMessage="Completed "+CR.progressBars[indicName].current+" of "+CR.progressBars[indicName].max;
thisProgress.removeChild(thisProgress.lastChild);thisProgress.appendChild( document.createTextNode( strMessage ));}/** Update the on-screen Progress Indicator upon task completion*  Function*  Nothing.*/
function completeProgress(indicName, objParams){var thisProgress=document.getElementById(indicName);var barMarker=document.getElementById("barMarker");
barMarker.style.width="100%";barMarker.style.backgroundColor="#00cc00";var strMessage="Complete.";thisProgress.removeChild(thisProgress.lastChild);thisProgress.appendChild( document.createTextNode( strMessage ));}/** Create an on-screen Progress Indicator*  Function*  Nothing.*/
function startProgress(indicName, objParams){logMsg("Task started at:"+appSettings.taskStartTime, params={level:"debug"});var thisProgress=document.getElementById(indicName);var CSSclassName="";
if(objParams && objParams.CSSclassName && (objParams.CSSclassName !="")){CSSclassName=objParams.CSSclassName;}if(!CR.progressBars){CR.progressBars=new Object();}CR.progressBars[indicName]=new Object();if(objParams && objParams.minValue && (isFinite(objParams.minValue) )){CR.progressBars[indicName].min=objParams.minValue;}else{CR.progressBars[indicName].min=0;}if(objParams && objParams.maxValue && (isFinite(objParams.maxValue) ))
{CR.progressBars[indicName].max=objParams.maxValue;}else{CR.progressBars[indicName].max=100;}if(objParams && objParams.currentValue && (isFinite(objParams.currentValue) )){CR.progressBars[indicName].current=objParams.currentValue;}else{CR.progressBars[indicName].current=0;}var detailInfo=document.createElement("H3");detailInfo.setAttribute("class", "detailInfo");detailInfo.appendChild( document.createTextNode( "Task Progress" ));
thisProgress.appendChild(detailInfo);var barWrapper=document.createElement("div");var barMarker=document.createElement("div");barWrapper.setAttribute("id", "barWrapper");barWrapper.setAttribute("class", "barWrapper");barMarker.setAttribute("id", "barMarker");barMarker.setAttribute("class", "barMarker");barMarker.style.height="1em";barMarker.style.width="1%";barMarker.appendChild( document.createTextNode( "" ));
barWrapper.appendChild( barMarker );thisProgress.appendChild(barWrapper);var strMessage="Progress Details";var detailInfo=document.createElement("p");detailInfo.setAttribute("class", "detailInfo");detailInfo.appendChild( document.createTextNode( strMessage ));thisProgress.appendChild(detailInfo);}/** Format a DOM element and print to the results area*  Function*  Nothing.*/
function recordResultDOM(objDOMelement, objParams){var CSSclassName="resultEntry";
if(objParams && objParams.CSSclassName && (objParams.CSSclassName !="")){CSSclassName=objParams.CSSclassName;}if(appSettings.oddResultsLine){appSettings.oddResultsLine=false;CSSclassName+=" evenResultsLine";}else{appSettings.oddResultsLine=true;CSSclassName+=" oddResultsLine";}objDOMelement.className=CSSclassName;recordResults(objDOMelement);
}/** Format and print to the results area*  Function*  Nothing.*/
function recordResultInline(strText){var outArea=document.getElementById("divResults");objDOMelement=document.createElement("span");objDOMelement.appendChild( document.createTextNode( strText ));objDOMelement.className="result";outArea.appendChild(objDOMelement);outArea.appendChild( document.createTextNode( " " ));}/** Format and print to the results area*  Function*  Nothing.*/

function recordResultList(strText){var CSSclassName="";if(appSettings.oddResultsLine){appSettings.oddResultsLine=false;CSSclassName+="oddResultsLine";}else{appSettings.oddResultsLine=true;CSSclassName+="evenResultsLine";}CSSclassName+=" resultEntry";if(appSettings.firstRun){var outBlock=document.getElementById("divResults");objDOMelement=document.createElement("ol");objDOMelement2=document.createElement("li");
objDOMelement2.appendChild( document.createTextNode( strText ));objDOMelement2.className=CSSclassName;objDOMelement.setAttribute("id", "listResults");objDOMelement.appendChild(objDOMelement2);outBlock.appendChild(objDOMelement);appSettings.firstRun=false;}else{var outArea=document.getElementById("listResults");objDOMelement=document.createElement("li");objDOMelement.appendChild( document.createTextNode( strText ));objDOMelement.className=CSSclassName;
outArea.appendChild(objDOMelement);}}/** Record a plain text message to the results area, wrapped in paragraph tags*  Function*  Nothing.*/
function recordResultText(strMessage, objParams){var CSSclassName="resultEntry";var itemAction="";if(objParams && objParams.CSSclassName && (objParams.CSSclassName !="")){CSSclassName=objParams.CSSclassName;}if(objParams && objParams.showActions ){if(CSSclassName.length > 0 ) 
{CSSclassName+=" ";}CSSclassName+="actionLink";itemAction=doActions;}if(CSSclassName.length > 0 ) {CSSclassName+=" ";}if(appSettings.oddResultsLine){appSettings.oddResultsLine=false;CSSclassName+="oddResultsLine";}else{appSettings.oddResultsLine=true;CSSclassName+="evenResultsLine";}var thisEntry=document.createElement("p");
if(objParams && objParams.labelText ){if(objParams.labelText.length > 0 ) {var thisLabel=document.createElement("span");thisLabel.appendChild( document.createTextNode( objParams.labelText ));thisEntry.appendChild( thisLabel );}}if(itemAction.length > 0 ) {addEvent(thisEntry, "click", itemAction);}thisEntry.appendChild( document.createTextNode( strMessage ));
thisEntry.className=CSSclassName;if(objParams && objParams.elementID ){thisEntry.id=objParams.elementID;}else{thisEntry.id="resultLine";}recordResults(thisEntry);}/** Record a DOM element to the results area*  Function*  Nothing.*/
function recordResults(objDOMelement, objParams){var outArea=document.getElementById("divResults");outArea.appendChild(objDOMelement);}/** Check if a variable contains a number that is useable by JavaScript
*  Function*  Boolean.*/
function isValidNumber(strFieldName){if((strFieldName===null) || (strFieldName=="")){return false;}var tempString="txt"+strFieldName;var thisInput=document.getElementById(tempString);if(thisInput){if(thisInput.value){if(isFinite(thisInput.value) ){return true;}}}return false;}/** Check if an HTML Select box has an item selected*  Function
*  Boolean.*/
function isItemChosen(strFieldName){if((strFieldName===null) || (strFieldName=="")){return false;}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){if(thisSelect.selectedIndex){var optionValue=thisSelect.options[thisSelect.selectedIndex].value;if((optionValue===null) || (optionValue=="") || (optionValue==0)){return false;
}return true;}}return false;}/** Get the Multiplier appropriate for the selected dimensional units*  Function*  Number*/
function getMultiplier(strFieldName){if((strFieldName===null) || (strFieldName=="")){return 1;}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){return thisSelect.options[thisSelect.selectedIndex].value;
}else{return 1;}}/** Get fixed numeric value from select box or 'combo-box'*  Function*  Number, or FALSE.*/
function getConstant(strOriginalFieldName){var strFieldName=strOriginalFieldName;if(strFieldName.indexOf("slct") !=0){strFieldName="slct"+strFieldName;}var thisInput=document.getElementById(strFieldName);if(thisInput){if(thisInput.type.indexOf("select")==0) {if(thisInput.selectedIndex)
{var selectValue=thisInput.options[thisInput.selectedIndex].value;if(selectValue=="Other"){}else{return selectValue;}}}}if(strOriginalFieldName.indexOf("txt") !=0){strFieldName="txt"+strOriginalFieldName;}thisInput=document.getElementById(strFieldName);if(thisInput){if(thisInput.type=="text") 
{return thisInput.value;}}return false;}/** Get the 'name' of a dimensional unit, empty string if nothing found.*  Function*  String*/
function getDimension(strFieldName){if((strFieldName===null) || (strFieldName=="")){return "";}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){
return thisSelect.options[thisSelect.selectedIndex].text;}else{return "";}}/** Get the selected choice of dimensional units*  Function*  String*/
function getUnits(strFieldName){if((strFieldName===null) || (strFieldName=="")){return "";}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){return thisSelect.options[thisSelect.selectedIndex].text;
}else{return "";}}/** Get the text selected in a particular select box*  Function*  String*/
function getOption(strFieldName){return getSelectText(strFieldName);}/** Get the text value selected in a particular select box*  Function*  String*/
function getSelectValue(strFieldName){if((strFieldName===null) || (strFieldName=="")){logMsg("[200148] getSelectValue:strFieldName is null", params={level:"error"});return 0;
}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){return thisSelect.options[thisSelect.selectedIndex].value;}else{return "";}}/** Get the text selected in a particular select box, identified explicitly*  Function*  String* Requires a DOM node, eg: getElementById('selectName') or a reference such as: document.formName.selectName*/
function getDOMSelectValue(objSelect){if(objSelect===null)
{logMsg("[200134] getDOMSelectValue:objSelect is null", params={level:"error"});}else{if(objSelect.selectedIndex > -1){return objSelect.options[objSelect.selectedIndex].value;}else{logMsg("[200135] getDOMSelectValue:selectedIndex ("+objSelect.selectedIndex+") not valid.", params={level:"error"});return "";}}return false;}/** Get the text selected in a particular select box*  Function*  String*/
function getSelectText(strFieldName)
{if((strFieldName===null) || (strFieldName=="")){return 0;}var tempString="slct"+strFieldName;var thisSelect=document.getElementById(tempString);if(thisSelect){return thisSelect.options[thisSelect.selectedIndex].text;}else{return "";}}/** Get the text from a particular text-input box*  Function*  String Will normally contain a number*/
function getValue(strFieldName){if((strFieldName===null) || (strFieldName==""))
{return 0;}var tempString="txt"+strFieldName;var thisInput=document.getElementById(tempString);if(thisInput){return thisInput.value;}else{return 0;}}/** Set the value of a particular form field*  Function*  Boolean Indicating success or failure*/
function setField(strFieldName, newValue){var thisInput=document.getElementById(strFieldName);if(thisInput){if(thisInput.type.indexOf("select")==0) 
{if(thisInput.selectedIndex){var indexFound=0;var searchFailed=true;for(var i=0;i<thisInput.options.length;i++){if(thisInput.options[i].text==newValue){indexFound=i;searchFailed=false;break;}}if(searchFailed) 
{for(var i=0;i<thisInput.options.length;i++){if(thisInput.options[i].text.indexOf( newValue)==0 ){indexFound=i;searchFailed=false;break;}}}if(searchFailed) {for(var i=0;i<thisInput.options.length;i++)
{if(thisInput.options[i].text.indexOf( newValue) > -1 ){indexFound=i;searchFailed=false;break;}}}if(searchFailed){var newOption=new Option(newValue, newValue, false, true);thisInput.add(newOption);return true;
}else{thisInput.selectedIndex=indexFound;return true;}}return false;}if(thisInput.type=="text") {thisInput.value=newValue;if(thisInput.value==newValue){return true;}return false;}}else{return false;}}/** Get the state of a particular radio button*  Function
*  Triple-state Boolean*/
function getRadioBoolean(strRadioItem) {if((strRadioItem===null) || (strRadioItem=="") ){return this.no_such_value;}var thisButton=document.getElementById(strRadioItem);if(thisButton){if(thisButton.checked){return true;}else{return false;}}else{
return this.no_such_value;}}/** Get the state of a particular select box*  Function*  Triple-state Boolean*/
function getSelectBoolean(strSelectName, strValueExpected){if((strSelectName===null) || (strValueExpected===null) || (strSelectName=="") || (strValueExpected==NaN)){return this.no_such_value;}var thisSelect=document.getElementById(strSelectName);
if(thisSelect){var thisValue="";if(thisSelect.selectedIndex > 0){thisValue=thisSelect.options[thisSelect.selectedIndex].value;}else{thisValue=thisSelect.options[0].value.toLowerCase();}if(thisValue==strValueExpected){return true;}else{return false;}}else{return this.no_such_value;}}/** Get the state of a particular select box
*  Function*  Triple-state Boolean*/
function isSelectTrue(strSelectName){if((strSelectName===null) || (strSelectName=="") ){return this.no_such_value;}var thisSelect=document.getElementById(strSelectName);var strValueExpected1="yes";var strValueExpected2="true";if(thisSelect){var thisValue="";if(thisSelect.selectedIndex > 0){thisValue=thisSelect.options[thisSelect.selectedIndex].value.toLowerCase();
}else{thisValue=thisSelect.options[0].value.toLowerCase();}if((strValueExpected1==thisValue ) || (strValueExpected2==thisValue )){return true;}else{return false;}}else{return this.no_such_value;}}/** Clear the results area*  Function*  Nothing*  Use logResult() instead.*/
function clearOutput(){if(document.getElementById("txtOutput") )
{document.getElementById("txtOutput").value="";}allResults="";}/** Remove all results from DOM formatted console*  Function* s None*  Nothing*/
function contextMenu_ClearOutput(){hideOverlay();clearOutput2(thisCalculator.currentMenuRef);}/** Hide the overlay DIV that "grey's Out" the rest of the page*  Function* s None*  Boolean Indicating success or failure*/
function hideOverlay(){objOverlay=document.getElementById('overlay');
if(objOverlay.style){objOverlay.style.display='none';return true;}logMsg("[200151] hideOverlay(): Unable to access objOverlay.style", params={level:"error"});return false;}/** Make the Overlay-div visible*  Function* s None*  Boolean Indicating success or failure*/
function showOverlay(){var objOverlay=document.getElementById('overlay');objOverlay.style.display='block';
}/** Set height of Overlay-div, so that it takes up the whole page*  Function* s None*  Nothing*/
function adjustOverlaySize(){var objOverlay=document.getElementById('overlay');objOverlay.style.height=(getPageWidth()+'px');}/** Get page width, in Pixels, as a bare integer* Core code from - quirksmode.org* Edit for Firefox by pHaez* Simplified from getPageSize() by MJB 05/04/2008 21:47:14*  Function* s None*  Integer*/
function getPageWidth(){var yScroll;
var windowHeight;if (window.innerHeight && window.scrollMaxY){yScroll=window.innerHeight+window.scrollMaxY;}else if (document.body.scrollHeight > document.body.offsetHeight){yScroll=document.body.scrollHeight;}else{yScroll=document.body.offsetHeight;}if (self.innerHeight){windowHeight=self.innerHeight;}else if (document.documentElement && document.documentElement.clientHeight){
windowHeight=document.documentElement.clientHeight;}else if (document.body){windowHeight=document.body.clientHeight;}if(yScroll < windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}return pageHeight;}/** Remove all results from DOM formatted console*  Function* s formField Optional field to give focus*  Nothing*/
function clearOutput2(formField)
{if(document.getElementById("divResults") ){var outArea=document.getElementById("divResults");if(outArea.hasChildNodes()){if(removeAllChildren(outArea) ){allResults="";if(thisCalculator && thisCalculator.clearCurrent){thisCalculator.clearCurrent();}}else{("[200103] Unable to remove child nodes from results area.", params={level:"error"});
}}else{logMsg("[200102] Unable to clear results area.", params={level:"error"});}}else{logMsg("[200101] Unable to find results area.", params={level:"error"});}if(document.getElementById(formField) ){document.getElementById(formField).focus();}}/** Extract the first available integer from the given string*  Function* s thisString*  null if an error occurs, or the first integer found.*/
function extractInteger(thisString)
{var digitPattern=/\d+/;if (digitPattern.test(thisString)) {retval=digitPattern.exec(thisString);if (retval==null){logMsg("[2000FD] Unable to extractInteger() from: "+thisString, params={level:"error"});return null}else{return retval[0];}}else{logMsg("[2000FE] Unable to extractInteger() from: "+thisString, params={level:"error"});return null}return null 
}/** Remove a single set of results from DOM formatted console*  Function* s objButton To give a reference to identify which set of results to delete*  Nothing*/
function clearSingleResult(objButton){if(document.getElementById("divResults") ){var outArea=document.getElementById("divResults");if(outArea.hasChildNodes()){if(removeAllChildren(outArea) ){}else{logMsg("[200109] Unable to remove child nodes from results area.", params={level:"error"});
}}else{logMsg("[20010B] Unable to clear results area.", params={level:"error"});}}else{logMsg("[20010C] Unable to find results area.", params={level:"error"});}allResults="";}/** Remove a single set of results from DOM formatted console*  Function*  Nothing*/
function clearLastResult(){if(document.getElementById("divResults") ){var outArea=document.getElementById("divResults");if(outArea.hasChildNodes())
{if(outArea.removeChild(outArea.lastChild) ){}else{logMsg("[20010D] Unable to remove last child node from results area.", params={level:"error"});}}else{}}else{logMsg("[20010F] Unable to find results area.", params={level:"error"});}}/** Replace a single string in a space-separated string.
*  Function*  String containing entire class-name string, which may contain multiple names*/
function replaceCSSName(oldCSSstring, oldValue, newClassName){if((oldCSSstring==null ) || (oldCSSstring=="" ) || (oldCSSstring==oldValue )){return newClassName;}var nameList=oldCSSstring.split(" ");if(nameList.length > 0){var retval="";for(var i=0;i<nameList.length;i++){if((nameList[i]==oldValue) || (nameList[i]==newClassName))
{}else{retval+=nameList[i]+" ";}}retval+=newClassName;return retval;}else{return newClassName;}}/** Replace a single set of results from DOM formatted console*  Function*  Nothing*/
function modifyResult(thisID, newDataObj, objParams){if(document.getElementById("divResults") ){var outArea=document.getElementById("divResults");if(outArea.hasChildNodes())
{if(document.getElementById(thisID) ){var thisBlock=document.getElementById(thisID);removeAllChildren(thisBlock);thisBlock.appendChild(newDataObj);if(objParams && objParams.CSSclassName && (objParams.CSSclassName !="") && objParams.oldClassName && (objParams.oldClassName !="")){var oldValue=objParams.oldClassName;var oldCSSstring=thisBlock.className;
var newClassName=objParams.CSSclassName;thisBlock.className=replaceCSSName(oldCSSstring, oldValue, newClassName);}}else{logMsg("[200110] Unable to find results area. thisID:"+thisID, params={level:"error"});}}else{}}else{logMsg("[200112] Unable to find results area.", params={level:"error"});
}}/** Replace a single set of results from DOM formatted console*  Function*  Nothing*/
function modifyLabel(thisID, newLabel){if(document.getElementById("divResults") ){var outArea=document.getElementById("divResults");if(outArea.hasChildNodes()){if(document.getElementById(thisID) ){var thisBlock=document.getElementById(thisID);var thisLabel=document.createElement("span");thisLabel.appendChild( document.createTextNode( newLabel ) );
if(thisBlock.hasChildNodes()){var firstNode=thisBlock.getElementsByTagName("span");if(firstNode && firstNode[0]){thisBlock.removeChild(firstNode[0]);}}if(thisBlock.hasChildNodes()){var currentContent=thisBlock.childNodes[0];thisBlock.insertBefore( thisLabel, currentContent );}else{thisBlock.appendChild( thisLabel );
}}else{logMsg("[200162] Unable to find results area. thisID:"+thisID, params={level:"error"});}}else{}}else{logMsg("[200164] Unable to find results area.", params={level:"error"});}}/** Remove all child nodes from a DOM tree / fragment*  Function*  Boolean Indicating success or failure*/
function removeAllChildren(DOMnode)
{if(DOMnode==undefined || DOMnode===null){return false;}while (DOMnode.hasChildNodes()){DOMnode.removeChild(DOMnode.firstChild);}return true;}/** Transform special characters into the corresponding HTML entity*  Function*  Escaped string*/
String.prototype.escapeHTML=function(){var strTemp=this;strTemp=strTemp.replace(/&/g, "&amp;");strTemp=strTemp.replace(/£/g, "&pound;");strTemp=strTemp.replace(/¥/g, "&yen;");
strTemp=strTemp.replace(/</g, "&lt;");strTemp=strTemp.replace(/\$/g, "&#36;");strTemp=strTemp.replace(/>/g, "&gt;");strTemp=strTemp.replace(/¢/g, "&cent;");strTemp=strTemp.replace(/¤/g, "&curren;");strTemp=strTemp.replace(/v/g, "&#8730;");return strTemp;}/** Deprecated*  Function*  Nothing*/
function displayObjectPrintOutput(objCalculation){var strURL="";var strContentStyles="<style type='text/css'>@media print{#divControls{display:none;}}\n #divCopyright{color:white;background:#333333;margin:2px;}\n #divControls{margin:1em;border:#00cc00 solid 2px;border-radius:9px;text-align:center;}</style>";
var strContentTitle="<H1>Calculation Results</H1>";var strContentControls="<div id='divControls'><a href='javascript:window.print()'>Print</a><br><a href='javascript:window.close()'>Close This Window</a></div>";var strContentFooter="<div id='divCopyright'>&#169;Copyright Mike Brockington 2004 - 2010 All rights reserved.<br>Produced by "+document.location+"</div>";var strContent="<html><head>"+strContentStyles+"</head><body onLoad='window.focus();'>"+strContentTitle+objCalculation.getResultHTML()+strContentControls+strContentFooter+"</body></html>";
var strName="printOutput";var strHeight="500";var strWidth="700";var xMax=0;var yMax=0;if (document.all){xMax=screen.width;yMax=screen.height;}else{if (document.layers){xMax=window.outerWidth;yMax=window.outerHeight;}else{xMax=640;yMax=480;}}var xOffset=(xMax - strWidth)/2;var yOffset=(yMax - strHeight)/2;var strFeatures="resizable,location,height="+strHeight+",width="+strWidth+",screenX="+xOffset+",screenY="+yOffset+",top="+yOffset+",left="+xOffset+",scrollbars=1,resizable=1";
var boolReuse=true;var printOutput=window.open(strURL, strName, strFeatures, boolReuse);printOutput.document.open();printOutput.document.write(strContent);printOutput.document.close();printOutput.focus();}/** Opens a pop-up window and re-builds the calculation results table.*  Function*  Nothing*/
function displayPrintOutputArea(strInput){var strURL="";var strContentStyles="<style type='text/css'>@media print{#divControls{display:none;}}\n #divCopyright{color:white;background:#333333;margin:2px;}\n #divControls{margin:1em;border:#00cc00 solid 2px;border-radius:9px;text-align:center;}\n #divCopyright{color:white;background:#333333;margin:2px;}\n .outputSection{margin:1em;padding:0.5em;border:#00cc00 solid 2px;border-radius:9px;text-align:left;}\n HR{width:90%;}</style>";
var strContentTitle="<H1>Calculation Results</H1>";var strContentControls="<div id='divControls'><a href='javascript:window.print()'>Print</a><br><a href='javascript:window.close()'>Close This Window</a></div>";var strContentFooter="<div id='divCopyright'>&#169;Copyright Mike Brockington 2004 - 2010 All rights reserved.<br>Produced by "+document.location+"</div>";var strContent="<html><head>"+strContentStyles+"</head>";strContent+="<body onLoad='window.focus();'>"+strContentTitle+strInput+strContentControls+strContentFooter+"</body></html>";
var strName="printOutput";var strHeight="500";var strWidth="700";var xMax=0;var yMax=0;if (document.all){xMax=screen.width;yMax=screen.height;}else{if (document.layers){xMax=window.outerWidth;yMax=window.outerHeight;}else{xMax=640;yMax=480;}}var xOffset=(xMax - strWidth)/2;var yOffset=(yMax - strHeight)/2;var strFeatures="resizable,location,height="+strHeight+",width="+strWidth+",screenX="+xOffset+",screenY="+yOffset+",top="+yOffset+",left="+xOffset+",scrollbars=1,resizable=1";
var boolReuse=true;var printOutput=window.open(strURL, strName, strFeatures, boolReuse);printOutput.document.open();printOutput.document.write(strContent);printOutput.document.close();printOutput.focus();}/** Show a context menu containing the given actions*  Function*  Boolean (Always FALSE)*/
function doActions(callingObject){var targetID;var thisEvent;if(callingObject.target){targetID=callingObject.target.id;thisEvent=callingObject;
}else{targetID=window.event.srcElement.id;thisEvent=window.event;}showContextMenu(targetID, commandList);preventBubbling(thisEvent);return false;}