﻿// JScript File

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }

var colName; // either blank, C2, or C3

var colorCode;
var AppCol; // indicates either app1 app2 or app1 compare mode
//var bWordWrapped = false;

var language = null;
var fontIsSmall = false;



function fillDetails(col)
{
    AppCol = col;
    var numSelected = 0;    
    var lbPartList = element(col + "lbPartList");
    var selected = 0; // if nothing is selected, set to 0
    
    if (col == null)    
        col = "";
        
    if (lbPartList == null)
        return;
    
    for (var i=0; i <= lbPartList.options.length-1 && numSelected <=3; i++) 
    {   
        if (lbPartList.options[i].selected) 
        { 
            numSelected++;
            selected = i;
            setColName(numSelected);
            rotDetails(selected,col);
        }
    } 
    
    
     element(col + "divResultsMsg").innerHTML = "";
    return;
}

function pausecomp(millis)
{
    var date = new Date();
    var curDate = null;

    do { curDate = new Date(); }
    while(curDate-date < millis);
} 

function getColor(colorInt)
{
    var color = "";
    if (colorInt == 2)
    {  
        color = "#caa"; // red
    }
    else if (colorInt == 1)
    {
        color = "#dd9"; // yellow
    }
    else
    {
        color = "#aca"; // green
    }
    return color;
}

function setColName(Column)
{
 
    var app; // = AppCol;
   // if(AppNum == undefined)
        app = AppCol;
   // else
        //app = AppNum;
        
    if (app == "CompMode")
        app = "";
        
    
       
    if (Column == 1 || Column == "C1")
    {
        colName = "";
        setC2Visibility(false);
        setC3Visibility(false);
        element(app + "thKEStopLabel").colSpan = 3;
        element(app + "thPartSpecLbl").colSpan = 3;
        
    }
    else if (Column == 2|| Column == "C2")
    {
        colName = "C2";
        setC2Visibility(true);
        element(app + "thKEStopLabel").colSpan = 5;
        element(app + "thPartSpecLbl").colSpan = 5;
    }
    else if (Column == 3 || Column == "C3")
    {
        colName = "C3";
        setC3Visibility(true);
        element(app + "thKEStopLabel").colSpan = 7;
        element(app + "thPartSpecLbl").colSpan = 7;
    }
    else
    {
        colName = "";
        setC2Visibility(false);
        setC3Visibility(false);
        element(app + "thKEStopLabel").colSpan = 3;
        element(app + "thPartSpecLbl").colSpan = 3;
    }
    
   // alert("In setColName, app = " + app);
    //alert("colName = " + colName);
    return;
}

function detailsOPUSetup(modeChange, AppNum, colName) 
{

    // check MasterMode request
    if (modeChange == ("MasterModeImperial")) {
        uc_popSpn = element(AppNum + "spnUCAxialBearingCapacity" + colName);
        ucSelect(element("hidLb").value);

        uc_popSpn = element(AppNum + "spnUCRadialBearingCapacity" + colName);
        ucSelect(element("hidLb").value);

        uc_popSpn = element(AppNum + "spnUCExpectedBacklash" + colName);
        ucSelect(element("hidDegree").value);

        uc_popSpn = element(AppNum + "spnUCRotationalTolerancePlus" + colName);
        ucSelect(element("hidDegree").value);

        uc_popSpn = element(AppNum + "spnUCRotationalToleranceMinus" + colName);
        ucSelect(element("hidDegree").value);

        uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCDeviceWeight" + colName);
        ucSelect(element("hidLb").value);

        uc_popSpn = element(AppNum + "spnUCSCFM" + colName);
        ucSelect(element("hidSCFM").value);

        uc_popSpn = element(AppNum + "spnUCTotalEnergy" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCPlainUnitKe" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCPlainUnitFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCShockpadKe" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCShockpadFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCCushionKe" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCCushionFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCShockAbsorberKe" + colName);
        ucSelect(element("hidInLb").value);

        uc_popSpn = element(AppNum + "spnUCShockAbsorberFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
        ucSelect(element("hidInLb").value);
    }
    else if (modeChange == ("MasterModeMetric")) {
        uc_popSpn = element(AppNum + "spnUCAxialBearingCapacity" + colName);
        ucSelect(element("hidKg").value);

        uc_popSpn = element(AppNum + "spnUCRadialBearingCapacity" + colName);
        ucSelect(element("hidKg").value);

        uc_popSpn = element(AppNum + "spnUCExpectedBacklash" + colName);
        ucSelect(element("hidRadian").value);

        uc_popSpn = element(AppNum + "spnUCRotationalTolerancePlus" + colName);
        ucSelect(element("hidRadian").value);

        uc_popSpn = element(AppNum + "spnUCRotationalToleranceMinus" + colName);
        ucSelect(element("hidRadian").value);

        uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCDeviceWeight" + colName);
        ucSelect(element("hidKg").value);

        uc_popSpn = element(AppNum + "spnUCSCFM" + colName);
        ucSelect(element("hidSCFM").value);

        uc_popSpn = element(AppNum + "spnUCTotalEnergy" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCPlainUnitKe" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCPlainUnitFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCShockpadKe" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCShockpadFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCCushionKe" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCCushionFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCShockAbsorberKe" + colName);
        ucSelect(element("hidNM").value);

        uc_popSpn = element(AppNum + "spnUCShockAbsorberFastestRotation" + colName);
        ucSelect(element("hidSec").value);

        uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
        ucSelect(element("hidNM").value);
    }
    else if (modeChange == ("InputModeImperial")) {
    uc_popSpn = element(AppNum + "spnUCAxialBearingCapacity" + colName);
    ucSelect(element("hidLb").value);

    uc_popSpn = element(AppNum + "spnUCRadialBearingCapacity" + colName);
    ucSelect(element("hidLb").value);

    uc_popSpn = element(AppNum + "spnUCExpectedBacklash" + colName);
    ucSelect(element("hidDegree").value);

    uc_popSpn = element(AppNum + "spnUCRotationalTolerancePlus" + colName);
    ucSelect(element("hidDegree").value);

    uc_popSpn = element(AppNum + "spnUCRotationalToleranceMinus" + colName);
    ucSelect(element("hidDegree").value);

    uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCDeviceWeight" + colName);
    ucSelect(element("hidLb").value);

    uc_popSpn = element(AppNum + "spnUCSCFM" + colName);
    ucSelect(element("hidSCFM").value);

    uc_popSpn = element(AppNum + "spnUCTotalEnergy" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCPlainUnitKe" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCPlainUnitFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCShockpadKe" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCShockpadFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCCushionKe" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCCushionFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCShockAbsorberKe" + colName);
    ucSelect(element("hidInLb").value);

    uc_popSpn = element(AppNum + "spnUCShockAbsorberFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
    ucSelect(element("hidInLb").value);

    }
    else if (modeChange == ("InputModeMetric")) {
    uc_popSpn = element(AppNum + "spnUCAxialBearingCapacity" + colName);
    ucSelect(element("hidKg").value);

    uc_popSpn = element(AppNum + "spnUCRadialBearingCapacity" + colName);
    ucSelect(element("hidKg").value);

    uc_popSpn = element(AppNum + "spnUCExpectedBacklash" + colName);
    ucSelect(element("hidRadian").value);

    uc_popSpn = element(AppNum + "spnUCRotationalTolerancePlus" + colName);
    ucSelect(element("hidRadian").value);

    uc_popSpn = element(AppNum + "spnUCRotationalToleranceMinus" + colName);
    ucSelect(element("hidRadian").value);

    uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCDeviceWeight" + colName);
    ucSelect(element("hidKg").value);

    uc_popSpn = element(AppNum + "spnUCSCFM" + colName);
    ucSelect(element("hidSCFM").value);

    uc_popSpn = element(AppNum + "spnUCTotalEnergy" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCPlainUnitKe" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCPlainUnitFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCShockpadKe" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCShockpadFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCCushionKe" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCCushionFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCShockAbsorberKe" + colName);
    ucSelect(element("hidNM").value);

    uc_popSpn = element(AppNum + "spnUCShockAbsorberFastestRotation" + colName);
    ucSelect(element("hidSec").value);

    uc_popSpn = element(AppNum + "spnUCApproxTorqueOutput" + colName);
    ucSelect(element("hidNM").value);


    }
        

    return;
}
function detailsUCSetup(AppNum,column)
{        
    
    setColName(column);



    return;
}

//function rotDetails(selectedIndex, col)
function rotDetails(selectedIndex, col, select)
{
    
     
        
    AppCol = col;
    
    var pl = new SOAPClientParameters();
    
    if (language == null);
        language = element("UserLanguageStorage").value;
    
    // if select argument is sent, use it, otherwise set it with assignment statement. Select is only sent when
    // initializing compare mode to copy multiple rotary selections in the results column. 
    var selected;
    if (select == undefined)
        selected = element(col + "lbPartList").options[selectedIndex].value; 
    else
        selected = select;
  
    var tmp = "";
    tmp = selected; 
    colorCode = 0;
    if ( (tmp.indexOf("Succes") > -1) || 
	    (tmp.indexOf("erfolgreich") > -1)  || // German
	    (tmp.indexOf("Exitoso") > -1 ))
	    colorCode = 0;
	else if ( (tmp.indexOf("Margin")  > -1 ) ||
	            (tmp.indexOf ("geringfügig") > -1) ) //German
	    colorCode = 1;
	else
	    colorCode = 2; 
	    
	if (col == "CompMode")
	    col = "";
	    
	 var tmpInd = selected.lastIndexOf(" ");
	 selected = selected.substr(0,tmpInd);
	 //writeLabel(col + "lblBasePart" + colName, selected);
	 //writeLabel(col + "lblSeries" + colName, seriesName); 
	 writeInnerHTML(col + "td" + colName, selected);
	 
	 if (select == undefined)
	    col = col;
	 else
	    col = "";
	
   
    var TotalReqTorque = element(col + "spnUCTotalReqTorque").ActualValue/element(col + "spnUCTotalReqTorque").ConvFact;
    var psi= element(col + "spnUCPressure").ActualValue/element(col + "spnUCPressure").ConvFact;
    var angle= element(col + "spnUCAOR").ActualValue/element(col + "spnUCAOR").ConvFact;
    var load= element(col + "spnUCDetailsLoad").ActualValue/element(col + "spnUCDetailsLoad").ConvFact;
    var cg = element(col + "spnUCDetailsCG").ActualValue/element(col + "spnUCDetailsCG").ConvFact;
    var inertia= element(col + "spnUCTotalInertia").ActualValue/element(col + "spnUCTotalInertia").ConvFact;
    var kineticEnergy = element(col + "spnUCKineticEnergy").ActualValue/element(col + "spnUCKineticEnergy").ConvFact;
    
    var rotaryFaceToLoad= element(col + "spnUCFTL").ActualValue/element(col + "spnUCFTL").ConvFact;
    var axisOrientation;
    if (col == "CompMode")
       axisOrientation = (element("rbAxisVertical").checked ? 0 : 1);
   else
       axisOrientation = (element(col + "rbAxisVertical").checked ? 0 : 1);
    
    var Power = (element("rbPneumatic").checked ? 0 : 1);
    var UOM = (element("rbMetric").checked ? 1 : 0);
    var Positions = (element("rbTwo").checked ? 0 : 1);
    
    // WARNING: ugly hack-
    // here's the thing: if all the units are metric, the Cv calculation will
    // convert from C to Rankine. If it's just plain-old Celsius, it will use that number.
    // actually we're not even using temperature anymore... so whatever.
    var tempUOM ;
    tempUOM = readLabel(col + "spnUCTemperature");    
    
    var temperature = element(col + "spnUCTemperature").ActualValue;
    if (!element("rbMetric").checked && tempUOM.trim() == "C")
    {
        temperature = (temperature * 9 / 5 + 32);
    }
    else if (element("rbMetric").checked && tempUOM.trim() == "F")
    {
        temperature = (temperature - 32) * 5/9;
    }
    // end ugly hack
    
    // var cycleRate = element("spnUCCycleRate").ActualValue/element("spnUCCycleRate").ConvFact;
    var cycleRate= element("spnUCRotTime").ActualValue/element("spnUCRotTime").ConvFact;
    
   // var noBounce = element("cbBounce").checked;
   var noBounce = false;
   
   var externalShocks;
    if ((col == "") && (element("rbCompareMode").checked))
        externalShocks = element("CompModecbExternalShocks").checked;
    else
        externalShocks = element(col + "cbExternalShocks").checked;  
        
   var torqueSafetyFactor= element(col + "spnUCTSF").ActualValue/element(col + "spnUCTSF").ConvFact;
    
    // calling:
    // DetailValuesReturnType Details = new DetailValuesReturnType(Name, Pressure, Angle, CycleRate, Load, CG, NoBounce, UOM, Positions, Inertia, ReqTorque, Power, KineticEnergy);
        
    pl.add("Name", selected) ;
    pl.add("Pressure", psi) ;
    pl.add("Angle", angle) ;
    pl.add("CycleRate", cycleRate) ;
    pl.add("Load", load) ;
    pl.add("CG", cg) ;
    pl.add("NoBounce", noBounce) ; 
    pl.add("UOM", UOM) ;    
    pl.add("Positions", Positions) ;    
    pl.add("Inertia", inertia) ;
    pl.add("TotalReqTorque", TotalReqTorque) ;  
    pl.add("Power", Power) ;    
    pl.add("KineticEnergy", kineticEnergy) ; 
    pl.add("RotaryFaceToLoad", rotaryFaceToLoad);
    pl.add("AxisOrientation", axisOrientation);
    pl.add("ExternalShocks", externalShocks);
    pl.add("Language", language);
    pl.add("TorqueSafetyFactor", torqueSafetyFactor); 
    element(AppCol + "divResultsMsg").innerHTML = "";
    SOAPClient.invoke("Rotary.asmx", "GetRotaryDetails", pl, false, details_callback) ;
    return;
}

function details_callback(detailVals)
{   
    var app = AppCol
    if(app == "CompMode")
        app = "";
    element(app + "tabOuts").style.display = "block";
    element(app + "tdConfig" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdSeries" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdStatus" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "td" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdAxialBearingCapacity" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdRadialBearingCapacity" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdExpectedBacklash" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdRotationalTolerancePlus" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdRotationalToleranceMinus" + colName).style.backgroundColor = getColor(colorCode); 
    //element("tdBreakawayPressure" + colName).style.backgroundColor = getColor(colorCode);  // 7/23/08 removed breakaway
    element(app + "tdApproxTorqueOutput" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdDeviceWeight" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdCv" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdSCFM" + colName).style.backgroundColor = getColor(colorCode);
     element(app + "tdTotalEnergy" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdPlainWarning" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdPlainUnitKe" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdPlainWarningR2" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdPlainUnitFastestRotation" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockpadWarning" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockpadKe" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockpadWarningR2" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockpadFastestRotation" + colName).style.backgroundColor = getColor(colorCode);
    element(app + "tdCushionWarning" + colName).style.backgroundColor = getColor(colorCode);
    element(app + "tdCushionKe" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdCushionWarningR2" + colName).style.backgroundColor = getColor(colorCode);     
    element(app + "tdCushionFastestRotation" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockAbsorberWarning" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockAbsorberKe" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockAbsorberWarningR2" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockAbsorberFastestRotation" + colName).style.backgroundColor = getColor(colorCode); 
    element(app + "tdShockAbsorberKit" + colName).style.backgroundColor = getColor(colorCode); 
    
    //set traffic image
    var trafficLight;
    if (colorCode == 0)
        trafficLight = "images/traffic_green.gif"
    else if (colorCode == 1)
        trafficLight = "images/traffic_yellow.gif"
    else 
        trafficLight = "images/traffic_red.gif"
        
    element(app + "imageLight" + colName).src = trafficLight;
    
    //element(app + "tdStatus" + colName).style.display = "";
    element(app + "tdStatus" + colName).style.display = "";
    element(app + "lblStatus" + colName).innerHTML = detailVals.Status;
    
      
    
    var rotSeries;
    var rotName;
     
    if (whichBrs() == "Firefox")
        rotName = element(app + "td" + colName).textContent;
    else
        rotName = element(app + "td" + colName).innerText;
     
               
    if (
         (rotName.substr(0,4) == "3Rx1") ||
         (rotName.substr(0,4) == "4Rx1") ||
         (rotName.substr(0,4) == "5Rx1") ||
         
          (rotName.substr(0,4) == "3Rx6") ||
         (rotName.substr(0,4) == "4Rx6") ||
         (rotName.substr(0,4) == "5Rx6")   
         )
       rotSeries = "Multi-Position<br />2000/8000";
    
    else if ((rotName.substr(0,3) == "Rx1") || (rotName.substr(0,3) == "Rx1") ||
                (rotName.substr(0,3) == "Rx6") || (rotName.substr(0,3) == "Rx6"))
        rotSeries = "1000-8000";   
    else if (rotName.substr(0,3) == "RCC")
        rotSeries = "RCC";  
    else if (
                (rotName.substr(0,4) == "3Rx9") || 
               (rotName.substr(0,3) == "Rx9") || 
               (rotName.substr(0,4) == "3Rx3") || 
               (rotName.substr(0,3) == "Rx3") 
             )
               rotSeries = "Air/Oil<br />Tandem<br />2000/8000";
    else if (rotName.substr(0,4) == "3RID")
            rotSeries = "RI";
    
    else
        rotSeries = rotName.substr(0,2);
    
    var imgRotSeries;
    if (rotSeries == "Multi-Position<br />2000/8000")
        imgRotSeries = "images/Rotaries/MultPosRot_W75.gif"  ;  
    else if (rotSeries == "RCC")
        imgRotSeries = "images/Rotaries/RCCrot_W75.gif";
    
    else if (rotSeries == "Air/Oil<br />Tandem<br />2000/8000")        
        imgRotSeries = "images/Rotaries/TD2-8000_W75.gif";
    else if (rotSeries == "RI")
        imgRotSeries = "images/Rotaries/RIrot_W75.gif";
    else if (rotSeries == "RCC")
        imgRotSeries = "images/Rotaries/RCCrot_W75.gif";
    else if (rotSeries == "RF")
        imgRotSeries = "images/Rotaries/RFrot_W75.gif";
    else if (rotSeries == "RL")
        imgRotSeries = "images/Rotaries/RLrot_W75.gif";
    else if (rotSeries == "RA")
        imgRotSeries = "images/Rotaries/RArot_W75.gif";
    else if (rotSeries == "1000-8000")
        imgRotSeries = "images/Rotaries/1-8000rot_W75.gif";
    else
        imgRotSeries == "";
    
    //element(app + "tdSeries" + colName).style.display = "inline";
    element(app + "tdSeries" + colName).style.display = "";
    element(app + "lblSeries" + colName).innerHTML = rotSeries;
    //writeLabel(app + "lblSeries" + colName, rotSeries); 
    element(app + "imageResultsSeries" + colName).src = imgRotSeries;
    element(app + "imageResultsSeries" + colName).style.width = "50px";
    element(app + "imageResultsSeries" + colName).style.height = "auto";
    //*******************************************************


    SetupUC(app + "imgDummyMinus", app + "txtAxialBearingCapacity" + colName, app + "imgDummyPlus", app + "spnUCAxialBearingCapacity" + colName, "weight", readLabel(app + 'spnUCAxialBearingCapacity' + colName).trim(), detailVals.AxialBearingCapacity, 1, 1, 4, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtRadialBearingCapacity" + colName, app + "imgDummyPlus", app + "spnUCRadialBearingCapacity" + colName, "weight", readLabel(app + 'spnUCRadialBearingCapacity' + colName).trim(), detailVals.RadialBearingCapacity, 1, 1, 4, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtExpectedBacklash" + colName, app + "imgDummyPlus", app + "spnUCExpectedBacklash" + colName, "angle", readLabel(app + 'spnUCExpectedBacklash' + colName).trim(), detailVals.ExpectedBacklash, 1, 1, 4, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtRotationalToleranceMinus" + colName, app + "imgDummyPlus", app + "spnUCRotationalToleranceMinus" + colName, app + "angle", readLabel(app + 'spnUCRotationalToleranceMinus' + colName).trim(), detailVals.RotationalToleranceMinus, 1, 1, 4, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtRotationalTolerancePlus" + colName, app + "imgDummyPlus", app + "spnUCRotationalTolerancePlus" + colName, "angle", readLabel(app + 'spnUCRotationalTolerancePlus' + colName).trim(), detailVals.RotationalTolerancePlus, 1, 1, 4, 0, Infinity, true) ;        
   // SetupUC("imgDummyMinus", "txtBreakawayPressure" + colName, "imgDummyPlus", "spnUCBreakawayPressure" + colName, "pressure", readLabel('spnUCBreakawayPressure' + colName).trim(), detailVals.BreakawayPressure, 1, 1, 4, 0, Infinity, true) ;  // 7/23/08 removed breakaway      
    SetupUC(app + "imgDummyMinus", app + "txtApproxTorqueOutput" + colName, app + "imgDummyPlus", app + "spnUCApproxTorqueOutput" + colName, "torque", readLabel(app + 'spnUCApproxTorqueOutput' + colName).trim(), detailVals.ApproxTorqueOutput, 1, 1, 4, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtDeviceWeight" + colName, app + "imgDummyPlus", app + "spnUCDeviceWeight" + colName, "weight", readLabel(app + 'spnUCDeviceWeight' + colName).trim(), detailVals.DeviceWeight, 1, 1, 4, 0, Infinity, true) ;

  

    if (detailVals.plainUnitKe == -1)
    {               
//        element(app + "tdPlainWarning" + colName).style.display = "inline";
//        element(app + "tdPlainWarningR2" + colName).style.display = "inline";
        element(app + "tdPlainWarning" + colName).style.display = "";
        element(app + "tdPlainWarningR2" + colName).style.display = "";
        element(app + "tdPlainUnitKe" + colName).style.display = "none";
        element(app + "tdPlainUnitFastestRotation" + colName).style.display = "none";
       // element("tdPlainUnitFastestRotation" + colName).style.backgroundColor = getColor(colorCode); 
    }    
    else
    {  
        element(app + "tdPlainWarning" + colName).style.display = "none";
        element(app + "tdPlainWarningR2" + colName).style.display = "none";
        element(app + "tdPlainUnitKe" + colName).style.display = "";
        element(app + "tdPlainUnitFastestRotation" + colName).style.display = "";
        SetupUC(app + "imgDummyMinus", app + "txtPlainUnitKe" + colName, app + "imgDummyPlus", app + "spnUCPlainUnitKe" + colName, "energy", readLabel(app + 'spnUCPlainUnitKe' + colName).trim(), detailVals.plainUnitKe, 1, 1, 4, 0, Infinity, true) ;        
        SetupUC(app + "imgDummyMinus", app + "txtPlainUnitFastestRotation" + colName, app + "imgDummyPlus", app + "spnUCPlainUnitFastestRotation" + colName, "time", readLabel(app + 'spnUCPlainUnitFastestRotation' + colName).trim(), detailVals.plainUnitFastestRotation, 1, 1, 4, 0, Infinity, true) ;        
    
        //element("tdPlainUnitKe" + colName).style.backgroundColor = getColor(detailVals.plainUnitStatus);      
        //element("tdPlainUnitFastestRotation" + colName).style.backgroundColor = getColor(detailVals.plainUnitStatus);          
    }
     
    if (detailVals.plainUnitFastestRotation == -1)
    {        
        element(app + "tdPlainWarningR2" + colName).style.display = "";
        element(app + "tdPlainUnitFastestRotation" + colName).style.display = "none";
        //element("tdPlainWarningR2" + colName).style.backgroundColor = getColor(detailVals.plainUnitStatus);          
    }   
    
    if (detailVals.shockpadKe == -1)
    {        
        element(app + "tdShockpadWarning" + colName).style.display = "";
        element(app + "tdShockpadWarningR2" + colName).style.display = "";
        element(app + "tdShockpadKe" + colName).style.display = "none";
        element(app + "tdShockpadFastestRotation" + colName).style.display = "none";
    }    
    else
    {
        element(app + "tdShockpadWarning" + colName).style.display = "none";
        element(app + "tdShockpadWarningR2" + colName).style.display = "none";
        element(app + "tdShockpadKe" + colName).style.display = "";
        element(app + "tdShockpadFastestRotation" + colName).style.display = "";
        SetupUC(app + "imgDummyMinus", app + "txtShockpadKe" + colName, app + "imgDummyPlus", app + "spnUCShockpadKe" + colName, "energy", readLabel(app + 'spnUCShockpadKe' + colName).trim(), detailVals.shockpadKe, 1, 1, 4, 0, Infinity, true) ;        
        SetupUC(app + "imgDummyMinus", app + "txtShockpadFastestRotation" + colName, app + "imgDummyPlus", app + "spnUCShockpadFastestRotation" + colName, "time", readLabel(app + 'spnUCShockpadFastestRotation' + colName).trim(), detailVals.shockpadFastestRotation, 1, 1, 4, 0, Infinity, true) ;        
    
        //element("tdShockpadKe" + colName).style.backgroundColor = getColor(detailVals.shockpadStatus);     
       // element("tdShockpadFastestRotation" + colName).style.backgroundColor = getColor(detailVals.shockpadStatus);          
    }
    
    if (detailVals.shockpadFastestRotation == -1)
    {
        //element("tdShockpadWarningR2" + colName).style.backgroundColor = getColor(detailVals.shockpadStatus);          
        element(app + "tdShockpadWarningR2" + colName).style.display = "";
        element(app + "tdShockpadFastestRotation" + colName).style.display = "none";        
    }
    
    if (detailVals.cushionKe == -1)
    {        
        element(app + "tdCushionWarning" + colName).style.display = "";
        element(app + "tdCushionWarningR2" + colName).style.display = "";
        element(app + "tdCushionKe" + colName).style.display = "none";
        element(app + "tdCushionFastestRotation" + colName).style.display = "none";
    }
    else
    {
        element(app + "tdCushionWarning" + colName).style.display = "none";
        element(app + "tdCushionWarningR2" + colName).style.display = "none";
        element(app + "tdCushionKe" + colName).style.display = "";
        element(app + "tdCushionFastestRotation" + colName).style.display = "";
        SetupUC(app + "imgDummyMinus", app + "txtCushionKe" + colName, app + "imgDummyPlus", app + "spnUCCushionKe" + colName, "energy", readLabel(app + 'spnUCCushionKe' + colName).trim(), detailVals.cushionKe, 1, 1, 4, 0, Infinity, true) ;        
        SetupUC(app + "imgDummyMinus", app + "txtCushionFastestRotation" + colName, app + "imgDummyPlus", app + "spnUCCushionFastestRotation" + colName, "time", readLabel(app + 'spnUCCushionFastestRotation' + colName).trim(), detailVals.cushionFastestRotation, 1, 1, 4, 0, Infinity, true) ;        
    
        //element("tdCushionKe" + colName).style.backgroundColor = getColor(detailVals.cushionStatus);
       // element("tdCushionFastestRotation" + colName).style.backgroundColor = getColor(detailVals.cushionStatus);          
    }
    if (detailVals.cushionFastestRotation == -1)
    {
       element(app + "tdCushionFastestRotation" + colName).style.display = "none";
       element(app + "tdCushionWarningR2" + colName).style.display = "";
      // element("tdCushionWarningR2" + colName).style.backgroundColor = getColor(detailVals.cushionStatus);
    }
    
    
    if (detailVals.shockAbsorberKe == -1)
    {
        
        element(app + "trTotalEnergy").style.display = "none";
        element(app + "tdShockAbsorberWarning" + colName).style.display = "";
        element(app + "tdShockAbsorberWarningR2" + colName).style.display = "";
        element(app + "tdShockAbsorberKe" + colName).style.display = "none";
        element(app + "tdShockAbsorberFastestRotation" + colName).style.display = "none";
        
        //element("tdShockAbsorberWarning" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
       // element("tdShockAbsorberKit" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
    } 
    else
    {
        element(app + "trTotalEnergy").style.display = "";
        SetupUC(app + "imgDummyMinus", app + "txtTotalEnergy" + colName, "imgDummyPlus", "spnUCTotalEnergy" + colName, "energy", readLabel('spnUCTotalEnergy' + colName).trim(), detailVals.totalEnergy, 1, 1, 4, 0, Infinity, true) ;        
//      
        element(app + "tdShockAbsorberWarning" + colName).style.display = "none";
        element(app + "tdShockAbsorberWarningR2" + colName).style.display = "none";
        element(app + "tdShockAbsorberKe" + colName).style.display = "";
        element(app + "tdShockAbsorberFastestRotation" + colName).style.display = "";
        SetupUC(app + "imgDummyMinus", app + "txtShockAbsorberKe" + colName, app + "imgDummyPlus", app + "spnUCShockAbsorberKe" + colName, "energy", readLabel(app + 'spnUCShockAbsorberKe' + colName).trim(), detailVals.shockAbsorberKe, 1, 1, 4, 0, Infinity, true) ;        
        SetupUC(app + "imgDummyMinus", app + "txtShockAbsorberFastestRotation" + colName, app + "imgDummyPlus", app + "spnUCShockAbsorberFastestRotation" + colName, "time", readLabel(app + 'spnUCShockAbsorberFastestRotation' + colName).trim(), detailVals.shockAbsorberFastestRotation, 1, 1, 4, 0, Infinity, true) ;        
    
       // element("tdShockAbsorberKe" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
       // element("tdShockAbsorberFastestRotation" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
        //element("tdShockAbsorberKit" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
    }
    
    if (detailVals.shockAbsorberFastestRotation == -1)
    {
        element(app + "tdShockAbsorberFastestRotation" + colName).style.display = "none";
        element(app + "tdShockAbsorberWarningR2" + colName).style.display = "";
        //element("tdShockAbsorberWarningR2" + colName).style.backgroundColor = getColor(detailVals.shockAbsorberStatus);
    }
    
    element(app + "tdShockAbsorberKit" + colName).innerHTML = detailVals.ShockAbsorberKit;
    
    
    SetupUC(app + "imgDummyMinus", app + "txtCv" + colName, app + "imgDummyPlus", app + "spnUCCv" + colName, "Cv", "", detailVals.Cv, 1, 1, 6, 0, Infinity, true) ;        
    SetupUC(app + "imgDummyMinus", app + "txtSCFM" + colName, app + "imgDummyPlus", app + "spnUCSCFM" + colName, "flowrate", readLabel(app + 'spnUCSCFM' + colName).trim(), detailVals.SCFM, 1, 1, 4, 0, Infinity, true) ;        

   // setImgSelected();
    element(app + "divResultsMsg").innerHTML = "";
    
    
//    //DEBUG
//    var resultsWidth =  element(app + "tabOuts").offsetWidth;
//    if ((resultsWidth > 290) && (!fontIsSmall))
//        shrinkFont(app);
//    else if ((resultsWidth <= 290) && (fontIsSmall))
//    {
//        restoreFont(app);
//        if (resultsWidth > 290)
//            shrinkFont(app);
//    }
    //    //*****

    return;
}

// shrinkFont and restoreFont were added to allow the results column to fit into the
// width of the right column.
function shrinkFont(app)   
{
    //if (whichBrs() == "Firefox")
    //{
//        element(app + "tdBasePart").setAttribute('class', 'printSmall2Multi'); 
//        element(app + "td").setAttribute('class', 'printDetailMulti');
//        element(app + "tdC2").setAttribute('class', 'printDetailMulti');
//        element(app + "tdC3").setAttribute('class', 'printDetailMulti');

//            element(app + "tdBasePart").style.fontSize = "9px";
//            element(app + "td").style.fontSize = "8px";
//            element(app + "tdC2").style.fontSize = "8px";
//            element(app + "tdC3").style.fontSize = "8px";
            
            element(app + "tdBasePart").style.fontSize = "90%";
            element(app + "td").style.fontSize = "83%";
            element(app + "tdC2").style.fontSize = "83%";
            element(app + "tdC3").style.fontSize = "83%";
        
        element(app + "tdSer").className = 'printSmall2Multi';
        element(app + "tdSeries").className = 'printDetailMulti';
        element(app + "tdSeriesC2").className = 'printDetailMulti';
        element(app + "tdSeriesC3").className = 'printDetailMulti';
        
        element(app + "tdStat").className = 'printSmall2Multi';
        element(app + "tdStatus").className = 'printDetailMulti';
        element(app + "tdStatusC2").className = 'printDetailMulti';
        element(app + "tdStatusC3").className = 'printDetailMulti';
               
        element(app + "abcHeader").className = 'printSmall2Multi';
        element(app + "tdAxialBearingCapacity").className = 'printDetailMulti';
        element(app + "tdAxialBearingCapacityC2").className = 'printDetailMulti';
        element(app + "tdAxialBearingCapacityC3").className = 'printDetailMulti';
        
        element(app + "tdRadCap").className = 'printSmall2Multi';
        element(app + "tdRadialBearingCapacity").className = 'printDetailMulti';
        element(app + "tdRadialBearingCapacityC2").className = 'printDetailMulti';
        element(app + "tdRadialBearingCapacityC3").className = 'printDetailMulti';
        
        element(app + "tdBackLash").className = 'printSmall2Multi';
        element(app + "tdExpectedBacklash").className = 'printDetailMulti';
        element(app + "tdExpectedBacklash").className = 'printDetailMulti';
        element(app + "tdExpectedBacklash").className = 'printDetailMulti';
        
        element(app + "tdRotTolPos").className = 'printSmall2Multi';
        element(app + "tdRotationalTolerancePlus").className = 'printDetailMulti';
        element(app + "tdRotationalTolerancePlusC2").className = 'printDetailMulti';
        element(app + "tdRotationalTolerancePlusC3").className = 'printDetailMulti';
        
        element(app + "tdRotTolNeg").className = 'printSmall2Multi';
        element(app + "tdRotationalToleranceMinus").className = 'printDetailMulti';
        element(app + "tdRotationalToleranceMinusC2").className = 'printDetailMulti';
        element(app + "tdRotationalToleranceMinusC3").className = 'printDetailMulti';
        
        element(app + "tdApprTorque").className = 'printSmall2Multi';
        element(app + "tdApproxTorqueOutput").className = 'printDetailMulti';
        element(app + "tdApproxTorqueOutputC2").className = 'printDetailMulti';
        element(app + "tdApproxTorqueOutputC3").className = 'printDetailMulti';
        
        element(app + "tdDevWeight").className = 'printSmall2Multi';
        element(app + "tdDeviceWeight").className = 'printDetailMulti';
        element(app + "tdDeviceWeightC2").className = 'printDetailMulti';
        element(app + "tdDeviceWeightC3").className = 'printDetailMulti';
        
        element(app + "tdCvId").className = 'printSmall2Multi';
        element(app + "tdCv").className = 'printDetailMulti';
        element(app + "tdCvC2").className = 'printDetailMulti';
        element(app + "tdCvC3").className = 'printDetailMulti';
        
        element(app + "tdSCFMid").className = 'printSmall2Multi';
        element(app + "tdSCFM").className = 'printDetailMulti';
        element(app + "tdSCFMC2").className = 'printDetailMulti';
        element(app + "tdSCFMC3").className = 'printDetailMulti';
        
        element(app + "tdPUKineticEnergy").className = 'printSmall2Multi';
        element(app + "tdPlainWarning").className = 'printDetailMulti';
        element(app + "tdPlainUnitKe").className = 'printDetailMulti';
        element(app + "tdPlainWarningC2").className = 'printDetailMulti';
        element(app + "tdPlainUnitKeC2").className = 'printDetailMulti';
        element(app + "tdPlainWarningC3").className = 'printDetailMulti';
        element(app + "tdPlainUnitKeC3").className = 'printDetailMulti'; 
        
        element(app + "tdSP").className = 'printSmall2Multi';
        element(app + "tdShockpadWarning").className = 'printDetailMulti';
        element(app + "tdShockpadKe").className = 'printDetailMulti';
        element(app + "tdShockpadWarningC2").className = 'printDetailMulti';
        element(app + "tdShockpadKeC2").className = 'printDetailMulti';
        element(app + "tdShockpadWarningC3").className = 'printDetailMulti';
        element(app + "tdShockpadKeC3").className = 'printDetailMulti';    
        
        element(app + "tdCushionid").className = 'printSmall2Multi';
        element(app + "tdCushionWarning").className = 'printDetailMulti';
        element(app + "tdCushionKe").className = 'printDetailMulti';
        element(app + "tdCushionWarningC2").className = 'printDetailMulti';
        element(app + "tdCushionKeC2").className = 'printDetailMulti';
        element(app + "tdCushionWarningC3").className = 'printDetailMulti';
        element(app + "tdCushionKeC3").className = 'printDetailMulti'; 
        
        element(app + "tdSAid").className = 'printSmall2Multi';
        element(app + "tdShockAbsorberWarning").className = 'printDetailMulti';
        element(app + "tdShockAbsorberKe").className = 'printDetailMulti';
        element(app + "tdShockAbsorberWarningC2").className = 'printDetailMulti';
        element(app + "tdShockAbsorberKeC2").className = 'printDetailMulti';
        element(app + "tdShockAbsorberWarningC3").className = 'printDetailMulti';
        element(app + "tdShockAbsorberKeC3").className = 'printDetailMulti'; 
        
        element(app + "tdPUFRT").className = 'printSmall2Multi';
        element(app + "tdPlainWarningR2").className = 'printDetailMulti';
        element(app + "tdPlainUnitFastestRotation").className = 'printDetailMulti';
        element(app + "tdPlainWarningR2C2").className = 'printDetailMulti';
        element(app + "tdPlainUnitFastestRotationC2").className = 'printDetailMulti';
        element(app + "tdPlainWarningR2C3").className = 'printDetailMulti';
        element(app + "tdPlainUnitFastestRotationC3").className = 'printDetailMulti'; 
        
        element(app + "tdSPFRTid").className = 'printSmall2Multi';
        element(app + "tdShockpadWarningR2").className = 'printDetailMulti';
        element(app + "tdShockpadFastestRotation").className = 'printDetailMulti';
        element(app + "tdShockpadWarningR2C2").className = 'printDetailMulti';
        element(app + "tdShockpadFastestRotationC2").className = 'printDetailMulti';
        element(app + "tdShockpadWarningR2C3").className = 'printDetailMulti';
        element(app + "tdShockpadFastestRotationC3").className = 'printDetailMulti'; 
        
        element(app + "tdCushionsid").className = 'printSmall2Multi';
        element(app + "tdCushionWarningR2").className = 'printDetailMulti';
        element(app + "tdCushionFastestRotation").className = 'printDetailMulti';
        element(app + "tdCushionWarningR2C2").className = 'printDetailMulti';
        element(app + "tdCushionFastestRotationC2").className = 'printDetailMulti';
        element(app + "tdCushionWarningR2C3").className = 'printDetailMulti';
        element(app + "tdCushionFastestRotationC3").className = 'printDetailMulti'; 
        
        element(app + "tdSAFRTid").className = 'printSmall2Multi';
        element(app + "tdShockAbsorberWarningR2").className = 'printDetailMulti';
        element(app + "tdShockAbsorberFastestRotation").className = 'printDetailMulti';
        element(app + "tdShockAbsorberWarningR2C2").className = 'printDetailMulti';
        element(app + "tdShockAbsorberFastestRotationC2").className = 'printDetailMulti';
        element(app + "tdShockAbsorberWarningR2C3").className = 'printDetailMulti';
        element(app + "tdShockAbsorberFastestRotationC3").className = 'printDetailMulti'; 
 
    
    fontIsSmall = true;
    return;
}

function restoreFont(app)
{
    element(app + "tdBasePart").className = 'printSmall2';
    element(app + "td").className = 'printDetail';
    element(app + "tdC2").className = 'printDetail';
    element(app + "tdC3").className = 'printDetail';
    
    element(app + "tdSer").className = 'printSmall2';
    element(app + "tdSeries").className = 'printDetail';
    element(app + "tdSeriesC2").className = 'printDetail';
    element(app + "tdSeriesC3").className = 'printDetail';
    
    element(app + "tdStat").className = 'printSmall2';
    element(app + "tdStatus").className = 'printDetail';
    element(app + "tdStatusC2").className = 'printDetail';
    element(app + "tdStatusC3").className = 'printDetail';
    
    element(app + "abcHeader").className = 'printSmall2';
    element(app + "tdAxialBearingCapacity").className = 'printDetail';
    element(app + "tdAxialBearingCapacityC2").className = 'printDetail';
    element(app + "tdAxialBearingCapacityC3").className = 'printDetail';
    
    element(app + "tdRadCap").className = 'printSmall2';
    element(app + "tdRadialBearingCapacity").className = 'printDetail';
    element(app + "tdRadialBearingCapacityC2").className = 'printDetail';
    element(app + "tdRadialBearingCapacityC3").className = 'printDetail';
    
    element(app + "tdBackLash").className = 'printSmall2';
    element(app + "tdExpectedBacklash").className = 'printDetail';
    element(app + "tdExpectedBacklash").className = 'printDetail';
    element(app + "tdExpectedBacklash").className = 'printDetail';
    
    element(app + "tdRotTolPos").className = 'printSmall2';
    element(app + "tdRotationalTolerancePlus").className = 'printDetail';
    element(app + "tdRotationalTolerancePlusC2").className = 'printDetail';
    element(app + "tdRotationalTolerancePlusC3").className = 'printDetail';
    
    element(app + "tdRotTolNeg").className = 'printSmall2';
    element(app + "tdRotationalToleranceMinus").className = 'printDetail';
    element(app + "tdRotationalToleranceMinusC2").className = 'printDetail';
    element(app + "tdRotationalToleranceMinusC3").className = 'printDetail';
    
    element(app + "tdApprTorque").className = 'printSmall2';
    element(app + "tdApproxTorqueOutput").className = 'printDetail';
    element(app + "tdApproxTorqueOutputC2").className = 'printDetail';
    element(app + "tdApproxTorqueOutputC3").className = 'printDetail';
    
    element(app + "tdDevWeight").className = 'printSmall2';
    element(app + "tdDeviceWeight").className = 'printDetail';
    element(app + "tdDeviceWeightC2").className = 'printDetail';
    element(app + "tdDeviceWeightC3").className = 'printDetail';
    
    element(app + "tdCvId").className = 'printSmall2';
    element(app + "tdCv").className = 'printDetail';
    element(app + "tdCvC2").className = 'printDetail';
    element(app + "tdCvC3").className = 'printDetail';
    
    element(app + "tdSCFMid").className = 'printSmall2';
    element(app + "tdSCFM").className = 'printDetail';
    element(app + "tdSCFMC2").className = 'printDetail';
    element(app + "tdSCFMC3").className = 'printDetail';
    
    element(app + "tdPUKineticEnergy").className = 'printSmall2';
    element(app + "tdPlainWarning").className = 'printDetail';
    element(app + "tdPlainUnitKe").className = 'printDetail';
    element(app + "tdPlainWarningC2").className = 'printDetail';
    element(app + "tdPlainUnitKeC2").className = 'printDetail';
    element(app + "tdPlainWarningC3").className = 'printDetail';
    element(app + "tdPlainUnitKeC3").className = 'printDetail'; 
    
    element(app + "tdSP").className = 'printSmall2';
    element(app + "tdShockpadWarning").className = 'printDetail';
    element(app + "tdShockpadKe").className = 'printDetail';
    element(app + "tdShockpadWarningC2").className = 'printDetail';
    element(app + "tdShockpadKeC2").className = 'printDetail';
    element(app + "tdShockpadWarningC3").className = 'printDetail';
    element(app + "tdShockpadKeC3").className = 'printDetail';   
    
    element(app + "tdCushionid").className = 'printSmall2';
    element(app + "tdCushionWarning").className = 'printDetail';
    element(app + "tdCushionKe").className = 'printDetail';
    element(app + "tdCushionWarningC2").className = 'printDetail';
    element(app + "tdCushionKeC2").className = 'printDetail';
    element(app + "tdCushionWarningC3").className = 'printDetail';
    element(app + "tdCushionKeC3").className = 'printDetail';  
    
    element(app + "tdSAid").className = 'printSmall2';
    element(app + "tdShockAbsorberWarning").className = 'printDetail';
    element(app + "tdShockAbsorberKe").className = 'printDetail';
    element(app + "tdShockAbsorberWarningC2").className = 'printDetail';
    element(app + "tdShockAbsorberKeC2").className = 'printDetail';
    element(app + "tdShockAbsorberWarningC3").className = 'printDetail';
    element(app + "tdShockAbsorberKeC3").className = 'printDetail'; 
    
     element(app + "tdPUFRT").className = 'printSmall2';
    element(app + "tdPlainWarningR2").className = 'printDetail';
    element(app + "tdPlainUnitFastestRotation").className = 'printDetail';
    element(app + "tdPlainWarningR2C2").className = 'printDetail';
    element(app + "tdPlainUnitFastestRotationC2").className = 'printDetail';
    element(app + "tdPlainWarningR2C3").className = 'printDetail';
    element(app + "tdPlainUnitFastestRotationC3").className = 'printDetail';
    
    element(app + "tdSPFRTid").className = 'printSmall2';
    element(app + "tdShockpadWarningR2").className = 'printDetail';
    element(app + "tdShockpadFastestRotation").className = 'printDetail';
    element(app + "tdShockpadWarningR2C2").className = 'printDetail';
    element(app + "tdShockpadFastestRotationC2").className = 'printDetail';
    element(app + "tdShockpadWarningR2C3").className = 'printDetail';
    element(app + "tdShockpadFastestRotationC3").className = 'printDetail'; 
    
    element(app + "tdCushionsid").className = 'printSmall2';
    element(app + "tdCushionWarningR2").className = 'printDetail';
    element(app + "tdCushionFastestRotation").className = 'printDetail';
    element(app + "tdCushionWarningR2C2").className = 'printDetail';
    element(app + "tdCushionFastestRotationC2").className = 'printDetail';
    element(app + "tdCushionWarningR2C3").className = 'printDetail';
    element(app + "tdCushionFastestRotationC3").className = 'printDetail';  
    
    element(app + "tdSAFRTid").className = 'printSmall2';
    element(app + "tdShockAbsorberWarningR2").className = 'printDetail';
    element(app + "tdShockAbsorberFastestRotation").className = 'printDetail';
    element(app + "tdShockAbsorberWarningR2C2").className = 'printDetail';
    element(app + "tdShockAbsorberFastestRotationC2").className = 'printDetail';
    element(app + "tdShockAbsorberWarningR2C3").className = 'printDetail';
    element(app + "tdShockAbsorberFastestRotationC3").className = 'printDetail';  
    
    fontIsSmall = false;
    return;
}



function setC2Visibility(visible, col)
{
   var app;
    if(col == undefined)
        app = AppCol;
    else
        app = col;
    if (app == "CompMode")
        app = "";
        
    if (visible)
    {

        element(app + "tdC2").style.display = "";
        element(app + "tdConfigC2").style.display = "";
        element(app + "tdSeriesC2").style.display = "";
        element(app + "tdStatusC2").style.display = "";
        element(app + "tdAxialBearingCapacityC2").style.display = "";
        element(app + "spnUCAxialBearingCapacity").style.display = "block";
        element(app + "spnUCAxialBearingCapacityC2").style.display = "block";
        element(app + "tdRadialBearingCapacityC2").style.display = "";
        element(app + "spnUCRadialBearingCapacity").style.display = "block";
        element(app + "spnUCRadialBearingCapacityC2").style.display = "block";
        element(app + "tdExpectedBacklashC2").style.display = "";
        element(app + "spnUCExpectedBacklash").style.display = "block";
        element(app + "spnUCExpectedBacklashC2").style.display = "block";
        element(app + "tdRotationalToleranceMinusC2").style.display = "";
        element(app + "spnUCRotationalToleranceMinus").style.display = "block";
        element(app + "spnUCRotationalToleranceMinusC2").style.display = "block";
        element(app + "tdRotationalTolerancePlusC2").style.display = "";
        element(app + "spnUCRotationalTolerancePlus").style.display = "block";
        element(app + "spnUCRotationalTolerancePlusC2").style.display = "block";
        //element("tdBreakawayPressureC2").style.display = ""; // 7/23/08 removed breakaway
        element(app + "tdApproxTorqueOutputC2").style.display = "";
        element(app + "spnUCApproxTorqueOutput").style.display = "block";
        element(app + "spnUCApproxTorqueOutputC2").style.display = "block";
        element(app + "tdDeviceWeightC2").style.display = "";
        element(app + "spnUCDeviceWeight").style.display = "block";
        element(app + "spnUCDeviceWeightC2").style.display = "block";
        element(app + "tdCvC2").style.display = "";
        element(app + "spnUCCv").style.display = "block";
        element(app + "spnUCCvC2").style.display = "block";
        element(app + "tdSCFMC2").style.display = ""; 
        element(app + "spnUCSCFM").style.display = "block"; 
        element(app + "spnUCSCFMC2").style.display = "block"; 
        element(app + "tdTotalEnergyC2").style.display = "";  
        element(app + "spnUCTotalEnergy").style.display = "block"; 
        element(app + "spnUCTotalEnergyC2").style.display = "block"; 
        element(app + "tdPlainUnitKeC2").style.display = "";
        element(app + "spnUCPlainUnitKe").style.display = "block";
        element(app + "spnUCPlainUnitKeC2").style.display = "block";
        element(app + "tdPlainUnitFastestRotationC2").style.display = "";
        element(app + "spnUCPlainUnitFastestRotation").style.display = "block";
        element(app + "spnUCPlainUnitFastestRotationC2").style.display = "block";
        element(app + "tdShockpadKeC2").style.display = "";
        element(app + "spnUCShockpadKe").style.display = "block";
        element(app + "spnUCShockpadKeC2").style.display = "block";
        element(app + "tdShockpadFastestRotationC2").style.display = "";
        element(app + "spnUCShockpadFastestRotation").style.display = "block";
        element(app + "spnUCShockpadFastestRotationC2").style.display = "block";
        element(app + "tdCushionKeC2").style.display = "";
        element(app + "spnUCCushionKe").style.display = "block";
        element(app + "spnUCCushionKeC2").style.display = "block";
        element(app + "tdCushionFastestRotationC2").style.display = "";
        element(app + "spnUCCushionFastestRotation").style.display = "block";
        element(app + "spnUCCushionFastestRotationC2").style.display = "block";
        element(app + "tdShockAbsorberKeC2").style.display = "";
        element(app + "spnUCShockAbsorberKe").style.display = "block";
        element(app + "spnUCShockAbsorberKeC2").style.display = "block";
        element(app + "tdShockAbsorberFastestRotationC2").style.display = "";   
        element(app + "spnUCShockAbsorberFastestRotation").style.display = "block"; 
        element(app + "spnUCShockAbsorberFastestRotationC2").style.display = "block";        
        element(app + "tdShockAbsorberKitC2").style.display = "";
        //*****            
    }
    else
    {
        element(app + "tdC2").style.display = "none";
        element(app + "tdConfigC2").style.display = "none";
        element(app + "tdSeriesC2").style.display = "none";
        element(app + "tdStatusC2").style.display = "none";
        element(app + "tdAxialBearingCapacityC2").style.display = "none";
         element(app + "spnUCAxialBearingCapacity").style.display = "";
        element(app + "tdRadialBearingCapacityC2").style.display = "none";
        element(app + "spnUCRadialBearingCapacity").style.display = "";
        element(app + "tdExpectedBacklashC2").style.display = "none";
        element(app + "tdRotationalToleranceMinusC2").style.display = "none";
        element(app + "tdRotationalTolerancePlusC2").style.display = "none";
        //element("tdBreakawayPressureC2").style.display = "none"; // 7/23/08 removed breakaway
        element(app + "tdApproxTorqueOutputC2").style.display = "none";
        element(app + "tdDeviceWeightC2").style.display = "none";
        element(app + "tdCvC2").style.display = "none";
        element(app + "tdSCFMC2").style.display = "none";
        element(app + "tdTotalEnergyC2").style.display = "none";  
        element(app + "tdPlainUnitKeC2").style.display = "none";
        element(app + "tdPlainUnitFastestRotationC2").style.display = "none";
        element(app + "tdShockpadKeC2").style.display = "none";
        element(app + "tdShockpadFastestRotationC2").style.display = "none";
        element(app + "tdCushionKeC2").style.display = "none";
        element(app + "tdCushionFastestRotationC2").style.display = "none";
        element(app + "tdShockAbsorberKeC2").style.display = "none";
        element(app + "tdShockAbsorberFastestRotationC2").style.display = "none";           
        element(app + "tdShockAbsorberKitC2").style.display = "none";     
        
        element(app + "tdPlainWarningC2").style.display = "none";  
        element(app + "tdShockpadWarningC2").style.display = "none";   
        element(app + "tdCushionWarningC2").style.display = "none";        
        element(app + "tdShockAbsorberWarningC2").style.display = "none";    
        
        element(app + "tdPlainWarningR2C2").style.display = "none";  
        element(app + "tdShockpadWarningR2C2").style.display = "none";   
        element(app + "tdCushionWarningR2C2").style.display = "none";        
        element(app + "tdShockAbsorberWarningR2C2").style.display = "none";    
    }    
    return;
}

function setC3Visibility(visible, col)
{        
    var app;
    if(col == undefined)
        app = AppCol;
    else
        app = col;
        
        
   
    if (AppCol == "CompMode")
        app = "";
        
    if (visible)
    {

        element(app + "tdC3").style.display = "";
        element(app + "tdConfigC3").style.display = "";
        element(app + "tdSeriesC3").style.display = "";
        element(app + "tdStatusC3").style.display = "";
        element(app + "tdAxialBearingCapacityC3").style.display = "";
        element(app + "spnUCAxialBearingCapacity").style.display = "block";
        element(app + "spnUCAxialBearingCapacityC2").style.display = "block";
        element(app + "spnUCAxialBearingCapacityC3").style.display = "block";
        element(app + "tdRadialBearingCapacityC3").style.display = "";
        element(app + "spnUCRadialBearingCapacity").style.display = "block";
        element(app + "spnUCRadialBearingCapacityC2").style.display = "block";
        element(app + "spnUCRadialBearingCapacityC3").style.display = "block";
        element(app + "tdExpectedBacklashC3").style.display = "";
        element(app + "spnUCExpectedBacklash").style.display = "block";
        element(app + "spnUCExpectedBacklashC2").style.display = "block";
        element(app + "spnUCExpectedBacklashC3").style.display = "block";
        element(app + "tdRotationalToleranceMinusC3").style.display = "";
        element(app + "spnUCRotationalToleranceMinus").style.display = "block";
        element(app + "spnUCRotationalToleranceMinusC2").style.display = "block";
        element(app + "spnUCRotationalToleranceMinusC3").style.display = "block";
        element(app + "tdRotationalTolerancePlusC3").style.display = "";
        element(app + "spnUCRotationalTolerancePlus").style.display = "block";
        element(app + "spnUCRotationalTolerancePlusC2").style.display = "block";
        element(app + "spnUCRotationalTolerancePlusC3").style.display = "block";
       // element("tdBreakawayPressureC3").style.display = "";
       // element("spnUCBreakawayPressure").style.display = "block"; // 7/23/08 removed breakaway
       // element("spnUCBreakawayPressureC2").style.display = "block";
        //element("spnUCBreakawayPressureC3").style.display = "block";
        element(app + "tdApproxTorqueOutputC3").style.display = "";
        element(app + "spnUCApproxTorqueOutput").style.display = "block";
        element(app + "spnUCApproxTorqueOutputC2").style.display = "block";
        element(app + "spnUCApproxTorqueOutputC3").style.display = "block";
        element(app + "tdDeviceWeightC3").style.display = "";
        element(app + "spnUCDeviceWeight").style.display = "block";
        element(app + "spnUCDeviceWeightC2").style.display = "block";
        element(app + "spnUCDeviceWeightC3").style.display = "block";
        element(app + "tdCvC3").style.display = "";
        element(app + "spnUCCv").style.display = "block";
        element(app + "spnUCCvC2").style.display = "block";
        element(app + "spnUCCvC3").style.display = "block";
        element(app + "tdSCFMC3").style.display = "";
        element(app + "spnUCSCFM").style.display = "block"; 
        element(app + "spnUCSCFMC2").style.display = "block"; 
        element(app + "spnUCSCFMC3").style.display = "block";
        element(app + "tdTotalEnergyC3").style.display = "";
        element(app + "spnUCTotalEnergy").style.display = "block"; 
        element(app + "spnUCTotalEnergyC2").style.display = "block"; 
        element(app + "spnUCTotalEnergyC3").style.display = "block"; 
        element(app + "tdPlainUnitKeC3").style.display = "";
        element(app + "spnUCPlainUnitKe").style.display = "block";
        element(app + "spnUCPlainUnitKeC2").style.display = "block";
        element(app + "spnUCPlainUnitKeC3").style.display = "block";
        element(app + "tdPlainUnitFastestRotationC3").style.display = "";
        element(app + "spnUCPlainUnitFastestRotation").style.display = "block";
        element(app + "spnUCPlainUnitFastestRotationC2").style.display = "block";
        element(app + "spnUCPlainUnitFastestRotationC3").style.display = "block";
        element(app + "tdShockpadKeC3").style.display = "";
        element(app + "spnUCShockpadKe").style.display = "block";
        element(app + "spnUCShockpadKeC2").style.display = "block";
        element(app + "spnUCShockpadKeC3").style.display = "block";
        element(app + "tdShockpadFastestRotationC3").style.display = "";
        element(app + "spnUCShockpadFastestRotation").style.display = "block";
        element(app + "spnUCShockpadFastestRotationC2").style.display = "block";
        element(app + "spnUCShockpadFastestRotationC3").style.display = "block";
        element(app + "tdCushionKeC3").style.display = "";
        element(app + "spnUCCushionKe").style.display = "block";
        element(app + "spnUCCushionKeC2").style.display = "block";
        element(app + "spnUCCushionKeC3").style.display = "block";
        element(app + "tdCushionFastestRotationC3").style.display = "";
        element(app + "spnUCCushionFastestRotation").style.display = "block";
        element(app + "spnUCCushionFastestRotationC2").style.display = "block";
        element(app + "spnUCCushionFastestRotationC3").style.display = "block";
        element(app + "tdShockAbsorberKeC3").style.display = "";
        element(app + "spnUCShockAbsorberKe").style.display = "block";
        element(app + "spnUCShockAbsorberKeC2").style.display = "block";
        element(app + "spnUCShockAbsorberKeC3").style.display = "block";
        element(app + "tdShockAbsorberFastestRotationC3").style.display = ""; 
        element(app + "spnUCShockAbsorberFastestRotation").style.display = "block"; 
        element(app + "spnUCShockAbsorberFastestRotationC2").style.display = "block";
        element(app + "spnUCShockAbsorberFastestRotationC3").style.display = "block";          
        element(app + "tdShockAbsorberKitC3").style.display = "";

        //element(AppCol + "divDetails").style.overflowX = "auto";
     
         if ((AppCol == "CompMode") || (AppCol == "App2"))
         {
            var resultsWidth =  element(app + "tabOuts").offsetWidth;
            if (resultsWidth > 350)
                element(AppCol + "divDetails").style.overflowX = "auto";
         }
    }
    else
    {
         if ((AppCol == "CompMode") || (AppCol == "App2"))
                element(AppCol + "divDetails").style.overflowX = "auto";
        //element(AppCol + "divDetails").style.overflowX = "hidden";
            element(app + "tdC3").style.display = "none";
            element(app + "tdConfigC3").style.display = "none";
        element(app + "tdSeriesC3").style.display = "none";
        element(app + "tdStatusC3").style.display = "none";
        element(app + "tdAxialBearingCapacityC3").style.display = "none"; 
        element(app + "spnUCAxialBearingCapacity").style.display = "";
        element(app + "spnUCAxialBearingCapacityC2").style.display = "";      
        element(app + "tdRadialBearingCapacityC3").style.display = "none";
        element(app + "spnUCRadialBearingCapacity").style.display = "";
        element(app + "spnUCRadialBearingCapacityC2").style.display = "";
        element(app + "tdExpectedBacklashC3").style.display = "none";
        element(app + "spnUCExpectedBacklash").style.display = "";
        element(app + "spnUCExpectedBacklashC2").style.display = "";
        element(app + "tdRotationalToleranceMinusC3").style.display = "none";
        element(app + "spnUCRotationalToleranceMinus").style.display = "";
        element(app + "spnUCRotationalToleranceMinusC2").style.display = "";
        element(app + "tdRotationalTolerancePlusC3").style.display = "none";
        element(app + "spnUCRotationalTolerancePlus").style.display = "";
        element(app + "spnUCRotationalTolerancePlusC2").style.display = "";
       // element("tdBreakawayPressureC3").style.display = "none";  // 7/23/08 removed breakaway
       // element("spnUCBreakawayPressure").style.display = "";
       // element("spnUCBreakawayPressureC2").style.display = "";
        element(app + "tdApproxTorqueOutputC3").style.display = "none";
        element(app + "spnUCApproxTorqueOutput").style.display = "";
        element(app + "spnUCApproxTorqueOutputC2").style.display = "";
        element(app + "tdDeviceWeightC3").style.display = "none";
        element(app + "spnUCDeviceWeight").style.display = "";
        element(app + "spnUCDeviceWeightC2").style.display = "";
        element(app + "tdCvC3").style.display = "none";
        element(app + "spnUCCv").style.display = "";
        element(app + "spnUCCvC2").style.display = "";
        element(app + "tdSCFMC3").style.display = "none";
        element(app + "spnUCSCFM").style.display = "";
        element(app + "spnUCSCFMC2").style.display = ""; 
        element(app + "tdTotalEnergyC3").style.display = "none";
        element(app + "spnUCTotalEnergy").style.display = "";
        element(app + "spnUCTotalEnergyC2").style.display = ""; 
        element(app + "tdPlainUnitKeC3").style.display = "none";
        element(app + "spnUCPlainUnitKe").style.display = "";
        element(app + "spnUCPlainUnitKeC2").style.display = "";
        element(app + "tdPlainUnitFastestRotationC3").style.display = "none";
        element(app + "spnUCPlainUnitFastestRotation").style.display = "";
        element(app + "spnUCPlainUnitFastestRotationC2").style.display = "";
        element(app + "tdShockpadKeC3").style.display = "none";
        element(app + "spnUCShockpadKe").style.display = "";
        element(app + "spnUCShockpadKeC2").style.display = "";
        element(app + "tdShockpadFastestRotationC3").style.display = "none";
        element(app + "spnUCShockpadFastestRotation").style.display = "";
        element(app + "spnUCShockpadFastestRotationC2").style.display = "";
        element(app + "tdCushionKeC3").style.display = "none";
        element(app + "spnUCCushionKe").style.display = "";
        element(app + "spnUCCushionKeC2").style.display = "";
        element(app + "tdCushionFastestRotationC3").style.display = "none";
        element(app + "spnUCCushionFastestRotation").style.display = "";
        element(app + "spnUCCushionFastestRotationC2").style.display = "";
        element(app + "tdShockAbsorberKeC3").style.display = "none";
        element(app + "spnUCShockAbsorberKe").style.display = "";
        element(app + "spnUCShockAbsorberKeC2").style.display = "";
        element(app + "tdShockAbsorberFastestRotationC3").style.display = "none"; 
        element(app + "spnUCShockAbsorberFastestRotation").style.display = ""; 
        element(app + "spnUCShockAbsorberFastestRotationC2").style.display = "";          
        element(app + "tdShockAbsorberKitC3").style.display = "none"; 
        //element("spnUCShockAbsorberKit").style.display = "";
        //element("spnUCShockAbsorberKitC2").style.display = ""; 
        element(app + "tdPlainWarningC3").style.display = "none";
        element(app + "spnUCPlainUnitKe").style.display = ""; 
        element(app + "spnUCPlainUnitKe").style.display = "";   
        element(app + "tdShockpadWarningC3").style.display = "none";
        element(app + "spnUCShockpadKe").style.display = "";
        element(app + "spnUCShockpadKeC2").style.display = "";   
        element(app + "tdCushionWarningC3").style.display = "none";
        element(app + "spnUCCushionKe").style.display = "";
        element(app + "spnUCCushionKeC2").style.display = "";        
        element(app + "tdShockAbsorberWarningC3").style.display = "none"; 
        element(app + "spnUCShockAbsorberKe").style.display = "";
        element(app + "spnUCShockAbsorberKeC2").style.display = "";
        element(app + "tdPlainWarningR2C3").style.display = "none"; 
       // element("spnUCPlainUnitFastestRotation").style.display = "";
        //element("spnUCPlainUnitFastestRotationC2").style.display = "";  
        element(app + "tdShockpadWarningR2C3").style.display = "none";
        //element("spnUCShockpadWarningR2").style.display = ""; 
        //element("spnUCShockpadWarningR2C2").style.display = "";  
        element(app + "tdCushionWarningR2C3").style.display = "none";
        //element("spnUCCushionWarningR2").style.display = ""; 
       // element("spnUCCushionWarningR2C2").style.display = "";        
        element(app + "tdShockAbsorberWarningR2C3").style.display = "none"; 
       // element("spnUCShockAbsorberWarningR2").style.display = "";
       // element("spnUCShockAbsorberWarningR2C2").style.display = "";
       
    }    
    return;
}

function whichBrs() {
    var agt=navigator.userAgent.toLowerCase();
    if (agt.indexOf("opera") != -1) return 'Opera';
    if (agt.indexOf("staroffice") != -1) return 'Star Office';
    if (agt.indexOf("beonex") != -1) return 'Beonex';
    if (agt.indexOf("chimera") != -1) return 'Chimera';
    if (agt.indexOf("netpositive") != -1) return 'NetPositive';
    if (agt.indexOf("phoenix") != -1) return 'Phoenix';
    if (agt.indexOf("firefox") != -1) return 'Firefox';
    if (agt.indexOf("safari") != -1) return 'Safari';
    if (agt.indexOf("skipstone") != -1) return 'SkipStone';
    if (agt.indexOf("msie") != -1) return 'Internet Explorer';
    if (agt.indexOf("netscape") != -1) return 'Netscape';
    if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
    if (agt.indexOf('\/') != -1) {
    if (agt.substr(0,agt.indexOf('\/')) != 'mozilla') {
    return navigator.userAgent.substr(0,agt.indexOf('\/'));}
    else return 'Netscape';} else if (agt.indexOf(' ') != -1)
    return navigator.userAgent.substr(0,agt.indexOf(' '));
    else return navigator.userAgent;
}

//function wrapCells(col)
//{   
////    var tmp;
////    tmp = element(col + "abcHeader").innerHTML;
////    tmp = tmp.replace(/ /, "<br/>");
////    tmp = tmp.replace(/ /, "<br/>");
////    element(col + "abcHeader").innerHTML = tmp;
//     var temp = replace(element(col + "abcHeader").innerHTML," ", "<br/>");
//     element(col + "abcHeader").innerHTML = temp;
//    
//    return;
//}

//function unwrapCells(col)
//{
//    var tmp;
//    tmp = element(col + "abcHeader").innerHTML;
//    tmp = replace(element(col + "abcHeader").innerHTML,"g<br/>C", "g C");
//    
//    element(col + "abcHeader").innerHTML = tmp;
//    return;
//}

//function replace(inString, oldChars, newChars)
//{
//    var startIndex = 0;
//    var index;
//    var spacer = oldChars.length;
//    var retVal = inString;
//    while (retVal.indexOf(oldChars) > -1) 
//    {
//        index = retVal.indexOf(oldChars);
//        if (index > -1)
//        {
//            retVal = retVal.substr(startIndex,index) + newChars + retVal.substr(index + spacer, retVal.length-(index+spacer));
//            startIndex = index + 1;
//            if (startIndex > retVal.length)
//                break;
//        }        
//    }
//    alert("in replace, retVal = " + retVal);
//    return retVal;
//    
//}
