<%@ include file="header.jsp" %> <%@ import = "javax.mail.*,javax.mail.internet.*,javax.activation.*,java.net.InetAddress" %> <% boolean shouldShowFirstForm = true; boolean shouldShowSecondForm = true; boolean shouldShowThirdForm = true; String param_info[][] = { {"companyName", "Company Name", "required", "You must enter your Company Name"}, {"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"}, {"bussinessNumberLocations", "Building Locations", "required", "You must enter the number of business locations you wish to have quoted."}, {"burglarAlarm", "Burglar Alarm", "not required", ""}, {"guardsWatchmen", "Guards Watchmen", "not required", ""}, {"fireSprinklers", "Fire Sprinklers", "not required", ""}, {"fireStandpipes", "Fire Standpipes", "not required", ""}, {"fireCO2HalonSystems", "Fire CO2/Halon Systems", "not required", ""}, {"SpecialConsideration", "Special Consideration", "not required", ""}, {"remarks", "Remarks", "not required", ""}, }; if (request.getParameter("op") == null) { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = 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; } else { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = 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; } } } %> <% if (shouldShowFirstForm == true) { %>

    Property & Casualty Quote Request:
    General Information
    Company Name: ">
    Name (First, Last): ">">
    Address ">
      ">
    City/State/Zip ">">">
    Phone "> Fax ">
    E-Mail Address ">

    Building Information
    Number of Locations:

    Protection - Please check all that apply
    value="ON"> Burglar Alarm value="ON"> Guards/Watchmen
    value="ON"> Fire Sprinklers value="ON"> Fire Standpipes
    value="ON"> Fire CO2/Halon Systems    

    Please Note any Special Considerations

    Remarks:

    <% } if (shouldShowSecondForm == true) { int numLocs = Integer.parseInt(request.getParameter("bussinessNumberLocations"), 10); %>
    You have indicated that you are seeking insurance for <% out.print(numLocs) %> locations. In order to expedite the quotation process, we ask that you fill in the following information for each location. However, if you wish to send us information for each location in another manner, simply leave these fields blank and continue to the next section.
    <% for(int i = 0; i < numLocs; 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(" Building Information for Building " + (i + 1) + ""); out.println("
    Subject of Insurance:BuildingLimit:$
    Construction of Building:"); out.println(" "); out.println(" Deductible:$
    Number of Floors:Square Foot:  
    Year Built:  
    (if older than 20 years please fill Updated Info. below)
    "); 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("
    Building Update Information - Approximate Year Last Done
    Wire:Roof:
    Electrical:Plumbing:
    "); out.println("

    "); } %>
    <% for (int i = 0; i < param_info.length; i++) { out.println(""); } %> <% } if (shouldShowThirdForm == true) { StringBuffer msgBasetext = new StringBuffer(); msgBasetext.append("From\n--------------------------------------------------------------------------------\nCompany Name : " + request.getParameter("companyName") + "\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 Locations : " + request.getParameter("bussinessNumberLocations") + "\n\n"); if (request.getParameter("burglarAlarm").equals("on") || request.getParameter("guardsWatchmen").equals("on") || request.getParameter("fireSprinklers").equals("on") || request.getParameter("fireStandpipes").equals("on") || request.getParameter("fireCO2HalonSystems").equals("on")) { msgBasetext.append("\nProtection\n--------------------------------------------------------------------------------\n"); if (request.getParameter("burglarAlarm").equals("on")) { msgBasetext.append("Burglar Alarm\n"); } if (request.getParameter("guardsWatchmen").equals("on")) { msgBasetext.append("Guards/Watchmen\n"); } if (request.getParameter("fireSprinklers").equals("on")) { msgBasetext.append("Fire Sprinklers\n"); } if (request.getParameter("fireStandpipes").equals("on")) { msgBasetext.append("Fire Standpipes\n"); } if (request.getParameter("fireCO2HalonSystems").equals("on")) { msgBasetext.append("Fire/CO2/Halon Systems\n"); } msgBasetext.append("\n"); } if (!request.getParameter("SpecialConsideration").equals("")) { msgBasetext.append("\nSpecial Consideration\n--------------------------------------------------------------------------------\n"); msgBasetext.append(request.getParameter("SpecialConsideration")); } if (!request.getParameter("remarks").equals("")) { msgBasetext.append("\nRemarks\n--------------------------------------------------------------------------------\n"); msgBasetext.append(request.getParameter("remarks")); } int numLocs = Integer.parseInt(request.getParameter("bussinessNumberLocations"), 10); for(int i = 0; i < numLocs; i++) { if (!(((request.getParameter("buildingLimit" + i) == null) || (request.getParameter("buildingLimit" + i).length() == 0)) && ((request.getParameter("buildingConstructionBuilding" + i) == null) || (request.getParameter("buildingConstructionBuilding" + i).length() == 0)) && ((request.getParameter("buildingDeductible" + i) == null) || (request.getParameter("buildingDeductible" + i).length() == 0)) && ((request.getParameter("buildingSquareFoot" + i) == null) || (request.getParameter("buildingSquareFoot" + i).length() == 0)) && ((request.getParameter("buildingNumberFloors" + i) == null) || (request.getParameter("buildingNumberFloors" + i).length() == 0)) && ((request.getParameter("buildingYearBuilt" + i) == null) || (request.getParameter("buildingYearBuilt" + i).length() == 0)))) { msgBasetext.append("Information For Location " + (i + 1) + "\n--------------------------------------------------------------------------------\n"); msgBasetext.append(" Limit :" + request.getParameter("buildingLimit" + i) + "\n"); msgBasetext.append(" Construction Building :" + request.getParameter("buildingConstructionBuilding" + i) + "\n"); msgBasetext.append(" Deductible :" + request.getParameter("buildingDeductible" + i) + "\n"); msgBasetext.append(" Square Foot :" + request.getParameter("buildingSquareFoot" + i) + "\n"); msgBasetext.append(" Number Floors :" + request.getParameter("buildingNumberFloors" + i) + "\n"); msgBasetext.append(" Year Built :" + request.getParameter("buildingYearBuilt" + i) + "\n"); } } String mailhost = "couchnt03.couchbraunsdorf.com"; String msgfrom = request.getParameter("firstName") + " " + request.getParameter("lastName") + " <" + request.getParameter("email") + ">"; String msgto = "commercial@couchbraunsdorf.com"; String msgcc = null; String msgbcc = "info@couchbraunsdorf.com"; String msgsubject = "Commercial Property 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 = "commercial@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 Commerical 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" %>