function stopKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
function newAjaxRequest() {
var rq;
if (window.XMLHttpRequest) { // All browsers except IE
rq = new XMLHttpRequest();
} else if (window.ActiveXobject) { // IE
rq = new ActiveXObject("Microsoft.XMLHTTP");
}
return rq;
}
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
function notifyOpen(form,timeout) {
var newNotify = '';
newNotify += '
';
newNotify += '';
newNotify += ' ';
newNotify += ' | ';
newNotify += ' | ';
newNotify += ' Notification: ' + form + ' | ';
newNotify += ' | ';
newNotify += ' ';
newNotify += ' |
';
newNotify += ' |
';
newNotify += '
';
document.getElementById('notifyBox').innerHTML = newNotify;
if (timeout > 0) {
var newtimeout = timeout * 1000;
setTimeout(notifyClose, newtimeout);
}
}
function notifyClose(form) {
document.getElementById('notifyBox').innerHTML = "";
}
function toggleVis(obj,pic,toggle) {
var el = document.getElementById(obj);
// var stamp = new Date().getTime();
// "/t?e=" + obj + "&d=" + stamp
// "/t?c=" + obj + "&d=" + stamp
if (el.style.display != 'none') { el.style.display = 'none'; if (pic != "") { document.images[pic].src = "/images/expand.gif"; } }
else { el.style.display = ''; if (pic != "") { document.images[pic].src = "/images/collapse.gif"; } }
}
function setText(objId,x,newText) { //v9.0
with (document){ if (getElementById){
var obj = getElementById(objId);} if (obj) obj.value = newText;
}
}
function round_to_n (num, places) {
//# Default of 2 decimal places
if (places == undefined) { places = 2; }
//# Bail if num or places is NaN, also make sure they are both strings
if (isNaN(parseFloat(num)) || !isFinite(num)) { return num; }
else if (typeof num == 'number') { num += ''; }
if (isNaN(parseFloat(places)) || !isFinite(places)) { return num; }
else if (typeof places == 'number') { places += ''; }
//# Convert to string / Check for more than one decimal or no num/places; bail if so
if (num.match(/\./g) != null) {
if (((num.match(/\./g)).length > 1) || (num == undefined)) { return num; }
}
else { num += '.'; }
//# Default 2 decimal places
if (places == undefined) {places = 2;}
//# Round up (if first irrelevant digit is 5-9)
if (num.charAt(num.indexOf('.') + places + 1) > 4) {
//# Build a float in the form of 0.0001 (to appropriate length) to add for uprounding
var add = '';
if (places != 0) {
for (i=1; i