<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
    $(document).ready(function() {
        var contentNewHeight = $("#models").height() + $("#modelsParams").height();
        $("#content").css("height", contentNewHeight);

        $("#deviceTypes").change(function() {
            var selectedModel = $("#deviceTypes option:selected").val();
            if (selectedModel == "") {

                $("#modelsParams").html(null);
                $("#modelsParams").height(0);
                    //set new height to content
                $("#content").css("height", $("#models").height() + $("#modelsParams").height()+150);

            } else {
                $.ajax({
                    url: "viewModelParams.action",
                    data:{
                        selectedModel:selectedModel
                    },
                    type:"post",
                    success:function(data) {
                        $("#modelsParams").html(null);
                        $("#modelsParams").height(500);
                        $("#modelsParams").html(data);
                        //set new height to content
                            $("#content").css("height", $("#models").height() + $("#modelsParams").height()+150);

                    }
                });
            }

        });

        $("#saveDefaults").live("click", function() {
            var model = $("#deviceTypes option:selected").val();

        });
    });
</script>
<style type="text/css">
    #modelsParams {
        width: 950px !important;
        margin-left: 30px;
        float: left;
        display: block;
        height: 0px;
    }

    #models {
        width: 200px;
        margin-left: 30px;
        float: left;
        height: 40px;
    }

</style>
<div style="with:980px;text-align:center;margin-top: 55px;margin-bottom: 30px;font-size: 22px;font-style: italic;">
    <s:text name="label.settingDefaultParam"/>
</div>
<div id="nnn" style="display: block; width: 980px;margin-top: 0px;float: left;">
    <div id="models">
        <s:text name="label.models"/> :
        <s:select list="deviceModels" listKey="modelId" listValue="name" headerKey="" headerValue="--Select Models--"
                  id="deviceTypes" name="deviceModels"/>
    </div>
    <div id="sessionMessage">
        <s:if test="%{#session.actionMessage!=null}">
            <s:property value="#session.actionMessage"/>
        </s:if>
    </div>
    <div id="modelsParams"></div>
</div>
<input type="hidden" name="forSetDefParams">
