if (chip.equals(IWMarathonConstants.RR_BUY_CHIP)) {
if (chip.equals(IWMarathonConstants.PARAMETER_BUY_CHIP)) {
	private void commitRegistration(IWContext iwc) throws RemoteException {		RunBusiness runBiz = getRunBiz(iwc);		//user info		String name = iwc.getParameter(IWMarathonConstants.PARAMETER_NAME);		String nationality = iwc.getParameter(IWMarathonConstants.PARAMETER_NATIONALITY);		String ssnIS = iwc.getParameter(IWMarathonConstants.PARAMETER_SSN_IS);		String ssn = iwc.getParameter(IWMarathonConstants.PARAMETER_SSN);		IWTimestamp dateOfBirth = null;		if (ssn != null) {			dateOfBirth = new IWTimestamp(ssn);			ssn = dateOfBirth.getDateString("ddMMyy");		}		String gender = iwc.getParameter(IWMarathonConstants.PARAMETER_GENDER);		String address = iwc.getParameter(IWMarathonConstants.PARAMETER_ADDRESS);		String postal = iwc.getParameter(IWMarathonConstants.PARAMETER_POSTAL);		String city = iwc.getParameter(IWMarathonConstants.PARAMETER_CITY);		String country = iwc.getParameter(IWMarathonConstants.PARAMETER_COUNTRY);		String tel = iwc.getParameter(IWMarathonConstants.PARAMETER_TEL);		String mobile = iwc.getParameter(IWMarathonConstants.PARAMETER_MOBILE);		String email = iwc.getParameter(IWMarathonConstants.PARAMETER_EMAIL);		//run info		String run = iwc.getParameter(IWMarathonConstants.GROUP_TYPE_RUN);		String distance = iwc.getParameter(IWMarathonConstants.GROUP_TYPE_RUN_DISTANCE);		IWTimestamp now = IWTimestamp.RightNow();		Integer y = new Integer(now.getYear());		String year = y.toString();		String tshirt = iwc.getParameter(IWMarathonConstants.PARAMETER_TSHIRT);		String chip = iwc.getParameter(IWMarathonConstants.PARAMETER_CHIP);		String chipNumber = iwc.getParameter(IWMarathonConstants.PARAMETER_CHIP_NUMBER);		String groupComp = iwc.getParameter(IWMarathonConstants.PARAMETER_GROUP_COMP);		String groupName = iwc.getParameter(IWMarathonConstants.PARAMETER_GROUP_NAME);		String bestTime = iwc.getParameter(IWMarathonConstants.PARAMETER_BEST_TIME);		String goalTime = iwc.getParameter(IWMarathonConstants.PARAMETER_GOAL_TIME);		String agreement = iwc.getParameter(IWMarathonConstants.PARAMETER_AGREEMENT);		boolean agrees = false;		if (agreement != null) {			agrees = new Boolean(agreement).booleanValue();		}		int sevenKM = Integer.parseInt(iwrb.getIWBundleParent().getProperty("7_km_id", "113"));		int userID = -1;				Table t = new Table();		t.setCellpadding(0);		t.setCellspacing(0);		t.setWidth(Table.HUNDRED_PERCENT);		int row = 1;		Link backBlue = getStyleLink(new Link(iwrb.getLocalizedString("run_reg.back", "Back")), STYLENAME_BLUE_TEXT);		Link backGreen = getStyleLink(new Link("&gt;&gt;"), STYLENAME_GREEN_TEXT);		backBlue.setAsBackLink();		backGreen.setAsBackLink();		String message = "";				boolean isAlreadyRegistered = getRunBiz(iwc).isRegisteredInRun(Integer.parseInt(run), iwc.getCurrentLocale().equals(LocaleUtil.getIcelandicLocale()) ? ssnIS : ssn);		if (!isAlreadyRegistered) {						if (agrees) {				if (ssnIS != null && !ssnIS.equals("")) {					userID = runBiz.saveUser(name, ssnIS, dateOfBirth, gender, address, postal, city, country, tel, mobile, email);									}				else if (ssn != null && !ssn.equals("")) {					userID = runBiz.saveUser(name, ssn, dateOfBirth, gender, address, postal, city, country, tel, mobile, email);				}						if (userID > 0) {					runBiz.saveRun(userID, run, distance, year, nationality, tshirt, chipNumber, groupName, bestTime, goalTime, iwc.getCurrentLocale());				}						message = iwrb.getLocalizedString("registration_received", "Your registration has been received.");				Group runGroup = null;				Group distanceGroup = null;				try {					runGroup = getGroupBusiness(iwc).getGroupByGroupID(Integer.parseInt(run));					distanceGroup = getGroupBusiness(iwc).getGroupByGroupID(Integer.parseInt(distance));					Object[] args = { name, iwrb.getLocalizedString(runGroup.getName(),runGroup.getName()), iwrb.getLocalizedString(distanceGroup.getName(),distanceGroup.getName()), iwrb.getLocalizedString(tshirt, tshirt) };					message = MessageFormat.format(iwrb.getLocalizedString("registration_received", "Your registration has been received."), args);				}				catch (RemoteException re) {					log(re);				}				catch (FinderException fe) {					log(fe);				}								Table buttonTable = new Table(3, 1);				buttonTable.setCellpadding(0);				buttonTable.setCellspacing(0);				buttonTable.setWidth(2, 1, 12);						Link payBlue = getStyleLink(new Link(iwrb.getLocalizedString("run_reg.pay", "Pay fee")), STYLENAME_BLUE_TEXT);				Link payGreen = getStyleLink(new Link("&gt;&gt;"), STYLENAME_GREEN_TEXT);				if (runGroup != null && distanceGroup != null) {					String travelURL = "travelURL_"+runGroup.getName()+"_"+distanceGroup.getName()+"_"+year+"_"+iwc.getCurrentLocale().toString();					if (chip.equals(IWMarathonConstants.RR_BUY_CHIP)) {						travelURL += "_buy";					}					else if (chip.equals(IWMarathonConstants.RR_RENT_CHIP)) {						travelURL += "_rent";					}					if (Integer.parseInt(distance) == sevenKM && ssnIS != null) {						int age = getRunBiz(iwc).getAgeFromPersonalID(ssnIS);						if (age > 0 && age <= 12) {							travelURL += "_12";						}					}					String URL = iwrb.getIWBundleParent().getProperty(travelURL, "#");					if (URL.equals("#")) {						showPayment = false;					}					payBlue.setURL(URL);					payBlue.setTarget(Link.TARGET_NEW_WINDOW);					payGreen.setURL(URL);					payGreen.setTarget(Link.TARGET_NEW_WINDOW);				}						buttonTable.add(backBlue, 1, 1);				buttonTable.add(Text.getNonBrakingSpace(), 1, 1);				buttonTable.add(backGreen, 1, 1);				if (showPayment) {					buttonTable.add(payBlue, 3, 1);					buttonTable.add(Text.getNonBrakingSpace(), 3, 1);					buttonTable.add(payGreen, 3, 1);				}					t.setHeight(row++, 12);				if (showPayment) {					Text payText = new Text(iwrb.getLocalizedString("run_reg.registration_finished_pay", "Registration is now finished. You can pay the fee by clicking on the link below."));					payText.setStyleAttribute("font-size", "12px");										t.add(payText, 1, row++);					t.add(payBlue, 1, row);					t.add(Text.getNonBrakingSpace(), 1, row);					t.add(payGreen, 1, row++);					t.setHeight(row++, 6);				}				t.add(TextFormatter.formatText(message), 1, row++);				t.setHeight(row++, 8);						t.add(buttonTable, 1, row);			}			else {				message = iwrb.getLocalizedString("run_reg.must_accept_conditions", "You must accept the conditions before you can register.");				t.setHeight(row++, 12);				t.add(TextFormatter.formatText(message), 1, row++);				t.setHeight(row++, 8);				t.add(backBlue, 1, row);				t.add(Text.getNonBrakingSpace(), 1, row);				t.add(backGreen, 1, row++);			}		}		else {			message = iwrb.getLocalizedString("run_reg.already_registered", "You have already registered for this run.");			t.setHeight(row++, 12);			t.add(TextFormatter.formatText(message), 1, row++);			t.setHeight(row++, 8);			t.add(backBlue, 1, row);			t.add(Text.getNonBrakingSpace(), 1, row);			t.add(backGreen, 1, row++);		}		add(t);	}