Hi All,

I'm new to Java and I'm using a service called caspio to display online results for a search. Well I'd like the results to be displayed in a separate window. As of now, the results are displayed within the current page, and that is not desired.

Can someone please advise as to what code and where I need to add to the below. The below code is in my footer. Thanks so much!

</div>
<script>

function NumberFormatted(amount,decimal)
{
if(isNaN(amount))
i = 0.00;
else
{
var v_number = parseFloat(amount);
var v_minus = '';
if(v_number < 0)
v_minus = '-';
v_number = Math.abs(v_number);
v_number = Math.round(v_number*Math.pow(10,decimal));
v_number = v_number/Math.pow(10,decimal);
v_numStr = new String(v_number);
v_decStr = new String(Math.pow(10,decimal));
if(v_numStr.indexOf(".") < 0)
v_numStr = v_numStr + "." + v_decStr.substr(1,v_decStr.length);
else
v_numStr = v_numStr + v_decStr.substr(1,v_decStr.length);
return (v_minus + v_numStr.substr(0,v_numStr.indexOf(".") + decimal + 1));
}
}

function f_calTotal()
{
var v_totalRev = 0;
var v_rev = 0;

//sb var cas_form = document.getElementById("cb_resultTotal");

var o_cbwrapper = document.getElementById("cb_resultTotal") ;

var o_cbtables = o_cbwrapper.getElementsByTagName("table");
var o_rtable = null;

/* find the correct table */
for(var i = 0; i < o_cbtables.length; i++)
{
if(o_cbtables[i].rows[0].cells.length >= 4)
{
o_rtable = o_cbtables[i];
break;
}
}

//sb if (cas_form.getElementsByTagName("table").length > 0)

if(o_rtable)
{
//sb var cas_rows = cas_form.getElementsByTagName("table")[1].getElementsByTagName("tr");

var cas_rows = o_rtable.getElementsByTagName("tr");
for(var rowIndex=1; rowIndex < cas_rows.length; rowIndex++)
{
var cells = cas_rows[rowIndex].getElementsByTagName("td");

/* 1 – change value inside brackets to choose column to calculate sum */
v_rev = cells[5].innerHTML;

if ((v_rev != "&nbsp;") && (v_rev != null) && (v_rev != ""))
{
v_rev = v_rev.replace(/\$|,/gi,'') ;
if (!isNaN(v_rev))
v_totalRev = v_totalRev + parseFloat(v_rev);
}
}

var v_nrow = cas_rows.length;
o_rtable.insertRow(v_nrow);
var o_lastRow = o_rtable.rows[v_nrow] ;

o_lastRow.style.background = "#385C7E";
o_lastRow.insertCell(0);
o_lastRow.insertCell(1);

/* 2 – Display the “Total” label (2 lines below) */
var v_colText = o_lastRow.insertCell(2);

v_colText.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;font-family:Arial'>Max Liability</div>";

o_lastRow.insertCell(3);
o_lastRow.insertCell(4);

var v_colValue = o_lastRow.insertCell(5);

/* 3 – Display the result of the calculation (2 lines below) */
v_colValue.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;;font-family:Arial'>$" + NumberFormatted(v_totalRev,2) + "</div>";

o_lastRow.insertCell(6);
o_lastRow.insertCell(7);
o_lastRow.insertCell(8);
o_lastRow.insertCell(9);
o_lastRow.insertCell(10);
o_lastRow.insertCell(11);
o_lastRow.insertCell(12);
o_lastRow.insertCell(13);
o_lastRow.insertCell(14);
o_lastRow.insertCell(15);
o_lastRow.insertCell(16);
o_lastRow.insertCell(17);
o_lastRow.insertCell(18);
o_lastRow.insertCell(19);

}
}
</script>

<script>
f_calTotal();
</script>

</div>
<script>

function NumberFormatted(amount,decimal)
{
if(isNaN(amount))
i = 0.00;
else
{
var v_number = parseFloat(amount);
var v_minus = '';
if(v_number < 0)
v_minus = '-';
v_number = Math.abs(v_number);
v_number = Math.round(v_number*Math.pow(10,decimal));
v_number = v_number/Math.pow(10,decimal);
v_numStr = new String(v_number);
v_decStr = new String(Math.pow(10,decimal));
if(v_numStr.indexOf(".") < 0)
v_numStr = v_numStr + "." + v_decStr.substr(1,v_decStr.length);
else
v_numStr = v_numStr + v_decStr.substr(1,v_decStr.length);
return (v_minus + v_numStr.substr(0,v_numStr.indexOf(".") + decimal + 1));
}
}

function f_calTotal()
{
var v_totalRev = 0;
var v_rev = 0;

//sb var cas_form = document.getElementById("cb_resultTotal");

var o_cbwrapper = document.getElementById("cb_resultTotal") ;

var o_cbtables = o_cbwrapper.getElementsByTagName("table");
var o_rtable = null;

/* find the correct table */
for(var i = 0; i < o_cbtables.length; i++)
{
if(o_cbtables[i].rows[0].cells.length >= 4)
{
o_rtable = o_cbtables[i];
break;
}
}

//sb if (cas_form.getElementsByTagName("table").length > 0)

if(o_rtable)
{
//sb var cas_rows = cas_form.getElementsByTagName("table")[1].getElementsByTagName("tr");

var cas_rows = o_rtable.getElementsByTagName("tr");
for(var rowIndex=1; rowIndex < cas_rows.length; rowIndex++)
{
var cells = cas_rows[rowIndex].getElementsByTagName("td");

/* 1 – change value inside brackets to choose column to calculate sum */
v_rev = cells[6].innerHTML;

if ((v_rev != "&nbsp;") && (v_rev != null) && (v_rev != ""))
{
v_rev = v_rev.replace(/\$|,/gi,'') ;
if (!isNaN(v_rev))
v_totalRev = v_totalRev + parseFloat(v_rev);
}
}

var v_nrow = cas_rows.length;
o_rtable.insertRow(v_nrow);
var o_lastRow = o_rtable.rows[v_nrow] ;

o_lastRow.style.background = "#385C7E";
o_lastRow.insertCell(0);
o_lastRow.insertCell(1);

/* 2 – Display the “Total” label (2 lines below) */
var v_colText = o_lastRow.insertCell(2);

v_colText.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;font-family:Arial'>Liability Removed</div>";

o_lastRow.insertCell(3);
o_lastRow.insertCell(4);

var v_colValue = o_lastRow.insertCell(5);

/* 3 – Display the result of the calculation (2 lines below) */
v_colValue.innerHTML = "<div style='padding:5px;color:#ffffff;font-size:14px;font-weight:bold;;font-family:Arial'>$" + NumberFormatted(v_totalRev,2) + "</div>";

o_lastRow.insertCell(5);
o_lastRow.insertCell(7);
o_lastRow.insertCell(8);
o_lastRow.insertCell(9);
o_lastRow.insertCell(10);
o_lastRow.insertCell(11);
o_lastRow.insertCell(12);
o_lastRow.insertCell(13);
o_lastRow.insertCell(14);
o_lastRow.insertCell(15);
o_lastRow.insertCell(16);
o_lastRow.insertCell(17);
o_lastRow.insertCell(18);
o_lastRow.insertCell(19);

}
}
</script>

<script>
f_calTotal();
</script>