// == gpf_setup ========================================================================================

	//-- On Changed Alert ------------------------------------------------------------------------------
		//add onBeforeUnload="return gpf_checkChanged();" to body tag (should be in setup.asp)
		//add onchange="gpf_change(this)" to form element tags

		window.onbeforeunload = gpf_changeUnload;
		var gpf_changed = false;

		function gpf_change(){
			gpf_changed = true;
		}
		
		function gpf_changeUnload(){
			var msg = "Any unsaved changes will be lost if you chose to continue."
			if (gpf_changed){return msg}
		}
		
		function gpf_checkChanged(){
			var msg = "Are you sure you want to navigate away from this page?\n\nAny unsaved changes will be lost if you choose to continue.\n\nPress OK to continue, or Cancel to stay on the current page."
			if (gpf_changed) {
				if (confirm(msg)){
					gpf_changed = false;
					return true;
				} else {
					return false;
				}
			} else {
				return true;
			}
		}
	//---------------------------------------------------------------------------------------------------	
	
	function gpf_setError(vThis, vError, vErrorText){
		//set error of field from external call
		var fId		= vThis.id
		var fLabel 	= document.getElementById("gpL_"+ fId.substring(4, fId.length))
		if (fLabel!=null){
			if(vError){
				fLabel.className	= "gpf_errorLabel"
				fLabel.title		= 'This field ' + vErrorText;
			}
			else {
				fLabel.className	= "";
				fLabel.title		= "";
			}
		}
	}

	 function gpf_setup(){
	 	gpf_changed = false;
	 	var f = 0;
	 	
	 	for (f=0; f<document.forms.length; f++){ 
	 		var vform			= document.forms[f];
		 	var frmName 		= vform.name;
		 	var frmElements		= vform.length;
		 	var i				= 0;
		 	
			if (frmName.substr(0,4)=='gpf_'){
				for (i=0; i < frmElements; i++){
					// load variables -	note: null if var not found
					var fField	= document[frmName].elements[i];
				 	var fId		= fField.id;
					var fLabel 		= document.getElementById("gpL_"+ fId.substring(4, fId.length))
					var fRequired = document.getElementById("gpf_requiredText")
					var fRequiredAlt = document.getElementById("gpf_requiredTextAlt")
					var	fCheck		= fField.getAttribute("gpK");
				 	var fType		= fField.type;
				 	var	fCheck		= fField.getAttribute("gpK");
				 	var fValue		= fField.value;
				 	var	fVal		= fField.getAttribute("gpV");
				 	var fDefault	= fField.getAttribute("gpD");
				 	var fDimen		= fField.getAttribute("gpX");
				 	
					// set required fields
					if (fCheck != null && fLabel != null){
						//individual fields
						if (fCheck.indexOf("Rq;") != -1){
							fLabel.innerHTML = fLabel.innerHTML + "<span class='gpf_required'>*</span>"
							if (fRequired != null){
								fRequired.innerHTML = "<span style='color:red;'>*</span> = required"
							}
			            }
			            //combined fields
			            if (fCheck.indexOf("Ra;") != -1) {
			                fLabel.innerHTML = fLabel.innerHTML + "<span style='color:navy;'>*</span>"
			                if (fRequiredAlt != null) {
			                    fRequiredAlt.innerHTML = "<span style='color:navy;'>*</span> = one required"
			                }
			            }
					}
		
					// set readOnly
					if (fCheck != null){
						if (fCheck.indexOf("Ro;") != -1){
							fField.readOnly = true;
							fField.className = "gpf_inputReadOnly"
						}
					}

					// set disabled -- will not submit with the form.
					if (fCheck != null){
						if (fCheck.indexOf("Dd;") != -1){
							fField.disabled = true;
						}
					}

					if (fId != null){
					if (fId.substr(0,4) == 'gpf_'){
						//create name attribute
					 	fField.name 	= fId;
					 	
				 	 	// standardize values
					 	if(fCheck==''){fCheck=null};if(fCheck!=null){fCheck= gpf_trim(fCheck)};
					 	if(fValue==''){fValue=null};if(fValue!=null){fValue= gpf_trim(fValue)};
					 	if(fVal==''){fVal=null};if(fVal!=null){fVal= gpf_trim(fVal)};
					 	if(fDefault==''){fDefault=null};if(fDefault!=null){fDefault = gpf_trim(fDefault)};
					 	if(fDimen==''){fDimen=null};if(fDimen!=null){fDimen= gpf_trim(fDimen)};
		
					 	//	handle default assignment
						if (fDefault!=null && fVal==null){
							fVal = fDefault;
							if(fLabel!=null){
								//fLabel.innerHTML = fLabel.innerHTML + "<font color=blue>*</font>"
							}
						}
					 	
						// setup dimensional widths and heights

						if (fType == "checkbox"){
							fField.style.position 	= 'relative'
							fField.style.marginTop	= '4px'
						}

						if (fDimen != null){
							var vStart  	= fDimen.indexOf("w:")
							if (vStart != -1){
								vStart 		= vStart + 2
								var vEnd	= fDimen.indexOf(";",vStart)						
								var vVal	= parseInt(fDimen.substring(vStart, vEnd))
								if (!isNaN(vVal) && vVal > 0){fField.style.width = vVal+'px'};
							}
							var vStart  	= fDimen.indexOf("h:")
							if (vStart != -1){
								vStart 		= vStart + 2
								var vEnd	= fDimen.indexOf(";",vStart)						
								var vVal	= parseInt(fDimen.substring(vStart, vEnd))
								if (!isNaN(vVal) && vVal > 0){fField.style.height = vVal+'px'};
							}

						}

						// setup date field
						if (fCheck != null && fLabel != null){
							if (fCheck.indexOf("Dt;") != -1){
								//fField.readOnly = true;
							}
						}

						// prepare display values
						if (fType == "text" || fType=='textarea' || fType=='password'){
							if (fVal != null){
								fField.value = fVal;
							}
						}

						// password prep for autocomplete=off
						if (fType=='password'){
							fField.setAttribute('autocomplete','off'); 
						}
											
						if (fType == "select-one" || fType == "select-multiple"){
							if (fVal != null){
								var v;
								var a;
								var vElements = fField.length;
								var vSelected = fVal.split(",");
													
								for (v=0; v < vElements; v++){
									for (a=0; a < vSelected.length; a++){
										if(gpf_trim(vSelected[a]) == fField[v].value){
											fField[v].selected = true;
											fField[v].className = 'selected';
										}
									}
								}
							}
						}
						
						if (fType == "checkbox"){
							if (fVal!=null){
								if(fVal.toLowerCase()=='true' ||  fVal==1){
									fField.checked = true;
								}
							}
							fField.value = 1;
						}
	
					}	
					}
				}
			} //form if gpf_ loop
		}
		
		var gpfDiv = document.getElementById("gpf")
		if (gpfDiv!=null){
			gpfDiv.style.visibility = 'visible';
		}

		var gpfMsg = document.getElementById("gpf_msgText")
		if (gpfMsg!=null && gpfMsg.value!=""){
			gpfMsg.style.display = 'block';
		}

	 }
	
// == gpf_validation ========================================================================================

	var fErrorText	= null;	//gives global scope to this variable 	
	
	function gpf_validate(vform){
		var err = true
	 	var frmName 		= vform.name;
	 	var frmElements		= vform.length;
	 	var frmError		= false;
	 	var frmErrorMsg		= null;	 	
	 	var i
	 	
	 	var fSaveBtn 		= document.getElementById("gpf_saveButton")
	 	if (fSaveBtn!=null){
	 		fSaveBtn.value = "Please Wait ..."
	 		fSaveBtn.disabled = true
	 	}
	 	
	 	
		for (i=0; i < frmElements; i++){
			var fField		= document[frmName].elements[i];
		 	var fId			= fField.id;
			var fLabel 		= document.getElementById("gpL_"+ fId.substring(4, fId.length))

//			alert(fId +' - '+ fField.value)
					 	
			if (fId != null){
			if (fId.substr(0,4) == 'gpf_'){
				// load variables -	note: null if var not found
			 	var fType		= fField.type;
			 	var	fCheck		= gpf_trim(fField.getAttribute("gpK"));
			 	var fValue		= gpf_trim(fField.value);
			 	var fError		= false;
				fErrorText		= null;
				
				//alert(fField.id +' / '+ fValue +'  = '+ fCheck +' | '+ fField.checked)
			
		 	 	// standardize values
			 	if(fCheck==''){fCheck=null};if(fCheck!=null){fCheck= gpf_trim(fCheck)};
				if(fValue==null){fValue=''};
					fValue= gpf_trim(fValue);

				//prepare for checks
				if (fCheck != null){
					var k;	
					var fArray		= fCheck.split(";");
					
					for (k=0; k < fArray.length; k++){
						var kK = gpf_trim(fArray[k].substring(0,2));
						var kT = gpf_trim(fArray[k].substring(2, fArray[k].length));
						var kV = fValue
						
  						//alert(fField.name +' = '+ fField.value)
  						
  						
						if (kK=='Rq' || kV!=''){
			  				switch(kK)
		  					{
							//-- No checks for these elements
		  						case "":
		  							break;
		  						case "Ro":
		  							break;
		  						case "Dd":
		  						    break;
		  						//ra will be checked on its own
		  						case "Ra":
		  						    break;
		  							
							//-- Required
		  						case "Rq": //Required
		  					        if (fType=='checkbox' && fField.checked!=true){
		  					            fErrorText='is required';
		  				                fError=true;}
		  				            else if (!gpf_isRequired(kV)){fError=true;}
		  			                break;
						    	
							//-- Confirmation field
		  						case "Cf": //Confirmation field
		  							if (!gpf_confirmField(fField,kV)){fError=true;}
		  							break;
		  							
		  					//-- List Functions
		  						case "Xn": //List count minimum
		  							if (!gpf_isListMin(fField,kT)){fError=true;}
		  							break;
		  						case "Xx": //List count maximum
		  							if (!gpf_isListMax(fField,kT)){fError=true;}
		  							break;
	  							
							//-- Number functions
		  						case "Nu": //Number
		  							if (!gpf_isNumeric(kV)){fError=true;}
		  							break;
		  						case "In": //Integer
		  							if (!gpf_isInteger(kV)){fError=true;}
		  							break;
		  						case "Cu": //Currency
		  							if (!gpf_isCurrency(kV)){fError=true;}
		  							break;			  						
		  						case "Nx": //Number <= Max
		  							if (!gpf_isNumberMax(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Nn": //Number >= Min
		  							if (!gpf_isNumberMin(kV, kT)){fError=true;}
		  							break;			  						
	  						
	  						//-- Format functions
		  						case "Em": //Email
		  							if (!gpf_isEmail(kV)){fError=true;}
		  							break;			  						
		  						case "Ph": //Phone
		  							if (!gpf_isPhone(kV)){fError=true;}
		  							break;			  						
		  						case "Ss": //SSN
		  							if (!gpf_isSSN(kV)){fError=true;}
		  							break;			  						 
		  						case "Zp": //Zipcode 5/9
		  							if (!gpf_isZip(kV)){fError=true;}
		  							break;			  						
		  						case "Cc": //All numeric credit card
		  							if (!gpf_isCreditCard(kV)){fError=true;}
		  							break;			  						
	
							//-- Date functions
		  						case "Dt": //Date
		  							if (kV!=null && kV!=''){if (!gpf_isDateSlash(kV)){fError=true;}}
		  							break;			  						
		  						case "Tx": //Date <= Today
		  							var kToday = new Date();
		  							if (!gpf_isDateMax(kV, gpf_dateSlash(kToday))){fError=true;}
		  							break;			  						
		  						case "Tn": //Date >= Today
		  							var kToday = new Date();
		  							if (!gpf_isDateMin(kV, gpf_dateSlash(kToday))){fError=true;}
		  							break;			  						
		  						case "Dx": //Date <= Max
		  							if (!gpf_isDateMax(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Dn": //Date <= Min
		  							if (!gpf_isDateMin(kV, kT)){fError=true;}
		  							break;				  						
	
							//-- Misc String functions
		  						case "Lx": //Length <= Max
		  							if (!gpf_isLengthMax(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Ln": //Length >= Min
		  							if (!gpf_isLengthMin(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Cy": //Characters allowed (list)
		  							if (!gpf_isCharsYes(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Cn": //Characters not allowed (list)
		  							if (!gpf_isCharsNo(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Cd": //Characters allowed (double quotes)
		  							if (!gpf_isCharsDoubleQuote(kV)){fError=true;}
		  							break;			  						
		  						case "Cs": //Characters not allowed (semi Colon)
		  							if (!gpf_isCharsSemiColon(kV)){fError=true;}
		  							break;			  	
		  						case "Vy": //Value must be (single)
		  							if (!gpf_isValueYes(kV, kT)){fError=true;}
		  							break;			  						
		  						case "Vn": //Value cannot be (single)
		  							if (!gpf_isValueNo(kV, kT)){fError=true;}
		  							break;			  								  						
		  						case "Up": //Upload File
		  							if (!gpf_isFileType(kV, kT)){fError=true;}
		  							break;
		  						default:
		  							fError=true;
		  							break;			  								  						
		  					}
	  					}
					}

					if (fError==true){
						frmError=true;
					}
					var callF = gpf_setError(fField, fError, fErrorText)
				}
				}				
			}		
		}
		//end of field loop
		//check for comnimed email or phone
		if ((frmName == 'gpf_homeInfo') || (frmName == 'gpf_moreInfo') || (frmName == 'gpf_indyreg')) {

		    if ((document[frmName].gpf_PhoneDay.value == null || document[frmName].gpf_PhoneDay.value.length == 0) && (document[frmName].gpf_EmailAddress.value == null || document[frmName].gpf_EmailAddress.value.length == 0)) {

		        frmError = true;

		        var callF = gpf_setError(document[frmName].gpf_PhoneDay, true, ' is required if Email is blank.')

		        var callF = gpf_setError(document[frmName].gpf_EmailAddress, true, ' is required if Phone is blank.')

		    }

		}

			if (frmError==false){
			
				gpf_changed = false; // on change see top of js
				
			 	var i
				for (i=0; i < frmElements; i++){
					var fField	= document[frmName].elements[i];
					var fId		= fField.id
					if (fField.type == 'submit'){fField.disabled=true;fField.value='Please Wait ...';}
					if (fId != null){
					if (fId.substr(0,4) == 'gpf_'){
						if (fField.type == "checkbox"){
							//flip checkbox unchecked to checked with value of 'false'
							if(fField.checked == false){
								fField.checked = true;
								fField.value = 0;
							}
						}
					}
					}
				}
				return true;
			}
			else {
				window.scrollTo(0,0);
			 	if (fSaveBtn!=null){
			 		fSaveBtn.value = "Save"
			 		fSaveBtn.disabled = false
				 	}
                alert('** Form NOT submitted **\n\nPlease reivew the form fields marked in red then resubmit.\n\nThank you')
/*				var gpf_msgText = document.getElementById("gpf_msgText")
				if (gpf_msgText!=null){
					gpf_msgText.innerHTML = "Problems found during processing!<br><span class=\"gpf_msgText2\">Rollover red name for more information</span>"
					gpf_msgText.style.display = 'block'
				}
*/
				return false;
			}
	}

// == gpf_datePop (popup) ========================================================================================

	function gpf_datePop(vThis){
		//load date constraints
		var i;
		var setDate = new Date();
		var maxDate	= new Date();
		var minDate	= new Date();
		var Tx	 	= new Date();Tx	= null;
		var Tn	 	= new Date();Tn	= null;
		var Dx	 	= new Date();Dx	= null;
		var Dn	 	= new Date();Dn	= null;
		var vV;
		var vT		= new Date();
		var vToday
	
		//load today's date
		vToday		= vT.getMonth()+1 +'/'+ vT.getDate() +'/'+ vT.getFullYear();

		//Initial calendar set value
		setDate = vThis.value;
		if (!gpf_isDateSlash(setDate)){setDate = vToday}

		
		// load check values and set to given
		var cal 	= new CalendarPopup("gpf_cal");
		var vChecks	= vThis.getAttribute("gpK");	
		var vArray	= vChecks.split(";");
		
		for (i=0; i < vArray.length; i++){
			var vK = gpf_trim(vArray[i].substring(0,2));
			var vV = gpf_trim(vArray[i].substring(2, vArray[i].length));
			if (vK == 'Tx'){Tx = parseDate(vToday)}
			else if (vK == 'Tn'){Tn = parseDate(vToday)}
			else if (vK == 'Dx'){Dx = parseDate(vV)}
			else if (vK == 'Dn'){Dn = parseDate(vV)}
		}

		//max/min calendar show values
		if (Tx != null || Dx != null){
			if (Tx != null && Dx == null) 		{maxDate = Tx}
			else if(Tx == null && Dx != null) 	{maxDate = Dx}
			else if (Tx > Dx)					{maxDate = Dx}
			else								{maxDate = Tx}
			maxDate = gpf_dateSlash(maxDate)
			maxDate = gpf_dateAdd(maxDate,1)
			cal.addDisabledDates(maxDate, null);
		}

		if (Tn != null || Dn != null){
			if(Tn != null && Dn == null) 		{minDate = Tn}
			else if(Tn == null && Dn != null) 	{minDate = Dn}
			else if (Dn > Tn)					{minDate = Dn}
			else								{minDate = Tn}	
			minDate = gpf_dateSlash(minDate);			
			minDate = gpf_dateAdd(minDate,-1)
			cal.addDisabledDates(null, minDate);

		}
		
		//http://www.mattkruse.com/javascript/calendarpopup/combined_compact_source.html
		cal.select(vThis, vThis.id, 'MM/dd/yyyy', setDate);
	}

// == support functions ====================================================================================
// ======================== general support	
	function gpf_trim(str){
		if (str != null){str = str.replace(/^\s*|\s*$/g,'');}
		return str;
		}
	function gpf_ltrim(str){
	    if (str != null){str = str.replace(/^\s*/g,'');}
		return str;
		}
	function gpf_rtrim(str){
	    if (str != null){str = str.replace(/\s*$/g,'');}
		return str;
		}
	function gpf_left(str,n)
		{ return str.substr(0,n); }
	
	function gpf_right(str,n)
		{ return str.substr(str.length-n,str.length); }

	function gpf_mid(str,x, n)
		{ return str.substr(x,n); }

	function gpf_len(str)
		{ return str.length; }
		
	function gpf_replace(str,oVal,nVal){
			if (oVal=='.' || oVal==')' || oVal=='('){oVal= '['+ oVal +']'}
			var oReg = new RegExp(oVal,"gi"); //convert to regular express for search all
			return str.replace(oReg,nVal); 
		}
		
	function gpf_dateSlash(str){
		// convert real date into mm/dd/yyyy
		return gpf_right('0'+ (str.getMonth()+1),2) +'/'+ gpf_right('0'+ str.getDate(),2) +'/'+ str.getFullYear()
	}

	function gpf_dateAdd(str, val){
		// add val days to mm/dd/yyyy and return mm/dd/yyyy
		//if (isDate(str) && !isNaN(val) && val!=null){
		var da = str.split("/");
		var aYear = da[2];
		var aMonth = da[0]-1;
		var aDay = eval(parseInt(da[1]) + parseInt(val));
		var aDate = new Date(aYear, aMonth, aDay);
		
		return gpf_dateSlash(aDate);			
	}
		
// ======================== check functions
	function gpf_isCharsYes(str, vchars) 
		{// Cy - str only contains characters in vchars
			var i = 0
			while (i < str.length)
			{
				if (vchars.indexOf(str.substr(i,1)) == -1)
				{ 
					fErrorText  = "has invalid characters";					
					return false;
				}
				i++	
			}
			return true;
		}

	function gpf_isCharsNo(str, vchars) 
		{// Cn - str does not contain any characters in vchars
			var i = 0
			while (i < str.length)
			{
				if (vchars.indexOf(str.substr(i,1)) != -1)
				{ 
					fErrorText  = "has invalid characters";					
					return false;	
				}
				i++	
			}
			return true;
		}

	function gpf_isCharsDoubleQuote(str) 
		{// Cd - str must not contain double quote
			if (str.indexOf('"') != -1)
			{ 
				fErrorText  = "has invalid characters";					
				return false;	
			}
			return true;
		}

	function gpf_isCharsSemiColon(str) 
		{// Cs - str must not contain semi colon
			if (str.indexOf(';') != -1)
			{ 
				fErrorText  = "has invalid characters";					
				return false;	
			}
			return true;
		}

	function gpf_isValueYes(str, val) 
		{// Vy - str equals val

			if (str==val)
			{ return true; }
			
			fErrorText  = "is invalid";													
			return false;
		}

	function gpf_isValueNo(str, val) 
		{// Vn - str does not equal val

			if (str!=val)
			{ return true; }								
			
			fErrorText  = "is invalid";								
			return false;
		}

	function gpf_isLengthMax(str, val) 
		{// Lx - length of str is less than or equal to val
			str = str+'';
			if (str.length <= val)
			{ return true; }
			
			fErrorText  = "must be no more than "+ val +" characters long";													
			return false;
		}

	function gpf_isLengthMin(str, val) 
		{// Ln - length of str is greater than or equal to val
			str = str+'';
			if (str.length >= val)
			{ return true; }								
			
			fErrorText  = "must be at least "+ val +" characters long";													
			return false;
		}

	function gpf_isNumberMax(str, val) 
		{// Nx - value of str is less than or equal to val
			if (gpf_isNumeric(str))
			{
				if (parseFloat(str) <= parseFloat(val))
				{ return true; }								
			}
			
			fErrorText  = "must be no more than "+ val;														
			return false;
		}

	function gpf_isNumberMin(str, val) 
		{// Nn - value of str is greater than or equal to val
			if (gpf_isNumeric(str))
			{
				if (parseFloat(str) >= parseFloat(val))
				{ return true; }								
			}	
			fErrorText  = "must be at least "+ val;																
			return false;
		}
		
	function gpf_isDateMax(str, val) 
		{// Dx, Tx - value of str is less than or equal to val
			if (gpf_isDateSlash(str) && gpf_isDateSlash(val))
			{
				if (parseDate(str) <= parseDate(val))
				{ return true; }								
			}	
			
			fErrorText = "cannot be later than "+ val;														
			return false;
		}

	function gpf_isDateMin(str, val) 
		{// Dn, Tn - value of str is greater than or equal to val
			if (gpf_isDateSlash(str) && gpf_isDateSlash(val))
			{
				if (parseDate(str) >= parseDate(val))
				{ return true; }								
			}	
			
			fErrorText = "cannot be ealier than "+ val;																
			return false;
		}
	
//-------------------------------------------------

	function gpf_isListMin(vThis, val)
		{// = Xn - list count must be at lease 
			var v;
			var x =0;
			for (v=0; v < vThis.length; v++){if (vThis[v].selected){x=x+1}}
		
			if (x < val ) 
			{ 
				fErrorText  = "requires at least "+ val +" selection(s)"
				return false;
			}
			return true;
		}

	function gpf_isListMax(vThis, val)
		{// = Xx - list no more than
			var v;
			var x =0;
			for (v=0; v < vThis.length; v++){if (vThis[v].selected){x=x+1}}

			if (x > val ) 
			{ 
				fErrorText  = "requires a maximum of "+ val +" selection(s)"
				return false;
			}
			return true;
		}
		
//-------------------------------------------------
	   
	function gpf_isRequired(str)
		{// = Rq - a value is required
			str = gpf_trim(str);

			if (str == null || str.length == 0) 
			{ 
				fErrorText  = "is required"
				return false;
			}
			return true;
		}

	function gpf_confirmField(inField,str)
		{
			str = gpf_trim(str)
			var cField = document.getElementById(inField.id+'_confirm')
			if (cField!=null){
				var str2 = gpf_trim(cField.value)
				if (str!=str2){
					fErrorText  = "'\s confirm value did not match"
					return false;				
				}
			}	
			else
			{
				fErrorText  = "gpf - confirmation field unavailable (*_confirm)"
				return false;
			}
			return true;
		}	

	function gpf_isFileType(str, val)
		{// = Up - value of str is a valid (Val) file type
			if (str=='' || val=='')
				{return true;}
		
			str = str.toLowerCase();
			val = val.toLowerCase();
			var aVal = val.split(',');
			var k;
			var ext;
			var fnd = false;
			
			for (k=0; k < aVal.length; k++){
				ext = aVal[k];
				if (str.substring(str.length-(ext.length+1))== '.'+ext){fnd=true}
			}
			
			if (fnd==false)
				{
					fErrorText  = "is not a valid file type";
					return false;					
				}
			return true;
		}
		
	function gpf_isNumeric(str)
		{// = Nu - value of str is a valid number, may include decimals
			fErrorText  = "is invalid";
			return(parseFloat(str,10)==(str*1));
		}
		
	function gpf_isInteger(str)
		{// = In - value is an Integer
			fErrorText  = "is invalid";		
			return (str==parseInt(str));
		}

	function gpf_isZip(str)
		{// = Zp - value is a zip5/9 once stripped
			str = gpf_replace(str, "-", "");
			str = gpf_replace(str, " ", "");
			
			if (gpf_isNumeric(str))
				{ 
					if (str.length==5 || str.length==9)
						{ return true; }
				}
				
			fErrorText  = "is invalid";				
		  	return false;
		}

	function gpf_isSSN(str)
		{// = Ss - value is SSN/9 once stripped
			str = gpf_replace(str, "-", "");
			str = gpf_replace(str, " ", "");
			str = gpf_replace(str, ".", "");			
		
			if (gpf_isNumeric(str) && str.length==9)
				{ return true; }
				
			fErrorText  = "is invalid";				
		  	return false;
		}

	function gpf_isCC(str)
		{// = Cc - value is a number once stripped, no other checking
			str = gpf_replace(str, "-", "");
			str = gpf_replace(str, " ", "");
			
			if (gpf_isNumeric(str))
				{ return true; }
				
			fErrorText  = "is invalid";				
		  	return false;
		}
		
	function gpf_isPhone(str)
		{// = Ph - value is a number of length 10 once stripped
			str = gpf_replace(str, " ", "");
			str = gpf_replace(str, "-", "");
			str = gpf_replace(str, "(", "");
			str = gpf_replace(str, ")", "");
			str = gpf_replace(str, ".", "");

			if ((gpf_isNumeric(str) && str.length==10) || (gpf_isNumeric(str) && str.length==7))
				{ return true; }
				
			fErrorText  = "is invalid";				
		  	return false;
		}		

	function gpf_isCurrency(str)
		{// = Cu - value is 2 decimal once stripped and is number
		  str = gpf_replace(str, "$", "");
		  str = gpf_replace(str, ",", "");
		  
		  if (gpf_isNumeric(str))
			  { return(str==Math.round(str*100)/100); }
			  
		  fErrorText  = "is invalid";			  
		  return false;
		}		

 	function gpf_isEmail(str) 
		{// = Em - value is Email
			var at="@";
			var dot=".";
			var lat=str.indexOf(at);
			var lstr=str.length;
			var ldot=str.indexOf(dot);
			fErrorText  = "is invalid";

			if (str.length>0){
				if (str.indexOf(at)==-1)
					{ return false; }
				if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
					{ return false; }
				if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
					{ return false; }
			 	if (str.indexOf(at,(lat+1))!=-1)
				 	{ return false; }
				 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
				 	{ return false; }
				 if (str.indexOf(dot,(lat+2))==-1)
				 	{ return false; }
				 if (str.indexOf(" ")!=-1)
				 	{ return false; }
			}
	 		return true;					
		} 
		
	function gpf_isDateSlash(str){
		// determine whether mm/dd/yyyy is a valid date
		var da = str.split("/");
			var aYear = da[2];
			var aMonth = da[0]-1;
			var aDay = da[1];
		var dx = new Date(aYear, aMonth, aDay);
			var xYear = dx.getFullYear();
			var xMonth = dx.getMonth();
			var xDay = dx.getDate();
		if (aYear==xYear && aMonth==xMonth && aDay==xDay){
			return true
		}
		else {
			fErrorText  = "is not a valid date";
			return false
		}
	}
