function process(f) 
{		
	
	message = "";
	focusObject = null;
	var offerIdType = "";
	var radioElementStartIndex;
	var leap = null;

	
	if(typeof(f.giftCheck) != "undefined")
	{
		if(!f.giftCheck.checked)
		{
				//added by rakesh
			if(typeof(f.selectOffer) != "undefined")
			{
				if (f.selectOffer.value =="" && f.promoCode.value.length < 1)
				{
					message = message + "Please select an offer \n";
					if  (focusObject == null)
					{
						focusObject = f.promoCode;
					}
				}
			}
		/* end added by rakesh */
		}
		else if(f.giftCheck.checked)
			{
				if(typeof(f.confirmationCode) != "undefined")
				{
					if(f.confirmationCode.value.length == 0)
					{
						
						message = message + "Please enter the confirmation number\n";
						if (focusObject==null)
						{
							focusObject = f.confirmationCode;
						}
					}
					else if(f.confirmationCode.value.length>12)
					{
						message = message + "confirmation number should not be greater than 12 digits. \n";
						if (focusObject==null)
						{
							focusObject = f.confirmationCode;
						}
					
					}
					else if(!checkNum(f.confirmationCode.value))
					{
						message = message + "Confirmation number should be numeric. Please re-enter your<br> confirmation number.\n";
						if (focusObject==null)
						{
							focusObject = f.confirmationCode;
						}
					
					}

				}
			}
		}

	
	if(typeof(f.mileageplusNo) != "undefined")
	{
		if(f.mileageplusNo.value.length == 0)
		{
			
			message = message + "Mileage Plus account number does not exist\n";
			if (focusObject==null)
			{
				focusObject = f.mileageplusNo;
			}
		}
		else
		{
			if (f.mileageplusNo.value.length != 11)
			{
				message = message + "Mileageplus Number: It should be 11 digit number\n";
				if (focusObject==null)
				{
					focusObject = f.mileageplusNo;
				}
			}
			else if(!checkNum(f.mileageplusNo.value))
			{
				message = message + "Mileage Plus numbers are all numeric. Please re-enter your<br> Mileage Plus number.\n";
				if (focusObject==null)
				{
					focusObject = f.mileageplusNo;
				}
			}
		}
	}
	
	if (f.firstName.value.length < 2) 
	{
		
		message = message + "First name not valid or incomplete: no numbers allowed and can<br> have maximum 15 characters\n";
		if (focusObject==null)
		{
			focusObject = f.firstName;
		}
	}
	else
	{
		if(  f.firstName.value.length > 15 )
		{
			message = message + "First name not valid or incomplete: no numbers allowed and can<br> have maximum 15 characters\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}
		var retValue=checkFirstName(f.firstName.value);
		if(retValue==0)
		{
			message = message + "First name not valid or incomplete: no numbers allowed and can<br> have maximum 15 characters\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}

	}


	if (f.lastName.value.length < 2 || f.lastName.value.length > 30) 
	{
		
		message = message + "Last name not valid: no numbers allowed and can have maximum 30<br> characters\n";
		if (focusObject==null)
		{
			focusObject = f.lastName;
		}
	}

	else
	{
		if(  f.lastName.value.length > 30 )
		{
			message = message + "Last name not valid: no numbers allowed and can have maximum 30<br> characters\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}
		var retValue=checkLastName(f.lastName.value);
		if(retValue==0)
		{
			message = message + "Last name not valid: no numbers allowed and can have maximum 30<br> characters\n";
			if (focusObject==null)
			{
				focusObject = f.lastName;
			}
		}

	}
	
	if (f.address1.value.length < 2 || f.address1.value.length > 35) 
	{
		
		message = message + "Address line 1: Please enter a valid address\n";
		if (focusObject==null)
		{
			focusObject = f.address1;
		}
	}
	else
	{
		if(!validateAddress(f.address1.value))
		{
			message = message + "Address line 1: Please enter a valid address\n";
			if (focusObject==null)
			{
				focusObject = f.address1;
			}
		}
	}	
	
	
	if (f.address2.value.length >= 1) 
	{
		if(f.address2.value.length > 255)
		{
		
			message = message + "Address line 2: Address Line 2 can have maximum 255 characters\n";
			if (focusObject==null)
			{
				focusObject = f.address1;
			}
		}
	
		
		if(!validateAddress(f.address2.value))
		{
			message = message + "Address line 2: Please enter a valid address\n";
			if (focusObject==null)
			{
				focusObject = f.address2;
			}
		}
	}	
	
	if (f.city.value.length < 2 || f.city.value.length > 30) 
	{
		
		message = message + "The city you entered is not valid. City is a required field that <br> can have maximum 30 characters.\n";
		if (focusObject==null)
		{
			focusObject = f.city;
		}
	}
	else
	{
		var retValue=validateCity(f.city.value);
		if(retValue==0)
		{
			message = message + "Invalid city name\n";
			if (focusObject==null)
			{
				focusObject = f.city;
			}
		}
	
	}
	
	// Country Validation
	if (f.countryGeoId.value =="" )
	{
	
		message = message + "Please Select Country as USA or CANADA.\n";
		if (focusObject==null)
		{
			focusObject = f.countryGeoId;
			
		}
	}
	
	
	if (!validValue(f.stateProvinceGeoId))
		{
			message = message + "State is invalid\n";
			if (focusObject==null)
			{
				focusObject = f.stateProvinceGeoId;
			}
	}
	/*
	if (f.postalCode.value.length < 1) 

	{
		message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
		if (focusObject==null)
		{
			focusObject = f.postalCode;
		}
	}
	else if(!checkPostalCode(f.postalCode.value))
	{
		message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
		if (focusObject==null)
		{
			focusObject = f.postalCode;
		}

	}
	*/	
	if (f.postalCode.value.length < 1) 
	
		{
			message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX)\nor in the format of ANA NAN, where A is a letter of the alphabet\nand N is a digit, with a required space separating \nthe third and fourth characters. \n";
			if (focusObject==null)
			{
				focusObject = f.postalCode;
			}
		}
		else
		{
			if (f.countryGeoId.value =="USA" )
			{
		 		if(!checkPostalCode(f.postalCode.value))
				{
					message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
					if (focusObject==null)
					{
						focusObject = f.postalCode;
					}
	
				}
			}
			if (f.countryGeoId.value =="CAN")
			{
				if(!checkCanPostalCode(f.postalCode.value))
				{
					message = message + "Postal code must in the format of ANA NAN,\n where A is a letter of the alphabet\nand N is a digit, with a required space separating\nthe third and fourth characters. \n";
					if (focusObject==null)
					{
						focusObject = f.postalCode;
					}
					
				}
			}
		}
	
	
	var contactNumberPresent = false;
	if(f.contactNumber2.value.length > 0)
	{
		contactNumberPresent = true;
		if(!checkNum(f.contactNumber2.value))
		{
			message = message + "Phone Number: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
		else if(f.contactNumber2.value.length != 4)
		{
			message = message + "Phone Number: Contact number should be 4 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
	}
	
	if(f.extension.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Extension number: Extension number without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
		else if(!checkNum(f.extension.value))
		{
			message = message + "Extension number: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.extension;
			}
		}
		else if(f.extension.value.length > 4)
		{
			message = message + "Extension number: Extension number should no be more than 4 letters long\n";
			if (focusObject==null)
			{
				focusObject = f.extension;
			}
		}
	}
	
	if(f.contactNumber1.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Prefix: Prefix without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}else if(!checkNum(f.contactNumber1.value))
		{
			message = message + "Prefix: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber1;
			}
		}else if(f.contactNumber1.value.length != 3)
		{
			message = message + "Prefix: It should be 3 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber1;
			}
		}
	}else if(contactNumberPresent)
	{
		message = message + "Prefix: Prefix should be specified\n";
		if (focusObject==null)
		{
			focusObject = f.contactNumber1;
		}
	}
	
	if(f.areaCode.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Area Code: Area code without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}else if(!checkNum(f.areaCode.value))
		{
			message = message + "Area Code: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.areaCode;
			}
		}else if(f.areaCode.value.length != 3)
		{
			message = message + "Area Code: It should be 3 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.areaCode;
			}
		}
	}else if(contactNumberPresent)
	{
		message = message + "Area Code: Area code should be specified\n";
		if (focusObject==null)
		{
			focusObject = f.areaCode;
		}
	}

	
	if(f.attrValue.value.length == 0)
	{
		message = message + "The e-mail address you entered is not valid or incomplete. Please<br> enter a valid e-mail address: Example: johndoe@aol.com\n";
		
		if (focusObject==null)
		{
			focusObject = f.attrValue;
		}
	}
	else
	{
		if(!validateEmail(f.attrValue.value,1))
		{
			message = message + "The e-mail address you entered is not valid or incomplete. Please<br> enter a valid e-mail address: Example: johndoe@aol.com\n";
			if (focusObject==null)
			{
				focusObject = f.attrValue;
			}
		}
	}
   
    if(f.currentPassword.value.length == 0)
	{
		message = message + "Password can not be blank\n";
		
		if (focusObject==null)
		{
			focusObject = f.currentPassword;
		}
	}
    else if (f.currentPassword.value.length < 6 ) 
	{
		message = message + "Password should be atleast 6 characters\n";
		focusObject = f.currentPassword;
		if (focusObject==null)
		{
			focusObject = f.currentPassword;
		}
	}

	if(f.currentPasswordVerify.value.length == 0)
	{
		message = message + "Re-type Password can not be blank\n";
		
		if (focusObject==null)
		{
			focusObject = f.currentPasswordVerify;
		}
	}
    else if (f.currentPasswordVerify.value.length < 6 ) 
	{
		message = message + "Re-type Password should be of 6 chars or more \n";
		focusObject = f.currentPasswordVerify;
		if (focusObject==null)
		{
			focusObject = f.currentPasswordVerify;
		}
	}
	else if (f.currentPasswordVerify.value != f.currentPassword.value ) 
	{
		message = message + "Re-type Password should be same as Password\n";
		focusObject = f.currentPasswordVerify;
		if (focusObject==null)
		{
			focusObject = f.currentPasswordVerify;
		}
	}

	
 if(typeof(f.giftAutoRenew) != "undefined")
	{
	 if(f.giftAutoRenew.value =="Y")
	{
		 if(!f.giftCheck.checked)
		{
			  if (!checkCreditCard (f.cardNumber.value,f.cardType[f.cardType.selectedIndex].value)) 
				{
					message = message + ccErrors[ccErrorNo];
					if (focusObject==null)
					{
						focusObject = f.cardNumber;
					}
				} 
				
				else if(f.creditCardExpMon.value < 1 )
				{
					message = message + "Invalid Month, Please select a Month\n";
					if (focusObject==null)
					{
						focusObject = f.creditCardExpMon;
					}
				}

				else if( !expired( f.creditCardExpMon[f.creditCardExpMon.selectedIndex].value, f.creditCardExpYr[f.creditCardExpYr.selectedIndex].value ) )
				{
					message = message + "This credit card has already expired\n";
					if (focusObject==null)
					{
						focusObject = f.creditCardExpMon;
					}
				}

		}
	 }
	
		else
		{
			 if(!f.giftCheck.checked)
			{
				  if (!checkCreditCard (f.cardNumber.value,f.cardType[f.cardType.selectedIndex].value)) 
					{
						message = message + ccErrors[ccErrorNo];
						if (focusObject==null)
						{
							focusObject = f.cardNumber;
						}
					} 
					
					else if(f.creditCardExpMon.value < 1 )
					{
						message = message + "Invalid Month, Please select a Month\n";
						if (focusObject==null)
						{
							focusObject = f.creditCardExpMon;
						}
					}

					else if( !expired( f.creditCardExpMon[f.creditCardExpMon.selectedIndex].value, f.creditCardExpYr[f.creditCardExpYr.selectedIndex].value ) )
					{
						message = message + "This credit card has already expired\n";
						if (focusObject==null)
						{
							focusObject = f.creditCardExpMon;
						}
					}


			}

		}
	}

	else
	{
	 if(typeof(f.giftCheck) != "undefined")
	  {
	   if(!f.giftCheck.checked)
		{
		if (!checkCreditCard (f.cardNumber.value,f.cardType[f.cardType.selectedIndex].value)) 
			{
				message = message + ccErrors[ccErrorNo];
				if (focusObject==null)
				{
					focusObject = f.cardNumber;
				}
			} 
			
			else if(f.creditCardExpMon.value < 1 )
			{
				message = message + "Invalid Month, Please select a Month\n";
				if (focusObject==null)
				{
					focusObject = f.creditCardExpMon;
				}
			}

			else if( !expired( f.creditCardExpMon[f.creditCardExpMon.selectedIndex].value, f.creditCardExpYr[f.creditCardExpYr.selectedIndex].value ) )
			{
				message = message + "This credit card has already expired\n";
				if (focusObject==null)
				{
					focusObject = f.creditCardExpMon;
				}
			}
		}
	  }

	} 


	
	// Validating the dateOfbirth day, month and year field value//
	if(f.dbDay.value.length < 1 || f.dbMonth.value.length < 1 || f.dbYear.value.length < 1)
	{
		message = message + "Invalid Date Of Birth\n";
		if (focusObject==null)
		{
			focusObject = f.dbMonth;
		}
	}
	
	if (f.dbYear.value % 4 == 0) 
	{
		
		leap = 1;
	}
	else
	{
	   leap = 0;
	}
	if ((f.dbMonth.value == 2) && (leap == 1) && (f.dbDay.value > 29)) 
	{
	        
	        message = message + "There are only 29 days in Feb on Leap Year\n";
	        if (focusObject==null)
		{
			focusObject = f.dbDay;
		}
	}
	else if ((f.dbMonth.value == 2) && (leap != 1) && (f.dbDay.value > 28)) 
	{
	        
	        message = message + "There are only 28 day in Feb\n";
	        if (focusObject==null)
		{
			focusObject = f.dbDay;
		}
	}
	/* Validation of other months */
	
	else if ((f.dbDay.value > 31) && ((f.dbMonth.value == 1) || (f.dbMonth.value == 3) || (f.dbMonth.value == 5) || (f.dbMonth.value == 7) || (f.dbMonth.value == 8) || (f.dbMonth.value == 10) || (f.dbMonth.value == 12))) 
	{
		message = message + "In the month you selected there are only 31 days\n";
	        if (focusObject==null)
		{
			focusObject = f.dbDay;
		}		
	}
	else if ((f.dbDay.value > 30) && ((f.dbMonth.value == 4) || (f.dbMonth.value == 6) || (f.dbMonth.value == 9) || (f.dbMonth.value == 11))) 
	{
		message = message + "In the month you selected there are only 30 days\n";
	        if (focusObject==null)
		{
			focusObject = f.dbDay;
		}		     
	}
	
	//end of birthdate validation//
	// Check for Security Answer field

if (!validValueS(f.authQuestionId))
	{
		message = message + "Please select a security question\n";
		if (focusObject==null)
		{
			focusObject = f.authQuestionId;
		}
	}
	if (f.authQuestionAnswer.value.length <1)
	{	
		message = message + "Please provide an answer to the Secret Security Question\n";
		if (focusObject == null)
		{
			focusObject = f.authQuestionAnswer;
		}
		
	}
	
	//checking the offerIdRadio value and populating the offerId hidden field
	
	for (i=0;i<f.offerIdRadio.length;i++)
	{
		if (f.offerIdRadio[i].checked)
		{
			if(f.offerIdRadio[i].value == "promoCode")
			{
				if(f.promoCode.value.length == 0)
				{
					message = message + "Provide Promotional Code\n";
					focusObject = f.promoCode;
				}
				else
				{
					var offerId = f.promoCode.value;
					f.promoCodeIndicator.value = "TRUE";
				}
				
			}
			else
			{
				var offerId = f.offerIdRadio[i].value;
			}
			if ( message.length == 0 ) 
			{
				f.offerId.value = offerId;
			}
		}
	}
	
	if ( message.length == 0 ) 
	{
		for (i=0;i<f.offerIdRadio.length;i++)
		{
			f.offerIdRadio[i].disabled = true;
		}
		if(typeof(f.promoCode) != "undefined")
		{
			f.promoCode.disabled = true;
		}
	}
	if ( message.length > 0 ) 
	{
		showMessage(message1+message+message2);
		focusObject.focus();
		window.scroll(0,0);
		return false;
	}
	
	return true;
	
}

//For Updation address
function validateBillingAddress(f)
{
	
	message = "";
	focusObject = null;
	
	if (f.address1.value.length < 2 || f.address1.value.length > 35) 
	{

		message = message + "Address line 1: Please enter a valid address\n";
		if (focusObject==null)
		{
			focusObject = f.address1;
		}
	}
	else if (f.address1.value.length >= 2 && f.address1.value.length <= 35) 
	{
		if(!validateAddress(f.address1.value))
		{
			message = message + "Address line 1: Please enter a valid address\n";
			if (focusObject==null)
			{
				focusObject = f.address1;
			}
		}
	}	


	if (f.address2.value.length >= 1) 
	{
		if(f.address2.value.length > 255)
		{

			message = message + "Address line 2: Address Line 2 can have maximum 255 characters\n";
			if (focusObject==null)
			{
				focusObject = f.address1;
			}
		}


		if(!validateAddress(f.address2.value))
		{
			message = message + "Address line 2: Please enter a valid address\n";
			if (focusObject==null)
			{
				focusObject = f.address2;
			}
		}
	}	

	if (f.city.value.length < 1 || f.city.value.length > 30) 
	{

		message = message + "The city you entered is not valid. City is a required field that <br> can have maximum 30 characters.\n";
		if (focusObject==null)
		{
			focusObject = f.city;
		}
	}
	else
	{
		var retValue=validateCity(f.city.value);
		if(retValue==0)
		{
			message = message + "City is invalid, city can be only alphabets.\n";
			if (focusObject==null)
			{
				focusObject = f.city;
			}
		}

	}


	if (!validValue(f.stateProvinceGeoId))
		{
			message = message + "State is invalid\n";
			if (focusObject==null)
			{
				focusObject = f.stateProvinceGeoId;
			}
	}
	/*
	if (f.postalCode.value.length < 1) 
	{
		message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
		if (focusObject==null)
		{
			focusObject = f.postalCode;
		}
	}
	else if(!checkPostalCode(f.postalCode.value))
	{
		message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
		if (focusObject==null)
		{
			focusObject = f.postalCode;
		}

	}
	*/
	if (f.postalCode.value.length < 1) 
		
			{
				message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX)\nor in the format of ANA NAN, where A is a letter of the alphabet\nand N is a digit, with a required space separating \nthe third and fourth characters. \n";
				if (focusObject==null)
				{
					focusObject = f.postalCode;
				}
			}
			else
			{
				if (f.countryGeoId.value =="USA" )
				{
			 		if(!checkPostalCode(f.postalCode.value))
					{
						message = message + "Postal Code must be 5 or 9 digits (e.g- XXXXX-XXXX or XXXXX).\n";
						if (focusObject==null)
						{
							focusObject = f.postalCode;
						}
		
					}
				}
				if (f.countryGeoId.value =="CAN")
				{
					if(!checkCanPostalCode(f.postalCode.value))
					{
						message = message + "Postal code must in the format of ANA NAN,\n where A is a letter of the alphabet\nand N is a digit, with a required space separating\nthe third and fourth characters. \n";
						if (focusObject==null)
						{
							focusObject = f.postalCode;
						}
						
					}
				}
		}
	var contactNumberPresent = false;
	if(f.contactNumber2.value.length > 0)
	{
		contactNumberPresent = true;
		if(!checkNum(f.contactNumber2.value))
		{
			message = message + "Phone Number: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
		else if(f.contactNumber2.value.length != 4)
		{
			message = message + "Phone Number: Contact number should be 4 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
	}

	if(f.extension.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Extension number: Extension number without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}
		else if(!checkNum(f.extension.value))
		{
			message = message + "Extension number: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.extension;
			}
		}
		else if(f.extension.value.length > 4)
		{
			message = message + "Extension number: Extension number should no be more than 4 letters long\n";
			if (focusObject==null)
			{
				focusObject = f.extension;
			}
		}
	}

	if(f.contactNumber1.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Prefix: Prefix without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}else if(!checkNum(f.contactNumber1.value))
		{
			message = message + "Prefix: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber1;
			}
		}else if(f.contactNumber1.value.length != 3)
		{
			message = message + "Prefix: It should be 3 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber1;
			}
		}
	}else if(contactNumberPresent)
	{
		message = message + "Prefix: Prefix should be specified\n";
		if (focusObject==null)
		{
			focusObject = f.contactNumber1;
		}
	}

	if(f.areaCode.value.length > 0)
	{
		if(!contactNumberPresent)
		{
			message = message + "Area Code: Area code without contact number is not valid\n";
			if (focusObject==null)
			{
				focusObject = f.contactNumber2;
			}
		}else if(!checkNum(f.areaCode.value))
		{
			message = message + "Area Code: It should be in number format (0-9)\n";
			if (focusObject==null)
			{
				focusObject = f.areaCode;
			}
		}else if(f.areaCode.value.length != 3)
		{
			message = message + "Area Code: It should be 3 digits long\n";
			if (focusObject==null)
			{
				focusObject = f.areaCode;
			}
		}
	}else if(contactNumberPresent)
	{
		message = message + "Area Code: Area code should be specified\n";
		if (focusObject==null)
		{
			focusObject = f.areaCode;
		}
	}
	
	if ( message.length > 0 ) 
	{

		showMessage(message1+message+message2);
		focusObject.focus();
		window.scroll(0,0);
		return false;
	}
		
	return true;

}

function validateUpdateCreditcard(f)
{
	message = "";
	focusObject = null;
	if (!checkCreditCard (f.cardNumber.value,f.cardType[f.cardType.selectedIndex].value)) 
	{
		message = message + ccErrors[ccErrorNo];
		if (focusObject==null)
		{
			focusObject = f.cardNumberTemp;
		}
	} 


	else if(!expired( f.creditCardExpMon[f.creditCardExpMon.selectedIndex].value, f.creditCardExpYr[f.creditCardExpYr.selectedIndex].value ) )
	{
		message = message + "This credit card has already expired\n";
		if (focusObject==null)
		{
			focusObject = f.creditCardExpMon;
		}
	}
	else
	{
	}
	if ( message.length > 0 ) 
	{
		showMessage(message1+message+message2);
		focusObject.focus();
		window.scroll(0,0);
		return false;
	}
	else
	{
		f.cardNumberTemp.disabled = true;
	}

	return true;
}

function validateUpdateEmail(f)
{
	message = "";
	focusObject = null;
	if(f.attrValue.value.length == 0)
	{
		message = message + "The e-mail address you entered is not valid or incomplete. Please<br> enter a valid e-mail address: Example: johndoe@aol.com\n";

		if (focusObject==null)
		{
			focusObject = f.attrValue;
		}
	}
	else
	{
		if(!validateEmail(f.attrValue.value,1))
		{
			message = message + "The e-mail address you entered is not valid or incomplete. Please<br> enter a valid e-mail address: Example: johndoe@aol.com\n";
			if (focusObject==null)
			{
				focusObject = f.attrValue;
			}
		}
	} 
	if ( message.length > 0 ) 
	{
	
			showMessage(message1+message+message2);
			focusObject.focus();
			window.scroll(0,0);
			return false;
	}
	return true;
}

function validValueS(fld)
{
  with(fld) 
  {
    if (fld.selectedIndex <= 0 && options[selectedIndex].value == "")
    {
      return false;
    }
    else
    {
    	return true;
    }	
  }
}
function processPurchaseSWP(f)
{
	message = "";
	focusObject = null;
	
   	if (f.recName.value.length < 2 ) 
	{
	
		message = message + "-- Kindly enter the first or nick name of the recipient\n";
		if (focusObject==null)
		{
			focusObject = f.recName;
		}
	}
	else
	{
		var retValue=checkFirstName(f.recName.value);
		if(retValue==0)
		{
			message = message + "-- Invalid characters in recipient name\n";
			if (focusObject==null)
			{
				focusObject = f.recName;
			}
		}

	}
	
	if (f.giftGiversName.value.length < 2 ) 
	{
	
		message = message + "-- Kindly enter the name of the gift giver\n";
		if (focusObject==null)
		{
			focusObject = f.giftGiversName;
		}
	}
	else
	{
		var retValue=checkFirstName(f.giftGiversName.value);
		if(retValue==0)
		{
			message = message + "-- Invalid characters in Gift is from\n";
			if (focusObject==null)
			{
				focusObject = f.giftGiversName;
			}
		}

	}

	if(f.recipientMPNumber.value == f.purchaserMPNumber.value && f.recipientMPNumber.value.length>0 )
	{	
		message = message + "-- Recipient Mileage Plus account number and Purchaser Mileage Plus\n   account number cannot be the same.\n";
		if (focusObject==null)
		{
			focusObject = f.firstName;
		}
	}

	if (f.firstName.value.length < 2 ) 
	{
	
		message = message + "-- CardHolder First Name missing\n";
		if (focusObject==null)
		{
			focusObject = f.firstName;
		}
	}
	else
	{
		if(  f.firstName.value.length > 15 )
		{
			message = message + "-- CardHolder First Name can have maximum 15 characters\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}
		var retValue=checkFirstName(f.firstName.value);
		if(retValue==0)
		{
			message = message + "-- CardHolder Invalid characters in First Name\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}

	}
	

	if (f.lastName.value.length < 2 || f.lastName.value.length > 30) 
	{
		message = message + "-- CardHolder Last Name missing\n";
		if (focusObject==null)
		{
			focusObject = f.lastName;
		}
	}
	
	else
	{
		if(  f.lastName.value.length > 30 )
		{
			message = message + "-- CardHolder Invalid characters in Last Name\n";
			if (focusObject==null)
			{
				focusObject = f.firstName;
			}
		}
		var retValue=checkLastName(f.lastName.value);
		if(retValue==0)
		{
			message = message + "-- CardHolder Last Name can be only alphabets, spaces, periods, hypens and apostrophy\n";
			if (focusObject==null)
			{
				focusObject = f.lastName;
			}
		}

	}

		

	if(f.purchaserAttrValue.value.length >= 0)
	{  
		
		if(f.purchaserAttrValue.value.length == 0)
		{			message = message + "-- Email Address: Purchaser E-mail address cannot be left blank\n";
		    if (focusObject==null)
				{
					focusObject = f.purchaserAttrValue;
				}
		}
		else
		{
			if(!validateEmail(f.purchaserAttrValue.value,1))
			{
				message = message + "-- Email Address: The Purchaser e-mail address you entered is not valid or incomplete\n";
				if (focusObject==null)
				{
					focusObject = f.purchaserAttrValue;
				}
			}
		}
	}

	if(typeof(f.recipientMPNumber) != "undefined" && f.recipientMPNumber.value.length>0)
	{
		
		
			if (f.recipientMPNumber.value.length != 11)
			{
				message = message + "-- Recipient Mileageplus Number: It should be 11 digit number\n";
				if (focusObject==null)
				{
					focusObject = f.recipientMPNumber;
				}
			}
			else if(!checkNum(f.recipientMPNumber.value))
			{
				message = message + "-- Mileage Plus numbers are all numeric. Please re-enter your<br>Recepient Mileage Plus number.\n";
				if (focusObject==null)
				{
					focusObject = f.recipientMPNumber;
				}
			}
	
	}
	if(typeof(f.purchaserMPNumber) != "undefined")
	{
		if (f.purchaserMPNumber.value.length >0)
		{
			if (f.purchaserMPNumber.value.length != 11)
			{
				message = message + "-- Purchaser Mileageplus Number: It should be 11 digit number\n";
				if (focusObject==null)
				{
					focusObject = f.purchaserMPNumber;
				}
			}
			else if(!checkNum(f.purchaserMPNumber.value))
			{
				message = message + "-- Mileage Plus numbers are all numeric. Please re-enter your<br> Purchaser Mileage Plus number.\n";
				if (focusObject==null)
				{
					focusObject = f.purchaserMPNumber;
				}
			}
		}
	}
	if (!checkCreditCard (f.cardNumber.value,f.cardType[f.cardType.selectedIndex].value)) 
	{
		message = message + ccErrors[ccErrorNo];
		if (focusObject==null)
		{
			focusObject = f.cardNumber;
		}
	} 
    
	else if(f.creditCardExpMon.value < 1 )
	{
		message = message + "-- Invalid Month, Please select a Month\n";
		if (focusObject==null)
		{
			focusObject = f.creditCardExpMon;
		}
	}

	else if( !expired( f.creditCardExpMon[f.creditCardExpMon.selectedIndex].value, f.creditCardExpYr[f.creditCardExpYr.selectedIndex].value ) )
	{
		message = message + "-- This credit card has already expired\n";
		if (focusObject==null)
		{
			focusObject = f.creditCardExpMon;
		}
	}
		

	if ( message.length > 0 ) 
	{ 
	   	showMessage(message1+message);
		focusObject.focus();
		window.scroll(0,0);
		return false;
	}	
	
	return true;
  
}
