<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">


<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <link href="styles.css" type="text/css" rel="stylesheet"/>
            <title><h:outputText value="#{msgs.title}"/></title>
            
        </head>
        <body>
            <div class="container">
                <div class="banner">
                    <h:outputText value="#{msgs.headerEx5}"
                                  styleClass="bannerText"/>
                </div>
                <hr/>
                
                <h:outputText value="#{msgs.informationPrompt}"
                              styleClass="heading"  />
                <h:form id="form">
                    <h:panelGrid columns="2">
                        <h:outputText value="#{msgs.ex2Zip}"/>
                        
                        <h:inputText id="zip" size="5" value="#{zipBean.zip}" maxlength="5">
                            <a4j:support event="onfocus"
                                         actionListener="#{zipBean.clearCityAndState}"
                                         reRender="city, state"/>
                            
                            <a4j:support event="onblur"
                                         actionListener="#{zipBean.setCityAndStateForZip}"
                                         reRender="city, state" 
                                        
                                         />
                        </h:inputText>
                        
                        <h:outputText value="#{msgs.ex2City}"/>
                        <h:inputText id="city"  value="#{zipBean.city}"/>
                        
                        <h:outputText value="#{msgs.ex2Country}"/>
                        <h:inputText id="state"  value="#{zipBean.state}"/>
                        
                        
                        <h:commandButton id="submit"
                                         value="#{msgs.submitButtonText}"
                                         action="showRes"/>
                        <h:commandButton value="#{msgs.button1Ex2}" action="nazad"/>               
                        
                    </h:panelGrid>
                    
                </h:form>
                <br/>
                <div class="footer">&copy;2008 Šerić Ivan</div>
            </div>
        </body>
    </html>
</f:view>