//=======================================================================
//input validation:
// acqui/uncertainprice.tmpl uses this
function uncheckbox(form, field) {
var price = new Number(form.elements['price' + field].value);
var tmpprice = "";
var errmsg = MSG_INVALIDPRICE;
if (isNaN(price)) {
alert(errmsg);
for(var i=0; i
0) {
return false;
}
return true;
}
//Function returns false if v is not a number (if maybenull is 0, it also returns an error if the number is 0)
function isNum(v,maybenull) {
var n = new Number(v.value);
if (isNaN(n)) {
return false;
}
if (maybenull==0 && v.value=='') {
return false;
}
return true;
}
//a logging function (a bit buggy, might open millions of log pages when initializing, but works fine after...
function log(message) {
if (!log.window_ || log.window_.closed) {
var win = window.open("", null, "width=400,height=200," +
"scrollbars=yes,resizable=yes,status=no," +
"location=no,menubar=no,toolbar=no");
if (!win) return;
var doc = win.document;
doc.write("Debug Log" +
"");
doc.close();
log.window_ = win;
}
var logLine = log.window_.document.createElement("div");
logLine.appendChild(log.window_.document.createTextNode(message));
log.window_.document.body.appendChild(logLine);
}
//=======================================================================
function getElementsByClass( searchClass, domNode, tagName) {
if (domNode == null) domNode = document;
if (tagName == null) tagName = '*';
var el = new Array();
var tags = domNode.getElementsByTagName(tagName);
var tcl = " "+searchClass+" ";
for(i=0,j=0; i 0 ) {
remainingTotal.style.color = 'green';
} else { // if its negative, make it red..
remainingTotal.style.color = 'red';
}
remainingTotal.textContent = remainingNew.toFixed(2) ;
}
function autoFillRow(bud_id) {
var remainingTotal = document.getElementById("budget_est_"+bud_id);
var remainingNew = new Number;
var budgetTotal = document.getElementById("budget_tot_"+bud_id ).textContent;
var arr = getElementsByClass("plan_entry_" + bud_id);
budgetTotal = budgetTotal.replace(/\,/, "");
var qty = new Number;
// get the totals
var novalueArr = new Array();
for ( var i=0, len=arr.length; i
");
win.document.write(etc);
win.document.write("
");
win.document.write("