function IsNumeric(sText) {
	return !isNaN(sText);
}

function setFocus(strField) {
	var oObj;
	
	try {
		oObj = document.getElementById(strField);
		if (oObj) {
			oObj.focus();
		}
	} catch (err) {
		//do nothing
	}
}

function modalDialog(cURL, cWindowName, cDlgWidth, cDlgHeight) {
	if (window.showModalDialog) {
		return window.showModalDialog(cURL, cWindowName, 'dialogWidth:' + cDlgWidth + 'px;dialogHeight:' + cDlgHeight + 'px');
	} else {
		window.open(cURL, cWindowName, 'height=' + cDlgHeight + ',width=' + cDlgWidth + ',toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no ,modal=yes');
		return '';
	}
}

// BEGIN JavaScript Functions Written by:
//    Scott Mitchell
//    mitchell@4guysfromrolla.com
//    http://www.4GuysFromRolla.com
// 
// Modified by dbb 7/11/06.

function FormatNumber(num,decimalNum) {
	if (isNaN(parseInt(num))) {
		return "";
	}
	
	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1;		// Get sign of number
	
	// Adjust number so only the specified number of numbers after
	// the decimal point are shown.
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum));
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign;					// Readjust for sign
	
	// Create a string object to do our formatting on
	var tmpNumStr = new String(tmpNum);

	return tmpNumStr;		// Return our formatted string!
}

function LTrim(str) {
	var whitespace = new String(" \t\n\r");
	
	var s = new String(str);
	var j, i;
	
	if (whitespace.indexOf(s.charAt(0)) != -1) {
		// We have a string with leading blank(s)...
		
		j = 0;
		i = s.length;
		
		// Iterate from the far left of string until we
		// don't have any more whitespace...
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
			j++;
		}
		
		// Get the substring from the first non-whitespace
		// character to the end of the string...
		s = s.substring(j, i);
	}
	
	return s;
}

function RTrim(str) {
	// We don't want to trip JUST spaces, but also tabs,
	// line feeds, etc.  Add anything else you want to
	// "trim" here in Whitespace
	var whitespace = new String(" \t\n\r");
	
	var s = new String(str);
	var i;
	
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
		// We have a string with trailing blank(s)...
		
		i = s.length - 1;       // Get length of string
		
		// Iterate from the far right of string until we
		// don't have any more whitespace...
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
			i--;
		}
		
		// Get the substring from the front of the string to
		// where the last non-whitespace character is...
		s = s.substring(0, i+1);
	}
	
	return s;
}

function Trim(str) {
	return RTrim(LTrim(str));
}

function Em(str) {
	if (str === null) {
		return true;
	} else {
		return (String(Trim(str)).length === 0);
	}
}

function Len(str) {
	return String(str).length;
}

function Left(str, n) {
	if (n <= 0) {     // Invalid bound, return blank string
		return "";
	} else if (n > String(str).length) {   // Invalid bound, return
		return str;                // entire string
	} else { // Valid bound, return appropriate substring
		return String(str).substring(0,n);
	}
}

function Right(str, n) {
	var iLen;
	
	if (n <= 0) {     // Invalid bound, return blank string
		return "";
	} else if (n > String(str).length) {   // Invalid bound, return
		return str;                     // entire string
	} else { // Valid bound, return appropriate substring
		iLen = String(str).length;
		return String(str).substring(iLen, iLen - n);
	}
}

function Mid(str, start, len) {
	// Make sure start and len are within proper bounds
	if (start < 0 || len < 0) {
		return "";
	}
	
	var iEnd, iLen = String(str).length;
	if (start + len > iLen) {
		iEnd = iLen;
	} else {
		iEnd = start + len;
	}
	
	return String(str).substring(start,iEnd);
}

// END JavaScript Functions Written by:
//    Scott Mitchell
