<%@ include file="header.jsp" %> <%@ import = "javax.mail.*,javax.mail.internet.*,javax.activation.*,java.net.InetAddress" %> <% boolean shouldShowFirstForm = true; boolean shouldShowSecondForm = true; boolean shouldShowThirdForm = true; boolean shouldShowForthForm = true; String param_info[][] = { {"firstName", "First Name", "required", "You must enter your First Name"}, {"lastName", "Last Name", "required", "You must enter your Last Name"}, {"address1", "Address 1", "required", "You must enter your Address"}, {"address2", "Address 2", "not required", ""}, {"city", "City", "required", "You must enter your City"}, {"state", "State", "required", "You must enter your State"}, {"zip", "Zip Code", "required", "You must enter your Zip"}, {"phone", "Phone", "required", "You must enter your Phone Number"}, {"fax", "Fax", "not required", ""}, {"email", "E-Mail", "required", "You must enter your E-Mail"}, {"numberAutos", "Number of Autos", "required", "You must enter the number of autos"}, {"numberDrivers", "Number of Drivers", "required", "You must enter the number of drivers"}, }; if (request.getParameter("op") == null) { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = false; shouldShowForthForm = false; } else { if (request.getParameter("op").equals("Initial")) { String errmsg = ""; for (int i = 0; i < param_info.length; i++) { // Test if (param_info[i][2] == "required") { if ((request.getParameter(param_info[i][0]) == null) || (request.getParameter(param_info[i][0]).length() == 0)) { errmsg = errmsg.concat("
  • " + param_info[i][3]); } } } if (errmsg == "") { shouldShowFirstForm = false; shouldShowSecondForm = true; shouldShowThirdForm = false; shouldShowForthForm = false; } else { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = false; shouldShowForthForm = false; out.println(""); out.println(" "); out.println(" "); out.println(" "); out.println("
    Sorry Your Application Is Incomplete
    We are missing some required information from the form you submitted. The following is a list of corrections you must make before we can process your application. Please make the corrections to the form below and resend it.
    "); out.println("
      "); out.println(errmsg); out.println("
    "); out.println("
    "); out.println("

    "); } } else { if (request.getParameter("op").equals("TypeOfCars")) { shouldShowFirstForm = false; shouldShowSecondForm = false; shouldShowThirdForm = true; shouldShowForthForm = false; } else { if (request.getParameter("op").equals("TypeOfDrivers")) { shouldShowFirstForm = false; shouldShowSecondForm = false; shouldShowThirdForm = false; shouldShowForthForm = true; } } } } %> <% if (shouldShowFirstForm == true) { %>

    Individual Auto Quote Request:
    General Information
    Name (First, Last): ">">
    Address ">
      ">
    City/State/Zip ">">">
    Phone "> Fax ">
    E-Mail Address ">

    Auto Usage
    Number of Autos: "> Number of Drivers: ">

    <% } if (shouldShowSecondForm == true) { int numAutos = Integer.parseInt(request.getParameter("numberAutos"), 10); %>
    You have indicated that you are seeking insurance for <% out.print(numAutos) %> vehicles. In order to expedite the quotation process, we ask that you fill in the following information for each vehicle. However, if you wish to send us information for each vehicle in another manner, simply leave these fields blank and continue to the next section.
    <% for(int i = 0; i < numAutos; i++) { out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println("
    "); out.println(" Information for Vehicle " + (i + 1) + ""); out.println("
    YearMake
    ModelVin #
    "); out.println(" Use of Auto:"); out.println(" "); out.println(" "); out.println("
    "); out.println(" If your vehicle is used for pleasue only select 'Pleasure' above. If you use your vehicle for commuting to and from your place of employment, select 'Work'. If you use your vehicle for Business purposes (i.e. traveling to various jobs sites/clients) select 'Business' above."); out.println("
    "); out.println("

    "); } %>
    <% for (int i = 0; i < param_info.length; i++) { out.println(""); } %> <% } if (shouldShowThirdForm == true) { int numDrivers = Integer.parseInt(request.getParameter("numberDrivers"), 10); int numAutos = Integer.parseInt(request.getParameter("numberAutos"), 10); %>
    You have indicated that you are seeking insurance for <% out.print(numDrivers) %> drivers. In order to expidite the quotation process, we ask that you fill in the following information for each drivers. However, if you wish to send us information for each drivers in another manner, simply leave these fields blank and continue to the next section.
    <% for(int i = 0; i < numAutos; i++) { out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println("
    "); out.println(" Information for Driver " + (i + 1) + ""); out.println("
    Name (First, Last):
    Drivers License
    Social Security Number
    Birthday (MM/DD/YY)SexMale/Female
    Martial Status"); out.println(" "); out.println(" Years Licensed
    Number of Violations in Last Five Years.
    Number of Accidents in Last Five Years.
    "); out.println("

    "); } %>
    <% for (int i = 0; i < param_info.length; i++) { out.println(""); } for(int i = 0; i < numAutos; i++) { out.println(""); out.println(""); out.println(""); out.println(""); out.println(""); } %> <% } if (shouldShowForthForm == true) { StringBuffer msgBasetext = new StringBuffer(); msgBasetext.append("From\n--------------------------------------------------------------------------------\nName : " + request.getParameter("firstName") + " " + request.getParameter("lastName") + "\nAddress : " + request.getParameter("address1") + "\n " + request.getParameter("address2") + "\n " + request.getParameter("city") + ", " + request.getParameter("state") + " " + request.getParameter("zip") + "\nPhone : " + request.getParameter("phone") + "\nFax : " + request.getParameter("fax") + "\nE-mail : " + request.getParameter("email") + "\n\nNumber of Autos : " + request.getParameter("numberAutos") + "\n\n"); int numAutos = Integer.parseInt(request.getParameter("numberAutos"), 10); for(int i = 0; i < numAutos; i++) { msgBasetext.append("\n\n"); msgBasetext.append("Information for Vehicle " + (i + 1)); msgBasetext.append("\n--------------------------------------------------------------------------------\n"); msgBasetext.append("Make Of Car : " + request.getParameter("makeAuto" + i) + "\n"); msgBasetext.append("Model Of Car : " + request.getParameter("modelAuto" + i) + "\n"); msgBasetext.append("Year Of Car : " + request.getParameter("yearAuto" + i) + "\n"); msgBasetext.append("VIN Number : " + request.getParameter("vinSerialNoAuto" + i) + "\n"); msgBasetext.append("Use of Auto : " + request.getParameter("useAuto" + i) + "\n\n"); } int numDrivers = Integer.parseInt(request.getParameter("numberDrivers"), 10); for(int i = 0; i < numDrivers; i++) { msgBasetext.append("\n\n"); msgBasetext.append("Information for Driver " + (i + 1)); msgBasetext.append("\n--------------------------------------------------------------------------------\n"); msgBasetext.append("Name of Driver : " + request.getParameter("firstNameDriver" + i) + " " + request.getParameter("lastNameDriver" + i) + "\n"); msgBasetext.append("Birthday : " + request.getParameter("birthdayMonthDriver" + i) + " " + request.getParameter("birthdayDayDriver" + i) + " " + request.getParameter("birthdayYearDriver" + i) + "\n"); msgBasetext.append("Sex of Driver : " + request.getParameter("sexDriver" + i) + "\n"); msgBasetext.append("Martial Status : " + request.getParameter("martialStatusDriver" + i) + "\n"); msgBasetext.append("Drivers License Num : " + request.getParameter("DriversLicense" + i) + "\n"); msgBasetext.append("Social Security Number : " + request.getParameter("SocialSecurityNumber" + i) + "\n"); msgBasetext.append("Years Licensed : " + request.getParameter("yearsLicensedDriver" + i) + "\n"); msgBasetext.append("Number of Violations : " + request.getParameter("numberViolationsDriver" + i) + "\n"); msgBasetext.append("Mumber of Accidents : " + request.getParameter("numberAccidentsDriver" + i) + "\n"); } String mailhost = "couchnt03.couchbraunsdorf.com"; String msgfrom = request.getParameter("firstName") + " " + request.getParameter("lastName") + " <" + request.getParameter("email") + ">"; String msgto = "individual@couchbraunsdorf.com"; String msgcc = null; String msgbcc = "info@couchbraunsdorf.com"; String msgsubject = "Individual Automobile Insurance Inquiry"; StringBuffer msgtext = new StringBuffer(); msgtext.append(msgBasetext); try { Properties props = System.getProperties(); if (mailhost != null) { props.put("mail.smtp.host", mailhost); } Session session = javax.mail.Session.getDefaultInstance(props, null); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(msgfrom)); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(msgto, false)); if (msgcc != null) { msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(msgcc, false)); } if (msgbcc != null) { msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(msgbcc, false)); } msg.setSubject(msgsubject); msg.setText("A " + msgsubject + " was recieved on the Couch Braunsdorf Insurance Web site:\n\n" + msgtext.toString()); msg.setHeader("X-Mailer", "Revolutionary Systems"); msg.setSentDate(new Date()); Transport.send(msg); } catch (Exception e) { out.print(""); } msgfrom = "individual@couchbraunsdorf.com"; msgto = request.getParameter("email"); msgcc = null; msgbcc = null; msgtext = new StringBuffer(); msgtext.append(msgBasetext); try { Properties props = System.getProperties(); if (mailhost != null) { props.put("mail.smtp.host", mailhost); } Session session = javax.mail.Session.getDefaultInstance(props, null); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(msgfrom)); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(msgto, false)); if (msgcc != null) { msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(msgcc, false)); } if (msgbcc != null) { msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(msgbcc, false)); } msg.setSubject(msgsubject); msg.setText("Thank You!\nYour " + msgsubject + " was recieved by Couch Braunsdorf Insurance.\n\nFor your records, below is the information you submitted to us.\n\n" + msgtext.toString() + "\n\nA memeber of the Couch Braunsdorf Insurance Personal Lines Insurance Team will contact you shortly about your inquiry.\n\nAgain, thank you for your interest in Couch Braunsdorf Insurance"); msg.setHeader("X-Mailer", "Revolutionary Systems"); msg.setSentDate(new Date()); Transport.send(msg); } catch (Exception e) { out.print(""); } %>
    Thank You
    You will be contacted shortly regarding your application by a representative within one business day. You will also shortly receive a message by e-mail confirm the contents of your application.
    <% } %> <%@ include file="footer.jsp" %>