// JavaScript Document
function gVal(id) {
	var value	=	document.getElementById(id).value;
	return value;
}
function gsVal(sName,fName)
{
	var sBox	=	document.forms[fName][sName];
	if (sBox.selectedIndex=='-1')
	{
		sBox.selectedIndex=eval(document.forms[fName][sName].length - 1);
	}
	var fVal = sBox.options[sBox.selectedIndex].value;
	return fVal;
}
function gsObj(sName,fName)
{
	var sBox	=	document.forms[fName][sName];
	if (sBox.selectedIndex=='-1')
	{
		sBox.selectedIndex=eval(document.forms[fName][sName].length - 1);
	}
	var fVal = sBox.options[sBox.selectedIndex];
	return fVal;
}

function gEID(id) {
	if (document.getElementById(id)) {
		var value	=	document.getElementById(id);
	} else {
		var value	=	false;
	}
	return value;
}
function isNumeric(strString) {
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;
	
	if (strString.length == 0) return false;
	
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}
function strpos( haystack, needle, offset)
{
    var i = haystack.indexOf( needle, offset ); // returns -1
    return i >= 0 ? i : false;
}
function getCName(id)
{
	var inpBox 	= gEID(id);
	var inpTXT	=	inpBox.value;
	var fDash	 	= strpos(inpTXT,'|',0);
	if (fDash != false)
	{
		var arrTXT		=	inpTXT.split("|");
		inpBox.value 	= arrTXT[0]; 
	}
	else
	{
		inpBox.value 	= inpTXT; 
	}
}
function getEmail(id)
{
	var inpBox 	= gEID(id);
	var inpTXT	=	inpBox.value;
	var fDash	 	= strpos(inpTXT,'-',0);
	if (fDash != false)
	{
		var arrTXT		=	inpTXT.split("-");
		inpBox.value 	= arrTXT[1]; 
	}
	else
	{
		inpBox.value 	= inpTXT; 
	}
}
function hasWhiteSpace(s) 
{

     reWhiteSpace = new RegExp(/^\s+$/);

     // Check for white space
     if (reWhiteSpace.test(s)) {
          alert("Please remove any spaces in the value.");
          return false;
     }
return true;
}