
	function blockNaNs(e, objElement, allowPeriod)
	{
		var key;
		var keychar;
		var reg;
		
		if(window.event) {
			// get key code from IE
			key = e.keyCode; 
		}
		else if(e.which) {
			// get key code from netscape, firefox, mozilla, etc.
			key = e.which; 
		}
		else {
			// no event, so pass on through
			return true;
		}
		
		keychar = String.fromCharCode(key);
		reg = /\d/;

		//Exceptions, always pass these thru.
		
			//PERIOD (only allow one)
			if( (keychar == "." && String(objElement.value).indexOf('.') < 0) && allowPeriod )
				return true;
		
			//BACKSPACE key (firefox, mozilla & netscape filter this out, IE does not but we still need the exception)
			if( key == 8 )
				return true;
				
			//ALT pressed (to allow shortcut keys)
			if( e.altKey )
				return true;
				
			if(e.tabKey )
				return true;
			
			//CTRL pressed (to allow shortcut keys)
			if( e.ctrlKey )
				return true;
		
		//End Exceptions
		
		//if a period is the fist character, prepend a zero
		if( String(objElement.value).indexOf('.') == 0 )
			objElement.value = '0' + objElement.value;
		
		return reg.test(keychar);
	}
	
	function stripCurrencyFormat(objElement)
	{
		objElement.value = String(objElement.value).replace(/\$|\,/g,'');
	}
	
	function formatCurrency(objElement) 
	{
		
		if( String(objElement.value) == "")
			return 0;
		
		num = objElement.value
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
			num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
			cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		objElement.value =  (((sign)?'':'-') + '$' + num + '.' + cents);
		//objElement.value =  (((sign)?'':'-') + '$' + num);
	}
	
	function formatCurrency_variable( num )
	{
		if( String(num) == "")
			return "$0.00";
		
		num = num.toString().replace(/\$|\,/g,'');
		if(isNaN(num))
			num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
		if(cents<10)
			cents = "0" + cents;
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
			num = num.substring(0,num.length-(4*i+3))+','+
		num.substring(num.length-(4*i+3));
		return  (((sign)?'':'-') + '$' + num + '.' + cents);
	}

	function validateNumeric(objElement)
	{
		if( isNaN(objElement.value) )
		{
			alert( 'Data entered is not a number. \n\n Please only enter numeric values.' );
			objElement.focus();
			return false;
		}
		
		//if a period is the fist character, prepend a zero
		if( String(objElement.value).indexOf('.') == 0 )
			objElement.value = '0' + objElement.value;
		
		return true;
	}
	
	function isNumberKey(e)
	{
		var key;
		var keychar;
		var reg;
		
		if(window.event) {
			// get key code from IE
			key = e.keyCode; 
		}
		else if(e.which) {
			// get key code from netscape, firefox, mozilla, etc.
			key = e.which; 
		}
		else {
			// no event, so pass on through
			return false;
		}
		
		if( (key > 47 && key < 58) || (key > 95 && key < 106) )
			return true;
		else
			return false;
		
		
	}

function ddTitle_c(dd,t){
    var tb=document.getElementById(t);
    if(tb){
        tb.disabled=(dd.options[dd.selectedIndex].value!="Other");
        if(!tb.disabled)tb.focus();else tb.value="";   
    }    
}
function disablePhoneOpts( objSrc, objDis1, objDis2 )
{
	objDis1.checked = false;
	objDis2.checked = false;
}

function getParent( obj )
{
    if (obj.parentNode) 
    {
        return obj.parentNode;
    }
    else if (obj.parentElement) 
    {
        return obj.parentElement;
    }
}
	function validateEmail(src) 
	{
		var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
		src = src.toLowerCase();
		var valid = regex.test(src);
		
//check for a .mil or .gov address
		if( valid )
		{
			if( src.substring(src.length-3, src.length) == 'mil' || src.substring(src.length-3, src.length) == 'gov' )
				valid = true;
			else
				valid = false;
		}
		
		return valid;
		
	}

function validateREQ(objForm)
{
	var loopCounter
	var msg = new String("");

	//validate the easy ones...
	for(loopCounter=0; loopCounter < objForm.length ;loopCounter++)
	{
		objControl = objForm.elements[loopCounter];
		if( objControl.getAttribute('req') == 'yes' )
		{
			if( String(objControl.value) == ""  || (objControl.id=="service_affil" && String(objControl.value)=="1")) //1 is "unknown"
			{
			msg += "   " + objControl.getAttribute('displayName') + " is missing.\n";
			
			//change that control's back color to lightsteelblue
			objControl.style.backgroundColor = 'lightsteelblue';
			}
			else
			{
				if( String(objControl.id) !== 'btnSubmit' && String(objControl.id) !== 'btnBack' && String(objControl.id) !== 'fsIAM' && String(objControl.id) !== 'fsBranch' && String(objControl.id) !== 'fsPosition'  )
				objControl.style.backgroundColor = 'white';
			}
		}
	}
	
	if( msg == "" )
		return true;
	else
		return false;
	
}
function atLeastOneRadio( arrControlIDlist )
{
	//loop thru arrControlList and make sure at least one
	//of the controls is CHECKED
    
	var i;
    
	for( i=0; i<arrControlIDlist.length; i++)
	{
		if( document.getElementById(arrControlIDlist[i]).checked )
			return true;
	}
    
	return false;
    
}
function validateUSDate( strValue ) 
	{

		var objRegExp = /^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/
	        
		//check to see if in correct format
		if(!objRegExp.test(strValue))
			return false; //doesn't match pattern, bad date
		else{
			var strSeparator = strValue.substring(2,3) 
			var arrayDate = strValue.split(strSeparator); 
			//create a lookup for months not equal to Feb.
			var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31, '06' : 30,'07' : 31, '08' : 31,'09' : 30, '10' : 31,'11' : 30,'12' : 31}
			var intDay = parseInt(arrayDate[1],10); 

			//check if month value and day value agree
			if(arrayLookup[arrayDate[0]] != null) {
				if(intDay <= arrayLookup[arrayDate[0]] && intDay != 0)
					return true; //found in lookup table, good date
			}
	
			var intMonth = parseInt(arrayDate[0],10);
			if (intMonth == 2) { 
				var intYear = parseInt(arrayDate[2]);
				if (intDay > 0 && intDay < 29) {
					return true;
				}
				else if (intDay == 29) {
					if ((intYear % 4 == 0) && (intYear % 100 != 0) || 
						(intYear % 400 == 0)) {
						// year div by 4 and ((not div by 100) or div by 400) ->ok
						return true;
					}   
				}
			}
		}  
		return false; //any other values, bad date
	}

function showCopy(){
	var cw=window.open('Copyright.htm','','left=350,top=150,scrollbars=no,status=0,width=363,height=300');

}
function fiFile_au(which,bn){
	var b=document.getElementById(bn);
	if(which.value!=""){
		if(b) b.disabled=false;
	}
	else{
		if(b) b.disabled=true;
	}
}



















