	var sURL = unescape(window.location.pathname);
	var granteeNameDisplay = '';
	var grantorNameDisplay = '';
	var pathToImages = '/templates/efile/images/';
		
		/*
	*	Function Name:  disableme( control )
	*	Author:			Lee Patsel	
	*	Creation Date:	09/01/05
	*	Purpose:		This function disables the control that calls it
	*	Triggers:		clicking on the submit button of any form
	*	Precondition:	none
	*	Parameters:		none
	*	Return Values:	0 if dates are same, 1 if date1 is later, -1 if date1 is earlier
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/ 
	function disableMe( thecontrolid )
	{
		document.getElementById(thecontrolid).disabled = true;
		return true;
	}
	/*
	*	Function Name:  misc form validation functions
	*	Author:			Russell Bowman
	*	Creation Date:	02/20/06
	*	Purpose:		These various functions validate html forms
	*	Triggers:		depends on the type of validation
	*	Precondition:	none
	*	Parameters:		none	
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/ 
	//-------------------------------------------------------------------
	// Trim functions
	//   Returns string with whitespace trimmed
	//-------------------------------------------------------------------
	function LTrim(str){
		if (str==null){return null;}
		for(var i=0;str.charAt(i)==" ";i++);
		return str.substring(i,str.length);
		}
	function RTrim(str){
		if (str==null){return null;}
		for(var i=str.length-1;str.charAt(i)==" ";i--);
		return str.substring(0,i+1);
		}
	function Trim(str){return LTrim(RTrim(str));}
	
	function LTrimAll(str) {
		if (str==null){return str;}
		for (var i=0; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i++);
		return str.substring(i,str.length);
		}
	function RTrimAll(str) {
		if (str==null){return str;}
		for (var i=str.length-1; str.charAt(i)==" " || str.charAt(i)=="\n" || str.charAt(i)=="\t"; i--);
		return str.substring(0,i+1);
		}
	function TrimAll(str) {
		return LTrimAll(RTrimAll(str));
		}
	//-------------------------------------------------------------------
	// isNull(value)
	//   Returns true if value is null
	//-------------------------------------------------------------------
	function isNull(val){return(val==null);}
	
	//-------------------------------------------------------------------
	// isBlank(value)
	//   Returns true if value only contains spaces
	//-------------------------------------------------------------------
	function isBlank(val){
		if(val==null){return true;}
		for(var i=0;i<val.length;i++) {
			if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
			}
		return true;
		}	
	//-------------------------------------------------------------------
	// isAlphaNumeric(input) this was used to validate the grantor grantee text boxes from onBlur
	//   Returns true if value contains all alphanumeric characters
	//-------------------------------------------------------------------
	// check to see if input is alphanumeric
	function isAlphaNumeric(input)
	{		
		//alert(input.value);
		val = input.value;		 
		if (val=='')
		{
			return true;
		}
			else
		{
			if (val.match(/^[.,a-zA-Z0-9 ]+$/))
			{
				var val = '';
				return true; 
			}
			else
			{
				alert( 'The input field ' + input.name + ' only takes alphanumeric characters.' );	input.focus();
				var val = '';
				return false;
			} 
		}			
	}
	//-------------------------------------------------------------------
	// isInteger(value)
	//   Returns true if value contains all digits
	//-------------------------------------------------------------------
	function isInteger(input)
	{	
		if (isBlank(input.value))
		{
			alert( 'The input field ' + input.name + ' is empty.' ); 
			input.value = 0;
			input.focus();
		}
		for(var i=0;i<input.value.length;i++)
		{
			if(!isDigit(input.value.charAt(i)))
			{
				if(i=input.value.length)//break out of the for loop when an alpha char is found
				{
				alert( 'The input field ' + input.name + ' only takes numbers.' );	input.focus()			
				return false;
				}
			}	
		}
	}
	//-------------------------------------------------------------------
	// isNumeric(value)
	//   Returns true if value contains a positive float value
	//-------------------------------------------------------------------
	//function isNumeric(input){return(parseFloat(input,10)==(input*1));}
	function isNumeric(input)
	{	
		var test = input.value;	
		if(parseFloat(test,10)==(test*1)){}	
		else
		{
			alert( 'The input field ' + input.name + ' must be a float value.' ); input.focus();
			return false;
		}
	}
	
	function isZero(input)
	{
		var test = input.value;	
		if(  test == 0 )
			{
				alert( input.name + ' cannot be 0.' ); input.focus()
				return false;
			}
	}
	
	//-------------------------------------------------------------------
	// isArray(obj)
	// Returns true if the object is an array, else false
	//-------------------------------------------------------------------
	function isArray(obj){return(typeof(obj.length)=="undefined")?false:true;}
	
	//-------------------------------------------------------------------
	// isDigit(value)
	//   Returns true if value is a 1-character digit
	//-------------------------------------------------------------------
	function isDigit(num) {
		if (num.length>1){return false;}
		var string="1234567890";
		if (string.indexOf(num)!=-1){return true;}
		return false;
		}
	
	//-------------------------------------------------------------------
	// setNullIfBlank(input_object)
	//   Sets a form field to "" if it isBlank()
	//-------------------------------------------------------------------
	function setNullIfBlank(obj){if(isBlank(obj.value)){obj.value="";}}
	
	//-------------------------------------------------------------------
	// setFieldsToUpperCase(input_object)
	//   Sets value of form field toUpperCase() for all fields passed
	//-------------------------------------------------------------------
	function setFieldsToUpperCase(){
		for(var i=0;i<arguments.length;i++) {
			arguments[i].value = arguments[i].value.toUpperCase();
			}
		}
	
	//-------------------------------------------------------------------
	// disallowBlank(input_object[,message[,true]])
	//   Checks a form field for a blank value. Optionally alerts if 
	//   blank and focuses
	//-------------------------------------------------------------------
	function disallowBlank(obj){
		var msg=(arguments.length>1)?arguments[1]:"";
		var dofocus=(arguments.length>2)?arguments[2]:false;
		if (isBlank(getInputValue(obj))){
			if(!isBlank(msg)){alert(msg);}
			if(dofocus){
				if (isArray(obj) && (typeof(obj.type)=="undefined")) {obj=obj[0];}
				if(obj.type=="text"||obj.type=="textarea"||obj.type=="password") { obj.select(); }
				obj.focus();
				}
			return true;
			}
		return false;
		}
	
	//-------------------------------------------------------------------
	// disallowModify(input_object[,message[,true]])
	//   Checks a form field for a value different than defaultValue. 
	//   Optionally alerts and focuses
	//-------------------------------------------------------------------
	function disallowModify(obj){
		var msg=(arguments.length>1)?arguments[1]:"";
		var dofocus=(arguments.length>2)?arguments[2]:false;
		if (getInputValue(obj)!=getInputDefaultValue(obj)){
			if(!isBlank(msg)){alert(msg);}
			if(dofocus){
				if (isArray(obj) && (typeof(obj.type)=="undefined")) {obj=obj[0];}
				if(obj.type=="text"||obj.type=="textarea"||obj.type=="password") { obj.select(); }
				obj.focus();
				}
			setInputValue(obj,getInputDefaultValue(obj));
			return true;
			}
		return false;
		}
	
	//-------------------------------------------------------------------
	// commifyArray(array[,delimiter])
	//   Take an array of values and turn it into a comma-separated string
	//   Pass an optional second argument to specify a delimiter other than
	//   comma.
	//-------------------------------------------------------------------
	function commifyArray(obj,delimiter){
		if (typeof(delimiter)=="undefined" || delimiter==null) {
			delimiter = ",";
			}
		var s="";
		if(obj==null||obj.length<=0){return s;}
		for(var i=0;i<obj.length;i++){
			s=s+((s=="")?"":delimiter)+obj[i].toString();
			}
		return s;
		}
	
	//-------------------------------------------------------------------
	// getSingleInputValue(input_object,use_default,delimiter)
	//   Utility function used by others
	//-------------------------------------------------------------------
	function getSingleInputValue(obj,use_default,delimiter) {
		switch(obj.type){
			case 'radio': case 'checkbox': return(((use_default)?obj.defaultChecked:obj.checked)?obj.value:null);
			case 'text': case 'hidden': case 'textarea': return(use_default)?obj.defaultValue:obj.value;
			case 'password': return((use_default)?null:obj.value);
			case 'select-one':
				if (obj.options==null) { return null; }
				if(use_default){
					var o=obj.options;
					for(var i=0;i<o.length;i++){if(o[i].defaultSelected){return o[i].value;}}
					return o[0].value;
					}
				if (obj.selectedIndex<0){return null;}
				return(obj.options.length>0)?obj.options[obj.selectedIndex].value:null;
			case 'select-multiple': 
				if (obj.options==null) { return null; }
				var values=new Array();
				for(var i=0;i<obj.options.length;i++) {
					if((use_default&&obj.options[i].defaultSelected)||(!use_default&&obj.options[i].selected)) {
						values[values.length]=obj.options[i].value;
						}
					}
				return (values.length==0)?null:commifyArray(values,delimiter);
			}
		alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
		return null;
		}
	
	//-------------------------------------------------------------------
	// getSingleInputText(input_object,use_default,delimiter)
	//   Utility function used by others
	//-------------------------------------------------------------------
	function getSingleInputText(obj,use_default,delimiter) {
		switch(obj.type){
			case 'radio': case 'checkbox': 	return "";
			case 'text': case 'hidden': case 'textarea': return(use_default)?obj.defaultValue:obj.value;
			case 'password': return((use_default)?null:obj.value);
			case 'select-one':
				if (obj.options==null) { return null; }
				if(use_default){
					var o=obj.options;
					for(var i=0;i<o.length;i++){if(o[i].defaultSelected){return o[i].text;}}
					return o[0].text;
					}
				if (obj.selectedIndex<0){return null;}
				return(obj.options.length>0)?obj.options[obj.selectedIndex].text:null;
			case 'select-multiple': 
				if (obj.options==null) { return null; }
				var values=new Array();
				for(var i=0;i<obj.options.length;i++) {
					if((use_default&&obj.options[i].defaultSelected)||(!use_default&&obj.options[i].selected)) {
						values[values.length]=obj.options[i].text;
						}
					}
				return (values.length==0)?null:commifyArray(values,delimiter);
			}
		alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
		return null;
		}
	
	//-------------------------------------------------------------------
	// setSingleInputValue(input_object,value)
	//   Utility function used by others
	//-------------------------------------------------------------------
	function setSingleInputValue(obj,value) {
		switch(obj.type){
			case 'radio': case 'checkbox': if(obj.value==value){obj.checked=true;return true;}else{obj.checked=false;return false;}
			case 'text': case 'hidden': case 'textarea': case 'password': obj.value=value;return true;
			case 'select-one': case 'select-multiple': 
				var o=obj.options;
				for(var i=0;i<o.length;i++){
					if(o[i].value==value){o[i].selected=true;}
					else{o[i].selected=false;}
					}
				return true;
			}
		alert("FATAL ERROR: Field type "+obj.type+" is not supported for this function");
		return false;
		}
	
	//-------------------------------------------------------------------
	// getInputValue(input_object[,delimiter])
	//   Get the value of any form input field
	//   Multiple-select fields are returned as comma-separated values, or
	//   delmited by the optional second argument
	//   (Doesn't support input types: button,file,reset,submit)
	//-------------------------------------------------------------------
	function getInputValue(obj,delimiter) {
		var use_default=(arguments.length>2)?arguments[2]:false;
		if (isArray(obj) && (typeof(obj.type)=="undefined")) {
			var values=new Array();
			for(var i=0;i<obj.length;i++){
				var v=getSingleInputValue(obj[i],use_default,delimiter);
				if(v!=null){values[values.length]=v;}
				}
			return commifyArray(values,delimiter);
			}
		return getSingleInputValue(obj,use_default,delimiter);
		}
	
	//-------------------------------------------------------------------
	// getInputText(input_object[,delimiter])
	//   Get the displayed text of any form input field
	//   Multiple-select fields are returned as comma-separated values, or
	//   delmited by the optional second argument
	//   (Doesn't support input types: button,file,reset,submit)
	//-------------------------------------------------------------------
	function getInputText(obj,delimiter) {
		var use_default=(arguments.length>2)?arguments[2]:false;
		if (isArray(obj) && (typeof(obj.type)=="undefined")) {
			var values=new Array();
			for(var i=0;i<obj.length;i++){
				var v=getSingleInputText(obj[i],use_default,delimiter);
				if(v!=null){values[values.length]=v;}
				}
			return commifyArray(values,delimiter);
			}
		return getSingleInputText(obj,use_default,delimiter);
		}
	
	//-------------------------------------------------------------------
	// getInputDefaultValue(input_object[,delimiter])
	//   Get the default value of any form input field when it was created
	//   Multiple-select fields are returned as comma-separated values, or
	//   delmited by the optional second argument
	//   (Doesn't support input types: button,file,password,reset,submit)
	//-------------------------------------------------------------------
	function getInputDefaultValue(obj,delimiter){return getInputValue(obj,delimiter,true);}
	
	//-------------------------------------------------------------------
	// isChanged(input_object)
	//   Returns true if input object's value has changed since it was
	//   created.
	//-------------------------------------------------------------------
	function isChanged(obj){return(getInputValue(obj)!=getInputDefaultValue(obj));}
	
	//-------------------------------------------------------------------
	// setInputValue(obj,value)
	//   Set the value of any form field. In cases where no matching value
	//   is available (select, radio, etc) then no option will be selected
	//   (Doesn't support input types: button,file,password,reset,submit)
	//-------------------------------------------------------------------
	function setInputValue(obj,value) {
		var use_default=(arguments.length>1)?arguments[1]:false;
		if(isArray(obj)&&(typeof(obj.type)=="undefined")){
			for(var i=0;i<obj.length;i++){setSingleInputValue(obj[i],value);}
			}
		else{setSingleInputValue(obj,value);}
		}
		
	//-------------------------------------------------------------------
	// isFormModified(form_object,hidden_fields,ignore_fields)
	//   Check to see if anything in a form has been changed. By default
	//   it will check all visible form elements and ignore all hidden 
	//   fields. 
	//   You can pass a comma-separated list of field names to check in
	//   addition to visible fields (for hiddens, etc).
	//   You can also pass a comma-separated list of field names to be
	//   ignored in the check.
	//-------------------------------------------------------------------
	function isFormModified(theform,hidden_fields,ignore_fields){
		if(hidden_fields==null){hidden_fields="";}
		if(ignore_fields==null){ignore_fields="";}
		var hiddenFields=new Object();
		var ignoreFields=new Object();
		var i,field;
		var hidden_fields_array=hidden_fields.split(',');
		for (i=0;i<hidden_fields_array.length;i++) {
			hiddenFields[Trim(hidden_fields_array[i])]=true;
			}
		var ignore_fields_array=ignore_fields.split(',');
		for (i=0;i<ignore_fields_array.length;i++) {
			ignoreFields[Trim(ignore_fields_array[i])]=true;
			}
		for (i=0;i<theform.elements.length;i++) {
			var changed=false;
			var name=theform.elements[i].name;
			if(!isBlank(name)){
				var type=theform.elements[i].type;
				if(!ignoreFields[name]){
					if(type=="hidden"&&hiddenFields[name]){changed=isChanged(theform[name]);}
					else if(type=="hidden"){changed=false;}
					else {changed=isChanged(theform[name]);}
					}
				}
			if(changed){return true;}
			}
			return false;
		}	
	
	/*
	*	Function Name: 	compareTwoDates( dd1, mm1, yy1, dd2, mm2, yy2 )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/30/05
	*	Purpose:		This function compares two dates					
	*	Triggers:		clicking the View Account Activity button
	*	Precondition:	none
	*	Parameters:		none
	*	Return Values:	0 if dates are same, 1 if date1 is later, -1 if date1 is earlier
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function compareTwoDates( dd1, mm1, yy1, dd2, mm2, yy2 )
	{
		//alert( mm1+dd1+yy1 );
		//alert( mm2+dd2+yy2 );
		if (yy1 > yy2) return 1;
		else if (yy1 < yy2) return -1;
		else if (mm1 > mm2) return 1;
		else if (mm1 < mm2) return -1;
		else if (dd1 > dd2) return 1;
		else if (dd1 < dd2) return -1;
		else return 0;
	}
	/*
	*	Function Name: 	validateDateRange( )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/30/05
	*	Purpose:		This function ensures that the dates are valid					
	*	Triggers:		clicking the View Account Activity button
	*	Precondition:	none
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function validateDateRange( )
	{		
		var today = new Date();		
		var this_day = today.getDate();
		var this_year = today.getFullYear();
		var this_month = today.getMonth()+1;
		var startMonth = document.getElementById( 'startMonth' ).value;
		var startDay = document.getElementById( 'startDay' ).value;
		var startYear = document.getElementById( 'startYear' ).value;
		var endYear = document.getElementById( 'endYear' ).value;
		var endDay = document.getElementById( 'endDay' ).value;
		var endMonth = document.getElementById( 'endMonth' ).value;
		var leap = 0;
		// Is the date selected in the future?
		if( startYear > this_year || endYear > this_year  )
		{
			alert( 'Report cannot be generated for future dates' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
		
		if( startMonth > this_month && startYear >= this_year )
		{
			alert( 'Starting month cannot be in the future' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
		
		if( compareTwoDates( startDay, startMonth, startYear, endDay, endMonth, endYear ) == 1 )
		{
			alert( 'Starting date cannot come after ending date' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
		
		if( startYear > endYear )
		{
			alert( 'End Date cannot be earlier than the start date' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
		
		/* Validation leap-year / february / day */
	   if ( startYear % 4 == 0 || startYear % 100 == 0 || startYear % 400 == 0 )
	   	  leap = 1;
	   
	   if ( startMonth == 2 && leap == 1 && startDay > 29 )
	   {
			alert( 'February does not have that many days' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
	   
	   if ( startMonth == 2 && leap != 1 && startDay > 28 )
	   {
			alert( 'February does not have that many days' );
			document.getElementById( 'startMonth' ).focus();
			return false;
	   }
	   
	    if ( endYear % 4 == 0 || endYear % 100 == 0 || endYear % 400 == 0 )
	   	  leap = 1;
	   
	   if ( endMonth == 2 && leap == 1 && endDay > 29 )
	   {
			alert( 'February does not have that many days' );
			document.getElementById( 'endMonth' ).focus();
			return false;
		}
	   
	   if ( endMonth == 2 && leap != 1 && endDay > 28 )
	   {
			alert( 'February does not have that many days' );
			document.getElementById( 'endMonth' ).focus();
			return false;
	   }
	   
	   /* Validation of other months */
	   if ( startDay > 31 && ( startMonth == 1 ||  startMonth == 3 ||  startMonth == 5
	   		 || startMonth == 7 || startMonth == 8 || startMonth == 10 || startMonth == 12 ))
	   {
			alert( 'Invalid Day for selected month' );
			document.getElementById( 'startMonth' ).focus();
			return false;
	   }
	   
	   if ( startDay > 30 && ( startMonth == 4 || startMonth == 6 || startMonth == 9 
	   		 || startMonth == 11 ))
	    {
			alert( 'Invalid Day for selected month' );
			document.getElementById( 'startMonth' ).focus();
			return false;
		}
		
		/* Validation of other months */
	   if ( endDay > 31 && ( endMonth == 1 ||  endMonth == 3 ||  endMonth == 5
	   		 || endMonth == 7 || endMonth == 8 || endMonth == 10 || endMonth == 12 ))
	   {
			alert( 'Invalid Day for selected month' );
			document.getElementById( 'endMonth' ).focus();
			return false;
	   }
	   
	   if ( endDay > 30 && ( endMonth == 4 || endMonth == 6 || endMonth == 9 
	   		 || endMonth == 11 ))
	    {
			alert( 'Invalid Day for selected month' );
			document.getElementById( 'endMonth' ).focus();
			return false;
		}	 
		return true; 			
	}
		
	/*
	*	Function Name: 	validateAmount( )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/29/05
	*	Purpose:		This function ensures that the amount to be deposited is valid					
	*	Triggers:		clicking the Add Card Button on the addCard form
	*	Precondition:	none
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function validateAmount()
	{
		
		
		var amt = document.getElementById( 'depositAmount' ).value;	
		if(document.getElementById( 'payBISaccount' ).value=='')
		{
			alert( 'Select A Payment Method' );
			document.getElementById( 'payBISaccount' ).focus();
			return false;
		}
		if( TrimAll(document.getElementById( 'depositAmount' ).value) == '' )
		{
			alert( 'Field is empty' );
			document.getElementById( 'depositAmount' ).focus();
			return false;
		}		
		else if( parseFloat( document.getElementById( 'depositAmount' ).value ) < 1 )
		{
			alert( 'Deposits must be at least $1.00' );
			document.getElementById( 'depositAmount' ).focus();
			return false;
		}
		else if(parseFloat( document.getElementById( 'depositAmount' ).value ) > 1000 )
		{
			alert( 'Deposits can not exceed $1,000.00' );
			document.getElementById( 'depositAmount' ).focus();
			return false;
		}
		// check to make sure its a number
		
		if(parseFloat(amt,10)==(amt*1))	
		{
			return true;
		}	
		else
		{
			alert( 'You must enter a numeric value.' ); 
			document.getElementById( 'depositAmount' ).focus();
			return false;
		}
	}
	
	/*
	*	Function Name: 	validateCreditCardInfo( form )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/25/05
	*	Purpose:		This function ensures that all required information is entered before submission					
	*	Triggers:		clicking the Add Card Button on the addCard form
	*	Precondition:	none
	*	Parameters:		form - the form being submitted
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	
	//function validateCreditCardInfo( form )
	//{ 	
		/*
		*	Verify that a name was entered, unable to check anymore than that
		*/
		//if( form.nameOnCard.value == '' )
		//{
		//	alert( 'Please Enter a Name' );
		//	document.getElementById('nameOnCardLabel').style.color = 'red';
		//	form.nameOnCard.focus();
		//	return false;
		//}
		
		/*
		*	Verify that an address was entered, unable to check anymore than that
		*/
		//if( form.streetAddress.value == '' )
		//{
		//	alert( 'Please Enter an address' );
		//	document.getElementById('streetAddressLabel').style.color = 'red';
		//	form.streetAddress.focus();
		//	return false;
		//}
		
		/*
		*	Verify that a name was entered, unable to check anymore than that
		*/
		//if( form.cardCity.value == '' )
		//{
		//	alert( 'Please Enter a city' );
		//	document.getElementById('cityLabel').style.color = 'red';
		//	document.getElementById('cardCity').focus();
		//	return false;
		//}
		
		/*
		*	Verify that a state was entered, unable to check anymore than that
		*/
		//if( document.getElementById('cardState').value == '' )
		//{
		//	alert( 'Please Enter a state' );
		//	document.getElementById('stateLabel').style.color = 'red';
		//	document.getElementById('cardState').focus();
		//	return false;
		//}
		
		/*
		*	Verify that a name was entered, unable to check anymore than that
		*/
		//if( document.getElementById('cardZip').value == '' )
		//{
		//	alert( 'Please Enter a zip code' );
		//	document.getElementById('zipLabel').style.color = 'red';
		//	document.getElementById('cardZip').focus();
		//	return false;
		//}
		
		/*
		*	Verify that a number was entered, unable to check anymore than that
			
		if( document.getElementById('cardNumber').value == '' ||  
			( document.getElementById('cardNumber').value.length != 16 && document.getElementById('cardNumber').value.length != 13 ))
		{
			alert( 'Please Enter a valid credit card number' );
			document.getElementById('cardNumber').style.color = 'red';
			document.getElementById('cardNumberLabel').style.color = 'red';
			document.getElementById('cardNumber').focus();
			return false;
		}
		else
		{
			if( document.getElementById('cardNumber').value.substr( 0, 1 ) == 6 ||
				document.getElementById('cardNumber').value.substr( 0, 1 ) == 3 )
			{
					alert( 'We do not currently accept Discover or American Express' );
					document.getElementById('cardNumber').style.color = 'red';
					document.getElementById('cardNumberLabel').style.color = 'red';
					document.getElementById('cardNumber').focus();
					return false;
			}			
		}
		*/	
		/*
		*	Verify that a date was selected and it is after the current month/year, 
		*	unable to check anymore than that
		*/
		//$date = new Date();
		//$year = $date.getFullYear();
		//$month = $date.getMonth();
		
		//if( document.getElementById('cardExpMonth').value == '' || 
			//document.getElementById('cardExpYear').value =='' )
		//{
			//alert( 'Please select an expiration date' );
			//document.getElementById('expirationLabel').style.color = 'red';
			//document.getElementById('cardExpMonth').focus();
			//return false;
		//}
		//else if( document.getElementById('cardExpYear').value == $year && 
		//		document.getElementById('cardExpMonth').value < $month )
		//{
			//alert( 'Please select a valid expiration date' );
			//document.getElementById('expirationLabel').style.color = 'red';
			//document.getElementById('cardExpMonth').focus();
			//return false;
		//}
		
		/*
		*	Verify that a cvv was entered and it was 3 digits, 
		*	unable to check anymore than that
		*/
		//if( document.getElementById( 'cvv' ).value == '' )
		//{
			//alert( 'Please the CVV/CVV2 number' );
			//document.getElementById('cvvLabel').style.color = 'red';
			//document.getElementById('cvv').focus();
			//return false;
		//}
		//else
		//{
			//if( document.getElementById( 'cvv' ).value.length != 3 )
			//{
			//	alert( 'Please enter a valid CVV/CVV2 number' );
			//	document.getElementById('cvvLabel').style.color = 'red';
			//	document.getElementById('cvv').focus();
			//	return false;
			//}
		//}
	//}
	
		/*
	*	Function Name: 	validateForm( form )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/03/05
	*	Purpose:		This function ensures that all required information is entered before submission					
	*	Triggers:		clicking the add to batch button
	*	Precondition:	none
	*	Parameters:		form - the form being submitted
	*					lastName - stores the name of the text box the grantor / grantee is stored
	*							   this will change in edit mode so it has to be kept track of
	*	Last Modified:	02/23/06
	*	Modified By:	Russell Bowman
	*	Modification:	Inserted boolean flags to break out of calculations and keep the addGrantor/Grantee buttons from adding                        when errors exist. The function now accepts a variable form which is an object of the form passed in by                        the addGrantor/Grantee buttons so value of the button being pressed can be compared to see if the user is                        adding a grantor or grantee.
	*/
	function validateForm( form, lastName )
	{ //alert( form.value );
	
	
		var instrumentCode = document.getElementById('instCode').value;
		var isZeroPageReturn = true;
		var isIntegerPageReturn = true;
		var isIntegerInstReturn = true;
		var isNumericMortgageReturn = true;
		var isNumericConveyanceReturn = true;
		var isNumericPenaltyReturn = true;
		
		if( document.getElementById('instCode').value == 'begin' ) // check the Document Type dropdown for a selection
		{
			alert( 'Please select a document type' );
			//element = document.getElementById('instCode');
			//setTimeout("element.focus()",250);
			document.getElementById('instCode').focus();
			return false;
		}
		
		if( !document.getElementById('docFile').value && document.getElementById('currentDocSelection').value == '' )
		{	
			alert( 'Please upload a document file' );
			//element = document.getElementById('docFile');
			//setTimeout("element.focus()",250);
			document.getElementById('docFile').focus();
			return false;
		}
		
		if(document.getElementById('pages'))
			var isZeroPageReturn = isZero(document.getElementById('pages'));
		
		if (isZeroPageReturn==false)
			return false;
			
		if(document.getElementById('pages'))
			var isIntegerPageReturn = isInteger(document.getElementById('pages'));
		
		if (isIntegerPageReturn==false)
			return false;
		
		if(document.getElementById('addInst'))
			var isIntegerInstReturn = isInteger(document.getElementById('addInst'));			
		
		if (isIntegerInstReturn==false)
			return false;
			
		if(document.getElementById('mortgage'))
			var isNumericMortgageReturn = isNumeric(document.getElementById('mortgage'));
		
		if (isNumericMortgageReturn==false)
			return false;
			
		if(document.getElementById('conveyance'))	
			var isNumericConveyanceReturn = isNumeric(document.getElementById('conveyance'));
		
		if (isNumericConveyanceReturn==false)
			return false;
		
		if(document.getElementById('penalty'))	
			var isNumericPenaltyReturn = isNumeric(document.getElementById('penalty'));
		
		if (isNumericPenaltyReturn==false)
			return false;	
			
	
		if( allInstrumentTypeInfo[instrumentCode]['ExciseTax'] == 'Y' ) // This should only happen in NC
		{			
			if( document.getElementById('excise').value==0 && document.getElementById('exemptCode').value==0 )
			{				
				alert( 'You must enter an Excise Amount OR select an Exempt Code' );
				//element = document.getElementById('excise');
				//setTimeout("element.focus()",250);
				document.getElementById('excise').focus();
				return false;
			}
			if(parseFloat(document.getElementById('excise').value,10)!=(document.getElementById('excise').value*1))
			{
				alert( 'Excise must be in numeric Format' );
				//element = document.getElementById('excise');
				//setTimeout("element.focus()",250);
				document.getElementById('excise').focus();
				return false;
			}
		}
		
		//alert(lastName);
		//alert(form.value);		
		if( form.value == 'Add Grantor' )// test to see if the Add Grantor button is pushed.
		{
			// pipes are used to delimit grantors in tmp pending batches before they are checked out
			// so they must be removed after the Add Grantor button is clicked.
			var newString = document.getElementById(lastName).value.replace(/\|/g, "");
			document.getElementById(lastName).value = newString;
			//e end of replace pipes with spaces
			
			if(document.getElementById(lastName).value == '')
			{				
				alert( 'Please enter a Grantor' );
				//element = lastName;
				//setTimeout("element.focus()",250);
				document.getElementById(lastName).focus();
				return false;
			}
		}
		else if( form.value == 'Add Grantee' )// test to see if the Add Grantee button is pushed.
		{
			// pipes are used to delimit grantees in tmp pending batches before they are checked out
			// so they must be removed after the Add Grantee button is clicked.
			var newString = document.getElementById(lastName).value.replace(/\|/g, "");
			document.getElementById(lastName).value = newString;
			//e end of replace pipes with spaces
			
			if(document.getElementById(lastName).value == '')
			{
				alert( 'Please enter a Grantee' );
				//element = lastName;
				//setTimeout("element.focus()",250);
				document.getElementById(lastName).focus();
				return false;
			}
		}
		
		
		if( document.getElementById('payCounty').value == 'null' )
		{
			document.getElementById('addToBatchButton').disabled=true;
			//alert( 'Please select an account to pay for this Instrument' );
			//element = document.getElementById('payCounty');
			//setTimeout("element.focus()",250);
			//document.getElementById('payCounty').focus();
			//return false;			
		}else{
			document.getElementById('addToBatchButton').disabled=false;	
		}

	}	
	
	/*
	*	Function Name: 	validateFormNC( form )
	*	Author:			Lee Patsel	
	*	Creation Date:	08/25/05
	*	Purpose:		This function ensures that all required information is entered before submission					
	*	Triggers:		clicking the add to batch button
	*	Precondition:	none
	*	Parameters:		form - the form being submitted
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	/*
	function validateFormNC( form )
	{
		var instrumentCode = document.getElementById('instCode').value;
		
		if( document.getElementById('instCode').value == 'begin' )
		{
			alert( 'Please select a document type' );
			document.getElementById('instCode').focus();
			return false;
		}
		
		if( ! document.getElementById('docFile').value &&  document.getElementById('currentDocSelection').value == '' )
		{	
			alert( 'Please select a document file' );
			document.getElementById('docFile').focus();
			return false;
		}
		
		if(  document.getElementById('pages').value == 0)
		{
			alert( 'Please enter the number of pages' );
			document.getElementById('pages').focus();
			return false;
		}
		
		if( allInstrumentTypeInfo[instrumentCode]['ExciseTax'] == 'Y' )
		{
			if( document.getElementById('excise').value == 0 && document.getElementById('exemptCode').value == 0 )
			{
				alert( 'You must enter an Excise Amount OR select an Exempt Code' );
				document.getElementById('excise').focus();
				return false;
			}
		}
	}
	*/
	
	
	/*
	*	Function Name: 	deleteGrantorName( index )
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function removes the name from the hidden string grantorNames and 
	*					then calls removeRowFromTable to remove the name from display					
	*	Triggers:		clicking the red "X" next to the name being deleted
	*	Precondition:	must be in the edit mode
	*	Parameters:		index - row to be deleted
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function deleteGrantorName( index ) 
	{
		//alert(document.getElementById('tempGrantors').value);
		//alert(index); 
		//declare a new array to hold the names
		var names = new Array();
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantors').value.split('|');
		//take out the name we want to delete
		names.splice( index, 1, '-DEL-' ); // -DEL- is a spaceholder in the array to keep index order. it is parsed 
										   // before the DB insert/update.
		//put the string back together
		document.getElementById('tempGrantors').value = names.join('|');
		//increase the index by one, the array is zero based, the table is one based
		index = parseInt(index + 1);
		//call function to remove visual row
		removeRowFromTable( 'editGrantorsTable', index );	
		
		//alert(document.getElementById('tempGrantors').value);
		
		
		return;		
	}


	function editGrantorName(index)
	{

		//alert(document.getElementById('tempGrantors').value);
		//alert(index); 
		//declare a new array to hold the names
		var names = new Array();
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantors').value.split('|');
		
		var name = new Array();
		name = names[index].split(',');
		
		$('#grantor_names_editor').fadeIn('slow');
		$('#grantor_edit_lname').val(name[0]);
		$('#grantor_edit_fname').val($.trim(name[1]));
		$('#grantor_index').val(index);
		//alert(name[0]);
		return;		
	}


	function cancel_grantor_edit()
	{
		$('#grantor_names_editor').fadeOut('slow');
		return false;
	}

	function update_grantor_edit(){
		
		var ln 		= $('#grantor_edit_lname').val();
		var fn 		= $('#grantor_edit_fname').val();
		var index 	= $('#grantor_index').val();
		var names = new Array();
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantors').value.split('|');
		
		//alert(document.getElementById('tempGrantors').value);
		
		
		var name = new Array();
		names[index] = ln+', '+fn;
		
		var tmpgrant = new String();
		var x = names.length;
				
		for(i = 0; i < x;i++){
			if(names[i]!=null){
				tmpgrant = tmpgrant+names[i]+'|';
			}
		}
		
		document.getElementById('tempGrantors').value = tmpgrant;
		
		$('#grantors_names_'+index).html(ln+', '+fn);
		$('#grantor_names_editor').fadeOut('slow');
		return false;
	}










	function editGranteeName(index)
	{

		//alert(document.getElementById('tempGrantees').value);
		//alert(index); 
		//declare a new array to hold the names
		var names = new Array();
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantees').value.split('|');
		
		var name = new Array();
		name = names[index].split(',');
		
		$('#grantee_names_editor').fadeIn('slow');
		$('#grantee_edit_lname').val(name[0]);
		$('#grantee_edit_fname').val($.trim(name[1]));
		$('#grantee_index').val(index);
		//alert(name[0]);
		return;		
	}


	function cancel_grantee_edit()
	{
		$('#grantee_names_editor').fadeOut('slow');
		return false;
	}

	function update_grantee_edit(){
		
		var ln 		= $('#grantee_edit_lname').val();
		var fn 		= $('#grantee_edit_fname').val();
		var index 	= $('#grantee_index').val();
		var names = new Array();
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantees').value.split('|');
		
		var name = new Array();
		names[index] = ln+', '+fn;
		
		var tmpgrant = new String();
		var x = names.length;
		
		for(i = 0; i <= x;i++){
			if(names[i]!=null){
				tmpgrant = tmpgrant+names[i]+'|';
			}
		}
		
		document.getElementById('tempGrantees').value = tmpgrant;
		
		
		$('#grantees_names_'+index).html(ln+', '+fn);
		$('#grantee_names_editor').fadeOut('slow');
		return false;
	}









	/*
	*	Function Name: 	deleteGranteeName( index )
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function removes the name from the hidden string granteeNames and 
	*					then calls removeRowFromTable to remove the name from display					
	*	Triggers:		clicking the red "X" next to the name being deleted
	*	Precondition:	must be in the edit mode
	*	Parameters:		index - row to be deleted
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function deleteGranteeName( index )
	{
		//alert(index);
		//declare a new array to hold the names
		var names = new Array();   
		//split the string up into individual names and put in an array
		names = document.getElementById('tempGrantees').value.split('|');
		//take out the name we want to delete
		names.splice( index, 1, '-DEL-' );// -DEL- is a spaceholder in the array to keep index order. it is parsed 
										   // before the DB insert/update.
		//put the string back together
		document.getElementById('tempGrantees').value = names.join('|');
		//increase the index by one, the array is zero based, the table is one based
		index = parseInt(index + 1);
		//call function to remove visual row
		removeRowFromTable( 'editGranteesTable', index );
		return;		
	}
	
	/*
	*	Function Name: 	removeRowFromTable( tableID, index )
	*	Author:			Russell Bowman	
	*	Creation Date:	06/13/2006
	*	Purpose:		This function deletes a row(index) from tableID					
	*	Triggers:		called by deleteGranteeName or deleteGrantorName
	*	Precondition:	must be in the edit mode
	*	Parameters:		tableId - id of the table from which to delete
	*					index - zero based row to be deleted
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function removeRowFromTable( tableID, index )
	{
		//alert(index);
		var tbl = document.getElementById(tableID);		
		var row = tbl.insertRow(index);		// insert a row as a placeholder
		index = index + 1; // add one to the index because the row you want to delete moved up one place
		tbl.deleteRow( index ); // delete the row
		return;
	}
	/*
	*	Function Name: 	addRowToGranteeTable( tableID, name )
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function adds a row to the grantoee table. It also adds the name
	*					to the hidden input string granteeNames and displays the name with a 
	*					clickable "delete" link to delete that entry					
	*	Triggers:		called by granteeaddpopup
	*	Precondition:	must be in the edit mode
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function addRowToGranteeTable( tableID, name )
	{			
		var tbl = document.getElementById(tableID);
		var lastRow = tbl.rows.length;
		// if there's no header row in the table, then iteration = lastRow + 1
		var iteration = lastRow + 1;
		var row = tbl.insertRow(lastRow);
		//row always only has two rows, so hardcoding col1, col2, not an issue
		var col1 = row.insertCell(0);
		//create the anchor that will hold the image and set the attributes	 
		var imgAnchor = document.createElement('a');
		imgAnchor.onclick = function(){
										var names = new Array();
										//explode string on '|' making an array
										names = document.getElementById('granteeNames').value.split(',');
										names.splice( index, 1 );
										document.getElementById('granteeNames').value = names.join('|');
										removeRowFromTable( 'editGranteesTable', iteration );
										return;	
									  };
		imgAnchor.onmouseover = function(){return escape( 'Click here to delete' )};
		imgAnchor.setAttribute( 'href', 'javascript:void(0)' );
		//create the red "x" for deleting
		var imageNode = document.createElement('img');
		imageNode.setAttribute( 'border', 0 );
		imageNode.setAttribute( 'src', pathToImages+'delete.gif' );
		imageNode.setAttribute( 'width', 15 );
		imageNode.setAttribute( 'height', 15 );
		//attach the image to the anchor	  	  
		imgAnchor.appendChild(imageNode);
		//attach the anchor to the td
		col1.appendChild(imgAnchor);
		  
		// col 2
		var col2 = row.insertCell(1);
		var textNode = document.createTextNode(iteration);
		if( name )
		textNode.data = name;
		col2.appendChild(textNode);
		return;		
	}
	
	/*
	*	Function Name: 	addRowToGrantorTable( tableID, name )
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function adds a row to the grantor table. It also adds the name
	*					to the hidden input string grantorNames and displays the name with a 
	*					clickable "delete" link to delete that entry					
	*	Triggers:		called by grantoraddpopup
	*	Precondition:	must be in the edit mode
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function addRowToGrantorTable( tableID, name )
	{	
		var tbl = document.getElementById(tableID);
		var lastRow = tbl.rows.length;
		// if there's no header row in the table, then iteration = lastRow + 1
		var iteration = lastRow+1;
		var row = tbl.insertRow(lastRow);
		//row always only has two rows, so hardcoding col1, col2, not an issue
		var col1 = row.insertCell(0);
		//create the anchor that will hold the image and set the attributes	 
		var imgAnchor = document.createElement('a');
		imgAnchor.onclick = function(){
										var names = new Array();
										names = document.getElementById('grantorNames').value.split(',');
										names.splice( iteration, 1 );
										document.getElementById('grantorNames').value = names.join('|');
										removeRowFromTable( 'editGrantorsTable', iteration );
										return;	
									  };
		imgAnchor.onmouseover = function(){return escape( 'Click here to delete' )};
		imgAnchor.setAttribute( 'href', 'javascript:void(0)' );
		//create the red "x" for deleting
		var imageNode = document.createElement('img');
		imageNode.setAttribute( 'border', 0 );
		imageNode.setAttribute( 'src', pathToImages+'delete.gif' );
		imageNode.setAttribute( 'width', 15 );
		imageNode.setAttribute( 'height', 15 );
		//attach the image to the anchor	  	  
		imgAnchor.appendChild(imageNode);
		//attach the anchor to the td
		col1.appendChild(imgAnchor);
		  
		// col 2
		var col2 = row.insertCell(1);
		var textNode = document.createTextNode(iteration);
		if( name )
		textNode.data = name;
		col2.appendChild(textNode);
		return;		
	}
	
	/*
	*	Function Name: 	grantorAddPopUp()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function displays a pop up input window that allows users to enter
	*					a new grantor to add to the list for that document					
	*	Triggers:		Clicking the add grantor button in the edit mode
	*	Precondition:	must be in the edit mode
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	//function grantorAddPopUp()
	//{
	//	var grantorName=prompt("Please enter the Grantor's name ( Last, First )","Enter name here");
	//	var currentString = document.getElementById('grantorNames').value; 
	//	document.getElementById('grantorNames').value = currentString + grantorName + '|';		
	//	addRowToGrantorTable( 'editGrantorsTable', grantorName );
	//	return;		
	//}
	
	/*
	*	Function Name: 	granteeAddPopUp()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function displays a pop up input window that allows users to enter
	*					a new grantee to add to the list for that document					
	*	Triggers:		Clicking the add grantee button in the edit mode
	*	Precondition:	must be in the edit mode
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	//function granteeAddPopUp()
	//{
	//	var granteeName=prompt("Please enter the Grantee's name ( Last, First )","Enter name here"); 
	//	var currentString = document.getElementById('granteeNames').value;
	//	document.getElementById('granteeNames').value = currentString + granteeName + '|';
	//	addRowToGranteeTable( 'editGranteesTable', granteeName );
	//	return;		
	//}
	
	/*
	*	Function Name: 	turnOnCheckOut()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function turns on the checkout button
	*	Triggers:		Called when there are pending documents, or after clicking add to batch
	*	Precondition:	must be pending documents in the batch
	*	Parameters:		value (created by a tertiary statement)
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function turnOnCheckOut( value )
	{
		alert(value);
		checkOut.checkOutButton.disabled = value;
		return;
	}
	
	/*
	*	Function Name: 	turnOnAddToBatch()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function turns on the addtobatch button
	*	Triggers:		Called when user selects an instrument type, or when user selects document to edit
	*	Precondition:	instrument type must be selected
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function turnOnAddToBatch()
	{
		if(document.getElementById('payCounty').value == 'null'){
			document.getElementById('addToBatchButton').disabled = true;
			
		return;
		}
		
		if( document.getElementById('addToBatchButton'))
			document.getElementById('addToBatchButton').disabled = false;
		return;
	}
	
	/*
	*	Function Name: 	turnOnForm()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function enables or disables boxes depending on the instrument type selected
	*	Triggers:		called when user selects instrument type, when user selects document for editing, and
	*					on load of the form
	*	Precondition:	none
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function turnOnForm( process )
	{					
		//alert( process );	
				
		var instrumentCode = document.getElementById('instCode').value;
		//alert('instCode: '+instrumentCode);
		//if the instrumentCode doesn't exist yet, we don't need to do anything
			
		if( instrumentCode == 0 )
			return;
		else
		{
			var transMortCode = allInstrumentTypeInfo[instrumentCode]['TransMortcode'];
			//alert('transMortCode: '+transMortCode);		
			switch( transMortCode )
			{
				case 'B':
					document.getElementById('mortTax').disabled = false;
					document.getElementById('mortTax').style.backgroundColor = '#FFFFFF';
					document.getElementById('mortgage').disabled = false;
					document.getElementById('mortgage').style.backgroundColor = '#FFFFFF';					
					document.getElementById('conveyance').disabled = false;
					document.getElementById('conveyance').style.backgroundColor = '#FFFFFF';					
					document.getElementById('tranTax').disabled = false;
					document.getElementById('tranTax').style.backgroundColor = '#FFFFFF';					
					break;
				case 'M':
					document.getElementById('mortTax').disabled = false;
					document.getElementById('mortTax').style.backgroundColor = '#FFFFFF';
					document.getElementById('mortgage').disabled = false;
					document.getElementById('mortgage').style.backgroundColor = '#FFFFFF';
					document.getElementById('conveyance').disabled = true;
					document.getElementById('conveyance').style.backgroundColor = '#C0D1F8';
					document.getElementById('tranTax').disabled = true;
					document.getElementById('tranTax').style.backgroundColor = '#C0D1F8';
					break;
				case 'T':
					document.getElementById('conveyance').disabled = false;
					document.getElementById('conveyance').style.backgroundColor = '#FFFFFF';
					document.getElementById('tranTax').disabled = false;
					document.getElementById('tranTax').style.backgroundColor = '#FFFFFF';
					document.getElementById('mortTax').disabled = true;
					document.getElementById('mortTax').style.backgroundColor = '#C0D1F8';
					document.getElementById('mortgage').disabled = true;
					document.getElementById('mortgage').style.backgroundColor = '#C0D1F8';
					break;
				case 'N':
					document.getElementById('mortTax').disabled = true;
					document.getElementById('mortTax').style.backgroundColor = '#C0D1F8';					
					document.getElementById('mortgage').disabled = true;
					document.getElementById('mortgage').style.backgroundColor = '#C0D1F8';					
					document.getElementById('conveyance').disabled = true;
					document.getElementById('conveyance').style.backgroundColor = '#C0D1F8';					
					document.getElementById('tranTax').disabled = true;
					document.getElementById('tranTax').style.backgroundColor = '#C0D1F8';					
					break;
			}//end switch on transMortCode
			
			//set all boxes to 0, when this function is triggered, it is because a 
			//selection was made to document type, which means that all info
			//will need to be entered to calculate fees, no previous info is valid
			//If in the edit mode, don't do this or you won't get the values associated
			//with that instrument
			if( process != 'edit' )
			{
				document.getElementById('tranTax').value = formatNumber( '0', 2 );
				document.getElementById('mortgage').value = 0;
				document.getElementById('mortTax').value = formatNumber( '0', 2 );
				document.getElementById('conveyance').value = 0;
				//document.getElementById('pages').value = 0;	
				document.getElementById('addInst').value = 0;
				document.getElementById('recFees').value = formatNumber( '0', 2 );
				document.getElementById('regFees').value = formatNumber( '0', 2 );
				document.getElementById('feeTotal').value = formatNumber( '0', 2 );
				document.getElementById('dpFees').value = formatNumber( '0', 2 );
				document.getElementById('penalty').value = 0;
				document.getElementById('penaltyFee').value = formatNumber( '0', 2 );
			}					
				document.getElementById('pages').disabled = false;
				document.getElementById('pages').style.backgroundColor = '#FFFFFF';
				document.getElementById('addInst').disabled = false;
				document.getElementById('addInst').style.backgroundColor = '#FFFFFF';
				document.getElementById('taxExempt').disabled = false;
				document.getElementById('recFees').style.backgroundColor = '#FFFFFF';
				document.getElementById('regFees').style.backgroundColor = '#FFFFFF';
				document.getElementById('feeTotal').style.backgroundColor = '#FFFFFF';
				document.getElementById('dpFees').style.backgroundColor = '#FFFFFF';
				
			
			if(document.getElementById('grantorLastName'))
			{
				document.getElementById('grantorLastName').disabled = false;
				document.getElementById('grantorLastName').style.backgroundColor = '#FFFFFF';
			}//end if there is a grantorLastName
			if(document.getElementById('grantorFirstName'))
			{
				document.getElementById('grantorFirstName').disabled = false;
				document.getElementById('grantorFirstName').style.backgroundColor = '#FFFFFF';
			}//end if there is a grantorFirstName
			if(document.getElementById('granteeLastName'))
			{
				document.getElementById('granteeLastName').disabled = false;
				document.getElementById('granteeLastName').style.backgroundColor = '#FFFFFF';
			}//end if there is a granteeLastName
			if(document.getElementById('granteeFirstName'))
			{
				document.getElementById('granteeFirstName').disabled = false;
				document.getElementById('granteeFirstName').style.backgroundColor = '#FFFFFF';
			}//end if there is a granteeFirstName
			if(document.getElementById('addGrantorButton'))
			{
				document.getElementById('addGrantorButton').disabled = false;
				document.getElementById('addGranteeButton').disabled = false;
			}//end if there is an addGrantorButton
			if( document.getElementById('bankCode') )
				document.getElementById('bankCode').disabled = false;
			
			
			if( instrumentCode == 'MOD' )
			{
				document.getElementById('penalty').disabled = false;
				document.getElementById('penaltyFee').disabled = false;
				document.getElementById('penalty').style.backgroundColor = '#FFFFFF';
				document.getElementById('penaltyFee').style.backgroundColor = '#FFFFFF';
				
			}// end if modification
			else
			{
				document.getElementById('penalty').disabled = true;
				document.getElementById('penaltyFee').disabled = true;				
				document.getElementById('penalty').style.backgroundColor = '#C0D1F8';
				document.getElementById('penaltyFee').style.backgroundColor = '#C0D1F8';
			}// end else not a modification
		}// end if instrument code
		return;		
	}	
	
	/*
	*	Function Name: 	turnOnFormSC()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function enables or disables boxes depending on the instrument type selected
	*	Triggers:		called when user selects instrument type, when user selects document for editing, and
	*					on load of the form. Specific to South Carolina
	*	Precondition:	none
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function turnOnFormSC( process )
	{	
		var instrumentCode = document.getElementById('instCode').value;
		//alert('instCode: '+instrumentCode);
		//if the instrumentCode doesn't exist yet, we don't need to do anything
		if( instrumentCode == 0 )
			return;
		else
		{
			if( allInstrumentTypeInfo[instrumentCode]['ApplyConsideration'] == 'Y' )
			{
				document.getElementById('consideration').disabled = false;
				document.getElementById('consideration').style.backgroundColor = '#FFFFFF';
				document.getElementById('countyTax').style.backgroundColor = '#FFFFFF';
				document.getElementById('stateTax').style.backgroundColor = '#FFFFFF';
			}
			else
			{
				document.getElementById('consideration').disabled = true;
				document.getElementById('consideration').style.backgroundColor = '#CCCCCC';
				document.getElementById('consideration').value =  formatNumber( '0', 2 );
				document.getElementById('countyTax').style.backgroundColor = '#CCCCCC';
				document.getElementById('stateTax').style.backgroundColor = '#CCCCCC';
			}
		}
		//set all boxes to 0, when this function is triggered, it is because a 
		//selection was made to document type, which means that all info
		//will need to be entered to calculate fees, no previous info is valid
		//If in the edit mode, don't do this or you won't get the values associated
		//with that instrument
		if( process != 'edit' )
		{
			document.getElementById('stateTax').value = formatNumber( '0', 2 );
			document.getElementById('countyTax').value = formatNumber( '0', 2 );
			if( allInstrumentTypeInfo[instrumentCode]['ApplyConsideration'] == 'Y' )
				document.getElementById('consideration').value = 0;
			document.getElementById('pages').value = 0;	
			document.getElementById('recFees').value = formatNumber( '0', 2 );
			document.getElementById('feeTotal').value = formatNumber( '0', 2 );
		}
			
		document.getElementById('pages').disabled = false;
		document.getElementById('pages').style.backgroundColor = '#FFFFFF';
		document.getElementById('taxExempt').disabled = false;
		document.getElementById('recFees').style.backgroundColor = '#FFFFFF';
		document.getElementById('feeTotal').style.backgroundColor = '#FFFFFF';		
		
		if(document.getElementById('grantorLastName'))
		{
			document.getElementById('grantorLastName').disabled = false;
			document.getElementById('grantorLastName').style.backgroundColor = '#FFFFFF';
		}//end if there is a grantorLastName
		if(document.getElementById('grantorFirstName'))
		{
			document.getElementById('grantorFirstName').disabled = false;
			document.getElementById('grantorFirstName').style.backgroundColor = '#FFFFFF';
		}//end if there is a grantorFirstName
		if(document.getElementById('granteeLastName'))
		{
			document.getElementById('granteeLastName').disabled = false;
			document.getElementById('granteeLastName').style.backgroundColor = '#FFFFFF';
		}//end if there is a granteeLastName
		if(document.getElementById('granteeFirstName'))
		{
			document.getElementById('granteeFirstName').disabled = false;
			document.getElementById('granteeFirstName').style.backgroundColor = '#FFFFFF';
		}//end if there is a granteeFirstName
		if(document.getElementById('addGrantorButton'))
		{
			document.getElementById('addGrantorButton').disabled = false;
			document.getElementById('addGranteeButton').disabled = false;
		}//end if there is an addGrantorButton
		
		if( document.getElementById('bankCode') )
			document.getElementById('bankCode').disabled = false;
		
		return;		
	}// end function
	
	
	/*
	*	Function Name: 	turnOnFormNC()
	*	Author:			Lee Patsel	
	*	Creation Date:	08/17/05
	*	Purpose:		This function enables or disables boxes depending on the instrument type selected
	*	Triggers:		called when user selects instrument type, when user selects document for editing, and
	*					on load of the form. Specific to North Carolina
	*	Precondition:	none
	*	Parameters:		none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function turnOnFormNC( process )
	{			
		resetFormNC();
		
		var instrumentCode = document.getElementById('instCode').value;
		
		if( instrumentCode == 0 )
		{
			return;
		}
		else
		{   
			if( allInstrumentTypeInfo[instrumentCode]['ExciseTax'] == 'Y' )
			{
				document.getElementById('excise').disabled = false;
				document.getElementById('excise').style.backgroundColor = '#FFFFFF';
				document.getElementById('exemptCode').style.backgroundColor = '#FFFFFF';
				document.getElementById('exemptCode').disabled = false;
			}
			else
			{
				document.getElementById('excise').disabled = true;
				document.getElementById('excise').style.backgroundColor = '#CCCCCC';
				document.getElementById('exemptCode').style.backgroundColor = '#CCCCCC';
				document.getElementById('exemptCode').disabled = true;
			}			
		}
		
		//set all boxes to 0, when this function is triggered, it is because a 
		//selection was made to document type, which means that all info
		//will need to be entered to calculate fees, no previous info is valid
		//If in the edit mode, don't do this or you won't get the values associated
		//with that instrument
		if( process != 'edit' )
		{			
			document.getElementById('realProperty').value = formatNumber( '0', 2 );
			document.getElementById('exciseStamp').value = formatNumber( '0', 2 );			
			document.getElementById('pages').value = 0;
			document.getElementById('recFees').value = formatNumber( '0', 2 );
			document.getElementById('feeTotal').value = formatNumber( '0', 2 );
		}
		
		document.getElementById('realProperty').style.backgroundColor = '#FFFFFF';	
		document.getElementById('pages').disabled = false;
		document.getElementById('pages').style.backgroundColor = '#FFFFFF';
		document.getElementById('NonStandard').disabled = false;
		document.getElementById('MultipleDocs').disabled = false;
		document.getElementById('Rerecord').disabled = false;
		document.getElementById('recFees').style.backgroundColor = '#FFFFFF';
		document.getElementById('feeTotal').style.backgroundColor = '#FFFFFF';		
		
		
		
		if(document.getElementById('grantorLastName'))
		{
			document.getElementById('grantorLastName').disabled = false;
			document.getElementById('grantorLastName').style.backgroundColor = '#FFFFFF';
		}//end if there is a grantorLastName
		if(document.getElementById('grantorFirstName'))
		{
			document.getElementById('grantorFirstName').disabled = false;
			document.getElementById('grantorFirstName').style.backgroundColor = '#FFFFFF';
		}//end if there is a grantorFirstName
		if(document.getElementById('granteeLastName'))
		{
			document.getElementById('granteeLastName').disabled = false;
			document.getElementById('granteeLastName').style.backgroundColor = '#FFFFFF';
		}//end if there is a granteeLastName
		if(document.getElementById('granteeFirstName'))
		{
			document.getElementById('granteeFirstName').disabled = false;
			document.getElementById('granteeFirstName').style.backgroundColor = '#FFFFFF';
		}//end if there is a granteeFirstName
		if(document.getElementById('addGrantorButton'))
		{
			document.getElementById('addGrantorButton').disabled = false;
			document.getElementById('addGranteeButton').disabled = false;
		}//end if there is an addGrantorButton
		
		if( document.getElementById('payCounty') )
			document.getElementById('payCounty').disabled = false;
		
		return;		
	}// end function
	
	
	/*
	*	Function Name: 	formatNumber()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function formats a number to an indicated number of decimal
	*					places
	*	Triggers:		Called throughout
	*	Precondition:	none
	*	Parameters:		expr (the number to format), decplaces (number of decimal places)
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function formatNumber( expr, decplaces )
     {
		  // raise incoming value by power of 10 times the
		  // number of decimal places; round to an integer; convert to string
		  var str = "" + Math.round( eval( expr ) * Math.pow( 10, decplaces ))
	
		  // pad small value strings with zeros to the left of rounded number
		  while ( str.length <= decplaces )
				str = "0" + str
	
		  // establish location of decimal point
		  var decpoint = str.length - decplaces
	
		  // assemble final result from: (a) the string up to the position of
		  // the decimal point; (b) the decimal point; and (c) the balance
		  // of the string. Return finished product.
	  
		  return str.substring( 0, decpoint ) + "." + str.substring( decpoint, str.length );
     } // end of formatNumber
	 
	/*
	*	Function Name: 	calculateFees()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function calculates all the associated fees for the particular
	*					instrument type selected. 
	*	Triggers:		OnChange of the taxExempt, mortgage, conveyance, pages and
	*					addInst fields
	*	Precondition:	InstCode field must have been selected, this is needed to have the
	*					required information to perform calculations
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function calculateFees( transMortCode )
	{
		//we will be keeping a running total with this variable			
		var instrumentCode = document.getElementById('instCode').value;
		var MinimumFee = parseFloat(allInstrumentTypeInfo[instrumentCode]['MinimumFee']);
		var total = 0;//MinimumFee; 
		var numPagesToBePaidFor = parseInt(document.getElementById('pages').value) - parseInt(allInstrumentTypeInfo[instrumentCode]['PgforMinFee']);
		if( allInstrumentTypeInfo[instrumentCode]['ChargeForCertPg']=='N' )
		{
			numPagesToBePaidFor--;
		}
		var FeeperPgaftermin = parseFloat( allInstrumentTypeInfo[instrumentCode]['FeeperPgaftermin'] );
		var DataProcessFee = parseFloat( allInstrumentTypeInfo[instrumentCode]['DataProcessFee'] );
		var RegFee = parseFloat( allInstrumentTypeInfo[instrumentCode]['RegFee'] );
		var AddFunctionFee = parseFloat( allInstrumentTypeInfo[instrumentCode]['AddFunctionFee'] );
		var AddDPFee = parseFloat( allInstrumentTypeInfo[instrumentCode]['AddDPFee'] );
		var transMortCode = allInstrumentTypeInfo[instrumentCode]['TransMortcode'];
		//alert('transCode: '+transMortCode);
		//alert('instCode: '+instrumentCode);
		switch( transMortCode ) 
		{
			case 'B':
				calculateMortgageTax( instrumentCode);
				calculateConveyanceTax();
				break;
			case 'M':
				document.getElementById('tranTax').value = formatNumber('0', 2);
				document.getElementById('conveyance').value = 0;
				calculateMortgageTax( instrumentCode );				
				break;
			case 'T':
				document.getElementById('mortTax').value = formatNumber('0', 2);
				document.getElementById('mortgage').value = 0;
				calculateConveyanceTax();				
				break;
			case 'N':
				document.getElementById('tranTax').value = formatNumber('0', 2);
				document.getElementById('conveyance').value = 0;
				document.getElementById('mortTax').value = formatNumber('0', 2);
				document.getElementById('mortgage').value = 0;
		}		
		
		getPenalty( instrumentCode );
						
		// recording fee
		var x = parseInt(numPagesToBePaidFor);
		if( x < 0 )
			x = 0;
		item1 = parseFloat( MinimumFee );
		item2 = parseInt( x );
		item3 = parseFloat( FeeperPgaftermin );
		
		document.getElementById('recFees').value =  item1 +  
										( item2 * item3);
		
		if( allInstrumentTypeInfo[instrumentCode]['IndexType'].toUpperCase() == 'LR' )
		{
			if( document.getElementById('addInst').value > 0 )
				document.getElementById('recFees').value = parseFloat( document.getElementById('recFees').value ) + 
							parseFloat( document.getElementById('addInst').value ) * parseFloat( AddFunctionFee );
		}
		
		document.getElementById('recFees').value = formatNumber( document.getElementById('recFees').value, 2 );
		document.getElementById('dpFees').value = formatNumber( DataProcessFee, 2 );
				
		//add reg fee if needed
		if( document.getElementById('mortTax').value > 0 || document.getElementById('tranTax').value > 0 )
		{
			document.getElementById('regFees').value = parseFloat( RegFee );
			document.getElementById('regFees').value = formatNumber( document.getElementById('regFees').value, 2 );
		}else{
			document.getElementById('regFees').value = '0.00';
		}
		
	
		//get totals of all fees
		document.getElementById('feeTotal').value = formatNumber( getTotal(transMortCode), 2 );	
	}//end calculate function
	
	/*
	*
	*	Function Name: 	calculateFeesSC()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function calculates all the associated fees for the particular
	*					instrument type selected. Specific to South Carolina
	*	Triggers:		OnChange of the taxExempt, mortgage, conveyance, pages and
	*					addInst fields
	*	Precondition:	InstCode field must have been selected, this is needed to have the
	*					required information to perform calculations
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function calculateFeesSC()
	{
		var piece = 500;
		var taxableAmount;
		//we will be keeping a running total with this variable
		var instrumentCode = document.getElementById('instCode').value;
		var MinimumFee = parseFloat(allInstrumentTypeInfo[instrumentCode]['MinimumFee']);
		var total = 0;
		//alert( 'pages: '+ document.getElementById('pages').value);
		//alert( 'PgforMinFee: '+allInstrumentTypeInfo[instrumentCode]['PgforMinFee']);
		var numPagesToBePaidFor = parseInt(document.getElementById('pages').value) - parseInt(allInstrumentTypeInfo[instrumentCode]['PgforMinFee']);
		var FeeperPgaftermin = parseFloat( allInstrumentTypeInfo[instrumentCode]['FeeperPgaftermin'] );
	
	if( document.getElementById('taxExempt').checked )
	{
		document.getElementById( 'consideration' ).value = 0.00;
		//document.getElementById( 'consideration' ).disabled = true;
		//document.getElementById( 'consideration' ).style.backgroundColor = '#CCCCCC';
		document.getElementById( 'stateTax' ).value = 0.00;
		document.getElementById( 'countyTax' ).value = 0.00;
	}
	else
	{		
		// Do we need to calculate taxes?
		if( document.getElementById('consideration').value > 0)	
		{
			//calculate taxes
			//First find out how many whole "500" pieces there are
			//if we don't even have a whole piece, then no taxes
			if( document.getElementById('consideration' ).value < piece )
				wholePieces = 0;
			else
			{
				var wholePieces = parseInt( document.getElementById('consideration' ).value  / piece );
				//Now, find out if there are any left over pieces
				var remainder = parseInt( document.getElementById('consideration' ).value ) % parseInt( piece );			
				//if there are whole pieces, we need to increase (round up) the whole pieces
				if( remainder > 0 )
					wholePieces = parseInt(wholePieces) + 1;
			}
			document.getElementById('stateTax').value = parseFloat(wholePieces * piece * countyDocumentFees['stateTaxRate']);
			document.getElementById('countyTax').value = parseFloat(wholePieces * piece * countyDocumentFees['countyTaxRate']);
		}
		else
		{
			document.getElementById('stateTax').value = formatNumber( '0', 2 );
			document.getElementById('countyTax').value = formatNumber( '0', 2 );
		}
	}
		// recording fee
		var x = parseInt(numPagesToBePaidFor);
		if( x < 0 )
			x = 0;
		item1 = parseFloat( MinimumFee );
		item2 = parseInt( x );
		item3 = parseFloat( FeeperPgaftermin );
		document.getElementById('recFees').value =  item1 + ( item2 * item3 );
		
		document.getElementById('recFees').value = formatNumber( document.getElementById('recFees').value, 2 );
		document.getElementById('stateTax').value = formatNumber( document.getElementById('stateTax').value, 2 );
		document.getElementById('countyTax').value = formatNumber( document.getElementById('countyTax').value, 2 );
					
		//get totals of all fees
		document.getElementById('feeTotal').value = formatNumber( getTotalSC(), 2 );	
	}//end calculate function
	
	/*
	*	Function Name: 	resetFormNC()
	*	Author:			Lee Patsel	
	*	Creation Date:	08/19/05
	*	Purpose:		This function resets the fee values and text on the form. Specific to North Carolina
	*	Triggers:		OnChange of the document type, or turnOnFormNC()
	*	Precondition:	none
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function resetFormNC()
	{
		document.getElementById('realProperty').value = 0.00;
		document.getElementById('realProperty').innerText = document.getElementById('realProperty').value;
				
		document.getElementById('recFees').value = 0.00;
		document.getElementById('recFees').innerText = document.getElementById('recFees').value;
			
		document.getElementById('nonstandardDocFee').value = 0.00;
		document.getElementById('nonstandardDocFee').innerText = document.getElementById('nonstandardDocFee').value;
				
		document.getElementById('multipleDocFee').value = 0.00;
		document.getElementById('multipleDocFee').innerText = document.getElementById('multipleDocFee').value;
			
		document.getElementById('rerecordingFee').value = 0.00;
		document.getElementById('rerecordingFee').innerText = document.getElementById('rerecordingFee').value;
				
		document.getElementById('excise').value = 0.00;
		document.getElementById('exciseStamp').value = 0.00;
		document.getElementById('feeTotal').value = 0.00;			
	}
	
	/*
	*
	*	Function Name: 	calculateFeesNC()
	*	Author:			Lee Patsel	
	*	Creation Date:	08/18/05
	*	Purpose:		This function calculates all the associated fees for the particular
	*					instrument type selected. Specific to North Carolina
	*	Triggers:		OnChange of the Nonstandard Doc, Re-recording, Multiple Documents, Excise Tax, 
	*					Exempt Codes, or Number of Pages fields
	*	Precondition:	InstCode field must have been selected, this is needed to have the
	*					required information to perform calculations
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function calculateFeesNC()
	{
		//Need to set some variables to zero that haven't yet been set, this avoids the dreaded NaN
		//resetFormNC();
		//we will be keeping a running total with this variable
		var total = 0;
		var instrumentCode = document.getElementById('instCode').value;
		var exemptCode = document.getElementById('exemptCode').value;
		var MinimumFee = parseFloat(allInstrumentTypeInfo[instrumentCode]['MinimumFee']);
	
	
			alert(allInstrumentTypeInfo[instrumentCode]['MinimumFee']);

	
		var numPagesToBePaidFor = parseInt(document.getElementById('pages').value) - parseInt(allInstrumentTypeInfo[instrumentCode]['PgforMinFee']);
		var FeeperPgaftermin = parseFloat( allInstrumentTypeInfo[instrumentCode]['FeeperPgaftermin'] );
		
		if( allInstrumentTypeInfo[instrumentCode]['ExciseTax'] == 'Y' )
		{
			if( document.getElementById('excise').value > 0 )
				document.getElementById( 'exciseStamp' ).value = document.getElementById('excise').value;
			else
				document.getElementById( 'exciseStamp' ).value = 0.00;
		}
				
		if( document.getElementById( 'NonStandard' ).checked )
		{
			document.getElementById( 'nonstandardDocFee' ).value = 25.00;
			document.getElementById( 'nonstandardDocFee' ).innerText = '25.00';
		}
		else
		{
			document.getElementById( 'nonstandardDocFee' ).value = 0.00;
			document.getElementById( 'nonstandardDocFee' ).innerText = '0.00';
		}
			
		if( document.getElementById( 'Rerecord' ).checked )
		{
			document.getElementById( 'rerecordingFee' ).value = -2.00;
			document.getElementById( 'rerecordingFee' ).innerText = '-2.00'; 
		}
		else
		{
			document.getElementById( 'rerecordingFee' ).value = 0.00;
			document.getElementById( 'rerecordingFee' ).innerText = '0.00';
		}
		
		if( document.getElementById( 'MultipleDocs' ).checked )
		{
			document.getElementById( 'multipleDocFee' ).value = 10.00;
			document.getElementById( 'multipleDocFee' ).innerText = '10.00';
		}
		else
		{
			document.getElementById( 'multipleDocFee' ).value = 0.00;
			document.getElementById( 'multipleDocFee' ).innerText = '0.00';
		}
			
		// recording fee
		var x = parseInt(numPagesToBePaidFor);
		if( x < 0 )
			x = 0;
		item1 = parseFloat( MinimumFee );
		item2 = parseInt( x );
		item3 = parseFloat( FeeperPgaftermin );
		document.getElementById( 'recFees' ).value =  item1 + ( item2 * item3 );
		document.getElementById( 'recFees' ).value = formatNumber( document.getElementById( 'recFees' ).value, 2 );
		document.getElementById( 'recFees' ).innerText = document.getElementById( 'recFees' ).value;
		document.getElementById( 'realProperty' ).value = parseFloat( document.getElementById( 'recFees' ).value ) +
														  parseFloat( document.getElementById( 'nonstandardDocFee' ).value ) +
														  parseFloat( document.getElementById( 'rerecordingFee' ).value ) +
														  parseFloat( document.getElementById( 'multipleDocFee' ).value );
		document.getElementById( 'realProperty' ).value = formatNumber( document.getElementById( 'realProperty' ).value, 2 );
						
		//get totals of all fees
		document.getElementById( 'feeTotal' ).value = parseFloat( document.getElementById( 'realProperty' ).value ) +
													  parseFloat( document.getElementById( 'exciseStamp' ).value );
		document.getElementById( 'feeTotal' ).value = formatNumber( document.getElementById( 'feeTotal' ).value, 2 );
	}//end calculate function
	
	
	
	function roundtax(amt)
	{
		var cid = parseInt(document.getElementById('cid').value);
		if(cid==2501) // used to round for washington county per BUG #1594
		{
			var result=Math.round(amt*100)/10000;
			var final=Math.round(result)*100;
		}
		else
		{
			var final = gaussianRound(amt);
		}
			
		return final;
	}	
	
	/************************************************************************
 	Gaussian rounding (aka Banker's rounding) is a method of statistically
 	unbiased rounding. It ensures against bias when rounding at x.5 by
 	rounding x.5 towards the nearest even number. Regular rounding has a
 	built-in upwards bias.
	************************************************************************/
	function gaussianRound(x) {
		x = x* 100
		var absolute = Math.abs(x);
		var sign     = x == 0 ? 0 : (x < 0 ? -1 : 1);
		var floored  = Math.floor(absolute);
		if (absolute - floored != 0.5) {
			return (Math.round(absolute) * sign) *.01;
		}
		if (floored % 2 == 1) {
			// Closest even is up.
			return (Math.ceil(absolute) * sign) *.01;
		}
		// Closest even is down.
		return (floored * sign) *.01;
	}

	/*
	*	Function Name: 	calculateMortgageTax()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will calculate the mortgage tax for a particular 
	*					instrument type
	*	Precondition:	Same as calculateFees function
	*	Parameters:		none
	*	Return Value:	none
	*	Triggers:		Called by the calculateFees function
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	
	function calculateMortgageTax( instrumentCode )
	{
		
		var thousand = 1000.00;		
		//alert ( allInstrumentTypeInfo[instrumentCode]['NonExemptcode'] );
		//	Calculate the mortgage tax first, don't forget to subtract the exemption if necessary
		if( !document.getElementById('taxExempt').checked && allInstrumentTypeInfo[instrumentCode]['NonExemptcode'] == 'Y' )
		{
			if( parseFloat( document.getElementById('mortgage').value ) > parseFloat( countyDocumentFees['taxExemptAmt'] ))
			{
				//alert('mortgage: '+document.getElementById('mortgage').value);
			    //alert('rate: '+countyDocumentFees['mortTaxRate']);
				var mortgage = parseFloat( document.getElementById('mortgage').value );
				var exemptAmount = parseFloat( countyDocumentFees['taxExemptAmt'] );
				var taxRateMultiplier = parseFloat(countyDocumentFees['mortTaxRate']) / parseFloat(thousand);
				document.getElementById('mortTax').value = parseFloat((  mortgage - exemptAmount ) * taxRateMultiplier );
			}
			else
				document.getElementById('mortTax').value = 0;
				
		}
		else if( !document.getElementById('taxExempt').checked )
		{
			//alert('mortgage: '+document.getElementById('mortgage').value);
			//alert('rate: '+countyDocumentFees['mortTaxRate']);
			hello1 = parseFloat(document.getElementById('mortgage').value);
			hello2 = countyDocumentFees['mortTaxRate'];	
			hello3 = parseFloat(hello1) * parseFloat(hello2);
			hello4 = hello3 / parseFloat(thousand); 
			document.getElementById('mortTax').value = parseFloat(hello4);						
		}
		else		
			document.getElementById('mortTax').value = 0;
		
		
		//BUG 7113 - This existing method was way wrong.....
		//var res = roundtax(document.getElementById('mortTax').value) // BUG #1594
		//document.getElementById('mortTax').value = formatNumber( res, 2 ); // BUG #1594
		
		var res = Math.round(parseFloat(document.getElementById('mortTax').value)*100)/100;
		document.getElementById('mortTax').value = formatNumber( res, 2 );
		
		
		//document.getElementById('mortTax').value = formatNumber( document.getElementById('mortTax').value, 2 ); // commented out for BUG #1594
	}
	
	/*
	*	Function Name: 	calculateConveyanceTax()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will calculate the conveyance tax for a particular 
	*					instrument type
	*	Precondition:	Same as calculateFees function
	*	Parameters:		none
	*	Return Value:	none
	*	Triggers:		Called by the calculateFees function
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function calculateConveyanceTax( )
	{
		val1 = parseFloat( document.getElementById('conveyance').value );
		val2 = parseFloat( countyDocumentFees['transTaxRate'] );
		

		
		val3 = 1000;
		var tax = 0.00;

		if( !document.getElementById('taxExempt').checked )
		{
			if( parseFloat(document.getElementById('conveyance').value) > 50 )
				tax = parseFloat(( val1 * val2 ) / val3 );	
		}
		
		
		//BUG 7113 - This existing method was way wrong.....
		var res = Math.round(tax*100)/100;   /* roundtax(tax) // BUG #1594 */
		document.getElementById('tranTax').value = formatNumber( res, 2 ); // BUG #1594
		
		//document.getElementById('tranTax').value = formatNumber( tax, 2 ); // commented our for BUG #1594
	}
	
	/*
	*	Function Name: 	getTotal()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will gets the total of all fees for the particular
	*					instrument
	*	Precondition:	Same as calculateFees function
	*	Parameters:		transMortCode, determines the calculations necessary
	*	Return Value:	total, the total of all fees
	*	Triggers:		Called by the calculateFees function
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function getTotal(transMortCode)
	{
		var total = 0.00;
		switch(transMortCode)
		{
			case 'B':
				total = parseFloat(document.getElementById('mortTax').value) + parseFloat(total);
				total = parseFloat(document.getElementById('tranTax').value) + parseFloat(total);
				break;
			case 'M':
				total = parseFloat(document.getElementById('mortTax').value)+ parseFloat(total);
				break;
			case 'T':
				total = parseFloat(document.getElementById('tranTax').value) + parseFloat(total);
				break;
			case 'N':
		}
		total = parseFloat( document.getElementById('regFees').value ) + parseFloat( total );
		total = parseFloat( document.getElementById('recFees').value ) + parseFloat( total );
		total = parseFloat( document.getElementById('dpFees').value ) + parseFloat( total );
		
		if( document.getElementById('penalty').value > 0 )
			total = parseFloat( document.getElementById('penaltyFee').value ) + parseFloat( total );
			
		return total;	
	}
	
	/*
	*	Function Name: 	getTotalSC()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will gets the total of all fees for the particular
	*					instrument, specific to South Carolina
	*	Precondition:	Same as calculateFees function
	*	Parameters:		transMortCode, determines the calculations necessary
	*	Return Value:	total, the total of all fees
	*	Triggers:		Called by the calculateFees function
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function getTotalSC()
	{
		var total = 0.00;
		total = parseFloat( document.getElementById('stateTax').value ) + parseFloat(total);
		total = parseFloat( document.getElementById('countyTax').value ) + parseFloat(total);
		total = parseFloat( document.getElementById('recFees').value ) + parseFloat( total );
				
		return total;	
	}
	
	/*
	*	Function Name:  getPenalty()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will calculate the penalty for a particular 
	*					instrument type
	*	Precondition:	Same as calculateFees function
	*	Parameters:		none
	*	Return Value:	none
	*	Triggers:		Called by the calculateFees function
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/
	function getPenalty( instrumentCode)
	{
		if( instrumentCode == 'MOD' )
		{
			// penalty
			if( document.getElementById('penalty').value )
				document.getElementById('penaltyFee').value = parseFloat( document.getElementById('penalty').value );
			else
				document.getElementById('penaltyFee').value = 0.00;
		
			document.getElementById('penaltyFee').value = formatNumber( document.getElementById('penaltyFee').value, 2 );
		}		
	}
	
/*
	*	Function Name: 	addGranteeNameToDisplay()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will display the grantee names added to a particular
	*					instrument
	*	Precondition:	Same as calculateFees function
	*	Parameters:		none
	*	Return Value:	none
	*	Triggers:		Clicking the Add Grantee Button
	*	Last Modified:	05/2006
	*	Modified By:	Russell Bowman
	*	Modification:	The edit button was only storing the last grantor grantee so reworked the whole function
	*/
	var granteeString = '';
	function addGranteeNameToDisplay(form,edit)
	{				
			
		var oCell;
		var oRow;
		if(edit==true){
			var tbl = document.getElementById( 'editGranteesTable' );
			var firstName = 'egranteeFirstName';
			var lastName = 'egranteeLastName';		
			granteeString = document.getElementById('tempGrantees').value;
		}else{
			var tbl = document.getElementById( 'granteeNameDisplayTable' );
			var firstName = 'granteeFirstName';
			var lastName = 'granteeLastName';	
		}		
		var lastRow = tbl.rows.length;
		var iteration = lastRow-1;			
		validate = validateForm(form,lastName);
		if (validate == false){return;} 
		//alert(form.value);
		//Update the 'hidden' value grantorNames so that when the user
		//checks out we will have it
		var name = document.getElementById(lastName).value;
		if (name != "" || document.getElementById(firstName).value != '')
		{
		//if there is a first name, add it with a comma
		if( document.getElementById(firstName).value != '' )
			name = name + ', ' + document.getElementById(firstName).value;
		
		//add name to hidden value on form
		if (granteeString == '')		
		granteeString = name;
		else
		granteeString = granteeString + '|' + name;
		
		var countElements = new Array();	
		countElements = granteeString.split('|');
		var numIndex = countElements.length - 1;
		
		document.getElementById('tempGrantees').value = granteeString;
		oRow = tbl.insertRow(-1);
		oCell = oRow.insertCell(0);
		var imgAnchor = document.createElement( 'a' );
		imgAnchor.onclick = function hello(){
										//alert (numIndex);	
										var names = new Array();
										//names = granteeString.split('|');
										names = document.getElementById('tempGrantees').value.split('|');
										//alert (names[0] + names[1] + names[2] + names[3] + names[4] + names[5] + names[6]);
										names.splice( numIndex,1,'-DEL-');
										granteeString = names.join('|');
										document.getElementById('tempGrantees').value = granteeString;										
										delRow(this);return false; 
										return;										
										
									  }
		imgAnchor.onmouseover = function(){ return escape( 'Click here to delete' ) };
		imgAnchor.setAttribute( 'href', 'javascript:void(0)' );
		
		var imageNode = document.createElement( 'img' );
		imageNode.setAttribute( 'border', 0 );
		imageNode.setAttribute( 'src', pathToImages+'delete.gif' );
		imageNode.setAttribute( 'width', 15 );
		imageNode.setAttribute( 'height', 15 );
		imgAnchor.appendChild( imageNode );
		oCell.appendChild( imgAnchor );
		var oCell2 = oRow.insertCell(1);
		var textNode = document.createTextNode(lastRow);
		
		if( edit==true )
		document.getElementById(lastName).focus();
		
		if( name )
		textNode.data = name;
			
		oCell2.appendChild( textNode );			
	
		document.getElementById(lastName).value = '';
		document.getElementById(firstName).value = '';
		if( document.getElementById('payCounty').value == 'null'){
			document.getElementById('addToBatchButton').disabled = true;
		}else{
			document.getElementById('addToBatchButton').disabled = false;
		}
		
		document.getElementById(lastName).focus();
		function delRow(el)
      	{
    		while (el.parentNode && 'tr' != el.nodeName.toLowerCase()){
      		el = el.parentNode;
        }
    		if ('tr' == el.nodeName.toLowerCase()){
      		el.parentNode.removeChild(el);
        }
      	} 
		}
	
	}
	
	/*
	*	Function Name: 	addGrantorNameToDisplay()
	*	Author:			Lee Patsel	
	*	Creation Date:	07/18/05
	*	Purpose:		This function will display the grantor names added to a particular
	*					instrument
	*	Precondition:	Same as calculateFees function
	*	Parameters:		none
	*	Return Value:	none
	*	Triggers:		Clicking the Add Grantor Button
	*	Last Modified:	05/2006
	*	Modified By:	Russell Bowman
	*	Modification:	The edit button was only storing the last grantor grantee so reworked the whole function
	*/
	var grantorString = '';
	function addGrantorNameToDisplay(form,edit)
	{
	var oCell;
		var oRow;
		if(edit==true){
			var tbl = document.getElementById( 'editGrantorsTable' );
			var firstName = 'egrantorFirstName';
			var lastName = 'egrantorLastName';	
			grantorString = document.getElementById('tempGrantors').value;
		}else{			
			var tbl = document.getElementById( 'grantorNameDisplayTable' );
			var firstName = 'grantorFirstName';
			var lastName = 'grantorLastName';	
		}
		var lastRow = tbl.rows.length;	
		validate = validateForm(form,lastName);	
		if (validate == false){return;}
		
		//alert(form.value); //Add Grantor is passed in
		if(lastRow != 0)
		{
		var iteration = lastRow-1;		
		}	
		
		//Update the 'hidden' value grantorNames so that when the user
		//checks out we will have it
		var name = document.getElementById(lastName).value;
		if (name != "" || document.getElementById(firstName).value != '')
		{
		if( document.getElementById(firstName).value != '' )
			name = name + ', ' + document.getElementById(firstName).value;
		
		if (grantorString == '')		
		grantorString = name;
		else
		grantorString = grantorString + '|' + name ;		
		
		var countElements = new Array();	
		countElements = grantorString.split('|');
		var numIndex = countElements.length - 1;
		//alert(numIndex);
		document.getElementById('tempGrantors').value = grantorString;
		
		//alert( name );
		oRow = tbl.insertRow(-1);
		oCell = oRow.insertCell(0); 
		var imgAnchor = document.createElement( 'a' );	
		function delRowee(el)
      	{
			//alert (el.parentNode.nodeValue);
   			while (el.parentNode && 'tr' != el.nodeName.toLowerCase())
			{
      			el = el.parentNode;
				//alert ( el.nodeName );
       		}
    		if ('tr' == el.nodeName.toLowerCase())
			{
      			el.parentNode.removeChild(el);
				//alert ( 'test' );
        	}
			//else {alert ( 'test' );}
      	} 		
		imgAnchor.onclick = function(){
										//alert (numIndex);		document.getElementById('tempGrantors').value								
										var names = new Array();
										names = document.getElementById('tempGrantors').value.split('|');
										//names = grantorString.split('|');
										//alert (names[0] + names[1] + names[2] + names[3] + names[4] + names[5] + names[6]);
										names.splice( numIndex,1,'-DEL-');
										grantorString = names.join('|');
										document.getElementById('tempGrantors').value = grantorString;
										delRowee(this);return false;																	
																				
										return;											
									  }
		imgAnchor.onmouseover = function(){ return escape( 'Click here to delete' ) };
		imgAnchor.setAttribute( 'href', 'javascript:void(0)' );
		
		var imageNode = document.createElement( 'img' );
		imageNode.setAttribute( 'border', 0 );
		imageNode.setAttribute( 'src', pathToImages+'delete.gif' );
		imageNode.setAttribute( 'width', 15 );
		imageNode.setAttribute( 'height', 15 );
		imgAnchor.appendChild( imageNode );
		oCell.appendChild( imgAnchor );
		var oCell2 = oRow.insertCell(1);
		var textNode = document.createTextNode(lastRow);
		
		if( edit==true )
		document.getElementById(lastName).focus();
		
		if( name )		
		textNode.data = name;		
		
		oCell2.appendChild( textNode );			
	
		document.getElementById(lastName).value = '';
		document.getElementById(firstName).value = '';

		
		if( document.getElementById('payCounty').value == 'null')
			document.getElementById('addToBatchButton').disabled = true;
		else
			document.getElementById('addToBatchButton').disabled = false;


		document.getElementById(lastName).focus();
		
		}
		
		
		//alert(document.getElementById('tempGrantors').value);
		
	}	
	

		
/*
	*	Function Name:  loopTest( field )
	*	Author:			Russell Bowman
	*	Creation Date:	04/19/2006
	*	Purpose:		To keep the grantor/grantee name fields in a loop while usere enters valid text
	*	Triggers:		when the Last/Company Name: fields are blurred
	*	Precondition:	none
	*	Parameters:		none	
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/ 
	function loopTest( field )
	{ 
		if(field.value =='')
		{
			switch(field.name)
			{
				case 'grantorLastName': document.getElementById('granteeLastName').focus();
					break
				case 'egrantorLastName': document.getElementById('egranteeLastName').focus();
					break
			}
		}		
	}
	
	function buttonClicked( buttonChoice )
	{
	if(buttonChoice==0) 
	 document.forms.checkOut.submit();	
	}	
	
	/*
	*	Function Name:  storeG( button, last, first )
	*	Author:			Russell Bowman
	*	Creation Date:	05/24/2006
	*	Purpose:		Store all the grantors and grantees entered in a temp in case of a failed validation
	*	Triggers:		when a user enters a grantor/grantee on shelby efile (clicking the 'Add Grantor' or 'Add Grantee' button)
	*	Precondition:	none
	*	Parameters:		none	
	*	Last Modified:	?
	*	Modified By:	?
	*	Modification:	?
	*/ 
	
	var tempGrantors = '';
	var tempGrantees = '';
	var eName = '';
	var rName = '';
	
	function storeG( button, last, first )
	{	//alert ( button.id )
		if ( last )
		{
			switch (button.id) 
			{
				case 'addGrantorButton': 
					if ( first )
						rName = last + ', ' + first;
					else 
						rName = last;					
					break
				case 'addGranteeButton': 
					if ( first )
						eName = last + ', ' + first;
					else 
						eName = last;	 
					break
			}
		} 
		
		if ( rName )
			{
				tempGrantors = tempGrantors + rName;
				tempGrantors = tempGrantors + '|';
			}
			
		if ( eName )
			{
				tempGrantees = tempGrantees + eName;
				tempGrantees = tempGrantees + '|';
			}
		//alert ( eName );  
		//alert ( rName );
		
		var rName = '';
		var eName = '';
		
		document.getElementById('tempGrantors').value = tempGrantors;
		document.getElementById('tempGrantees').value = tempGrantees;
		
		//alert ( tempGrantors );
		//alert ( tempGrantees );
	}
	
	// These functions are used on the payment options forms to validate ###########################


	function hidePaymentFields(value)
	{
		if(value=='Credit Card')
		{
			document.getElementById('ccPayment').style.display = 'block';
			document.getElementById('cPayment').style.display = 'none';
		}
		else
		{
			document.getElementById('ccPayment').style.display = 'none';
			document.getElementById('cPayment').style.display = 'block';
		}
	}
	
	function checkABA(s)
	{

	  var i, n, t;
	
	  // First, remove any non-numeric characters.
	
	  t = "";
	  for (i = 0; i < s.length; i++) {
		c = parseInt(s.charAt(i), 10);
		if (c >= 0 && c <= 9)
		  t = t + c;
	  }
	
	  // Check the length, it should be nine digits.
	
	  if (t.length != 9)
		return false;
	
	  // Now run through each digit and calculate the total.
	
	  n = 0;
	  for (i = 0; i < t.length; i += 3) {
		n += parseInt(t.charAt(i),     10) * 3
		  +  parseInt(t.charAt(i + 1), 10) * 7
		  +  parseInt(t.charAt(i + 2), 10);
	  }
	
	  // If the resulting sum is an even multiple of ten (but not zero),
	  // the aba routing number is good.
	
	  if (n != 0 && n % 10 == 0)
		return true;
	  else
		return false;
	}
	
	// Validation for CC and Bank forms		
		function validate_payment_entry()
		{				
			var creditselected = document.getElementsByName('paymentMethodSelected')[0].checked;			
			if( creditselected == true)
			{
				var cardnum = Trim(document.getElementsByName('payment[Card_Number]')[0].value);
				var name	= Trim(document.getElementsByName('payment[creditName]')[0].value);
				var address	= Trim(document.getElementsByName('payment[creditAddress]')[0].value);
				var zip		= Trim(document.getElementsByName('payment[creditZipCode]')[0].value);
				
				if (cardnum == '')
				{
					alert ('Card Number field cannot be blank');
					return false;
				}
				else if (name == '')
				{
					alert ('Card Holder field cannot be blank');
					return false;
				}
				else if (address == '')
				{
					alert ('Billing Address field cannot be blank');
					return false;
				}
				else if (zip == '')
				{
					alert ('Zip Code field cannot be blank');
					return false;
				}
				else
				{
					return true;
				}
			}	
			else
			{
				var routenum 	= Trim(document.getElementsByName('payment[Routing_Number]')[0].value);
				var vroutenum	= Trim(document.getElementsByName('payment[vRouting_Number]')[0].value);
				var acctnum		= Trim(document.getElementsByName('payment[Check_AccountNum]')[0].value);
				var vacctnum	= Trim(document.getElementsByName('payment[vCheck_AccountNum]')[0].value);
				var bankname	= Trim(document.getElementsByName('payment[bankName]')[0].value);
				
				if(routenum == '')
				{
					alert('Routing Number field cannot be blank')
					return false;
				}
				else if(vroutenum == '')
				{
					alert('ReType Routing Number field cannot be blank')
					return false;
				}
				else if(routenum != vroutenum)
				{
					alert('Routing Number and ReType Routing Number fields do not match')
					return false;
				}
				else if(acctnum == '')
				{
					alert('Checking Account Number field cannot be blank')
					return false;
				}
				else if(vacctnum == '')
				{
					alert('Retype Checking Account Number field cannot be blank')
					return false;
				}
				else if(acctnum != vacctnum)
				{
					alert('Checking Account Number and ReType Checking Account Number fields do not match')
					return false;
				}
				else if (bankname == '')
				{
					alert('Name of Bank field cannot be blank')
					return false;
				}
				else if (checkABA(routenum) === false)
				{
					alert('Routing number is invalid');
					return false;
				}
				else
				{
					return true;
				}				
			}						
		}
		
		function validate_update_cc()
		{
			
			var name	= Trim(document.getElementsByName('payment[creditName]')[0].value);
			var address	= Trim(document.getElementsByName('payment[creditAddress]')[0].value);
			var zip		= Trim(document.getElementsByName('payment[creditZipCode]')[0].value);
			
			if (name == '')
			{
				alert ('Card Holder field cannot be blank');
				return false;
			}
			else if (address == '')
			{
				alert ('Billing Address field cannot be blank');
				return false;
			}
			else if (zip == '')
			{
				alert ('Zip Code field cannot be blank');
				return false;
			}
			else
			{
				return true;
			}
		}
		
		function validate_update_bank()
		{
			var routenum 	= Trim(document.getElementsByName('payment[Routing_Number]')[0].value);
			var acctnum		= Trim(document.getElementsByName('payment[Check_AccountNum]')[0].value);
			var bankname	= Trim(document.getElementsByName('payment[bankName]')[0].value);
			
			if(routenum == '')
			{
				alert('Routing Number field cannot be blank')
				return false;
			}
			else if(acctnum == '')
			{
				alert('Checking Account Number field cannot be blank')
				return false;
			}
			else if (bankname == '')
			{
				alert('Name of Bank field cannot be blank')
				return false;
			}
			else if (checkABA(routenum) === false)
			{
				alert('Routing number is invalid');
				return false;
			}
			else
			{
				return true;
			}
		}
	
