function formatcurrency(amount) {
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return "$" + s;
}

function getElement(element) {
	if (document.getElementById) {
		return document.getElementById(element);
	}	
	else if (document.all) {
		return document.all(element);
	}
	else if (document.layers){
		return document.layers[element];
	}
	else {
		return null;
	}
}

function getDocElement(doc, element) {
	if (doc.getElementById) {
		return doc.getElementById(element);
	}	
	else if (doc.all) {
		return doc.all(element);
	}
	else if (doc.layers){
		return doc.layers[element];
	}
	else {
		return null;
	}
}

function setSpanText(id, text) {
	var spanObj = getElement(id);
	spanObj.innerHTML = text;
}

function borderit(which,color){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		which.style.borderColor=color;
	}
}

function openwin(htmlFile, win_width, win_height) {
	thewin=open("","NewWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width="+win_width+",height="+win_height);
	thewin.location = htmlFile;
}

function trim ( s ) {
	s = s.replace( /^\s*/, "" );
	s = s.replace( /\s*$/, "" );
	return s;
}

