
var win; //reference to window
function openWin (url,width,height) {
	
	//var top = document.body.clientHeight / 2 - 200
	//var left = document.body.clientWidth / 2 - 200
	
	/*if ( win && win.open && !win.closed ) {		
		win.close()
	}*/

	eval("win=window.open (url,'winTop','toolbar=0,location=0,status=1,menubar=0,scrollbars=1,resizable=1,width="+width+",height="+height+"')")
	
	win.focus();

}

function ltrim ( s )
{
	return s.replace( /^\s*/, "" );
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

function trim ( s )
{
	return rtrim(ltrim(s));
}

//checks for a valid number - decimal and integer
function isNumber ( s ) {
	if ( s == "" || isNaN(parseInt(s)) ) {
		return false;
	}
	var j=0;	//number of "." occurences
	for (var i=0; i<s.length; i++) {	//check for integers and "."
		if ( s.charAt(i).search (/[0-9]/) == -1 && s.charAt(i).search (/[.]/) == -1 ) {
			return false;	
		}
		if ( s.charAt(i) == "." )
			j++;
	}		
	if ( s.search(/\.$/) != -1 || j>1 ) {	//check for "." at the end and # of "."
		return false;
	}

	return true;
}

function confirmDelete (url,message,repeat)
{
	var c = window.confirm (message)
	if (c && repeat > 1)
		c = window.confirm ("Are you sure?")
			
	if (c)
		parent.frames(3).location.href = url
	else
		return;
}

//gets row index
function getPosition() {
	var e=event.srcElement;
	while ( ("TR"!=e.tagName) && ("TABLE"!=e.tagName) )
		e=e.parentElement;
	return e.rowIndex;
}

//t = table name
function rowOn (t) {
	eval("document.all." + t + ".rows(getPosition()).bgColor = '#FFFFFF'");
}

function rowOff (t) {
	eval("document.all." + t + ".rows(getPosition()).bgColor = '#F2F2F2'");
}