function setInputFocus(InputName) {
	var focusObject = document.getElementById(InputName);
	
	if (focusObject) {
		document.getElementById(InputName).focus();
	}
	else {
		//do nothing
	}
}
function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char; 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;   
   }
   
function CF(FieldName,ErrorText) {
	document.getElementById(FieldName).style.background='white';
	if (document.getElementById(FieldName).value == "") {
		missinginfo += "\n     -  " + ErrorText;
		document.getElementById(FieldName).style.background='yellow';
	}
}

function CFLength(FieldName,ErrorText,MaxLength) {
	document.getElementById(FieldName).style.background='white';
	if (document.getElementById(FieldName).value == "") {
		missinginfo += "\n     -  " + ErrorText;
		document.getElementById(FieldName).style.background='yellow';
	}
	else if (document.getElementById(FieldName).value.length > MaxLength) {
	//var CurLenth=CStr(document.getElementById(FieldName).value.length);
	//var CurDiff=document.getElementById(FieldName).value.length - MaxLenth;
	var CurDiff="booya";
		missinginfo += "\n     -  you have entered too many characters.  \n\t  You are only allowed "+MaxLength + ' ' +"characters.  \n\t  You are currently using "+document.getElementById(FieldName).value.length + ' ' +"characters. ";
		document.getElementById(FieldName).style.background='yellow';
	}
}

function CFDate(FieldName,ErrorText) {
	document.getElementById(FieldName).style.background='white';
	
	var d = document.getElementById(FieldName).value;
	if (document.getElementById(FieldName).value == "") {
	missinginfo += "\n     -  " + ErrorText;
	document.getElementById(FieldName).style.background='yellow';
	}
	else {
		if (isNaN(new Date(document.getElementById(FieldName).value))){	
		missinginfo += "\n     -  a valid date in MM/DD/YYYY format (ex 11/19/2003)";
		document.getElementById(FieldName).style.background='yellow';
		}
	}
}

function isEmail(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}
function BoxShow() {
	document.getElementById('BusyBox1').style.display='block';
}
function swap(id, imgsrc) {
 document.getElementById(id).setAttribute('src', 'img/Nav/' + imgsrc + '.gif');
}
function swapPort(id, imgsrc) {
 document.getElementById(id).setAttribute('src', 'img/Port/' + imgsrc + '');
}

