<%@ page info="ContentAreaPolicies" language="java" %> 
<%--
 ******************************************************************************* 
 * $RCSfile: AdvancedOptions.jsp,v $
 *
 * Description: 
 *
 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
 * Use of this product is subject to license terms.
 *
 *******************************************************************************
--%> 
<%@taglib uri="/WEB-INF/tld/com_iplanet_jato/jato.tld" prefix="jato"%> 
<%@taglib uri="/WEB-INF/tld/com_sun_web_ui/cc.tld" prefix="cc"%>
<%@taglib uri="/WEB-INF/apoc.tld" prefix="apoc"%>


<jato:pagelet>
    <jato:containerView name="AdvancedOptions">

    <script type="text/javascript" src="/apoc/js/MainWindow.js"></script>

    <script type="text/javascript">
    <!--
        function submitBrowse(entityId, entityType) {
            document.ProfileForm['ProfileWindow.TabContent.AdvancedOptions.GeneralEntityId'].value=entityId;
            document.ProfileForm['ProfileWindow.TabContent.AdvancedOptions.GeneralEntityType'].value=entityType;
            document.ProfileForm.action="../manager/ProfileWindow?ProfileWindow.TabContent.AdvancedOptions.RelocateButton=a";
            document.ProfileForm.submit();
        }

        function openBrowseTreeWindow() {
            openWindow(window, null, '/apoc/manager/BrowseTreeIndex?EntityId=<cc:text name="JSEntityId"/>&EntityType=<cc:text name="JSEntityType"/>&', 'TreeWindow', 500, 600, true); 
        }
         
    // -->
    </script> 

        <jato:content name="DisplayAlert">
            <div class="content-layout">
                <BR>
                <cc:alertinline name="Alert" bundleID="apocBundle"/>
                <BR>
                <!-- 
                    <cc:text name="StackTrace"/>
                -->
            </div>
        </jato:content>
 
        <cc:pagetitle name="PageTitle" bundleID="apocBundle"
            pageTitleText="APOC.profilewnd.advanced.tab" 
            showPageTitleSeparator="true"
            pageTitleHelpMessage="APOC.profilewnd.advanced.pagetitle_help"
            showPageButtonsTop="true"
            showPageButtonsBottom="false">

            <cc:propertysheet name="Properties" bundleID="apocBundle" showJumpLinks="false"/>
            
            <table width='100%' cellpadding='25' cellspaceing='0'><tr><td>
                <cc:orderablelist name="PrioritizationList" bundleID="apocBundle" label="APOC.profilewnd.advanced.merge_order"/>
            </td></tr></table>

        </cc:pagetitle>

        <cc:hidden name="GeneralEntityId" defaultValue="a" />
        <cc:hidden name="GeneralEntityType" defaultValue="" />

        <script type="text/javascript">
        <!--
            var oldListValue = "";
            
            function checkForChange() {
                var currentListValue = "";
                var orderedList = document.forms[0]['ProfileWindow.TabContent.AdvancedOptions.PrioritizationList.SelectedListBox'];
                for(i=0; i<orderedList.length; i++) {
                    currentListValue = currentListValue + orderedList.options[i].value;
                }
                if (oldListValue.length==0) {
                    oldListValue = currentListValue;
                } else {
                    if (oldListValue!=currentListValue) {
                        enableSaveButtons();
                        clearInterval(checkInterval);
                    }
                }
            }
            
            var bIsReadOnly = <cc:text name="JSReadOnly" />;
            
            if (bIsReadOnly) {
                document.forms[0]['ProfileWindow.TabContent.AdvancedOptions.PrioritizationList.SelectedListBox'].disabled=true;
                document.forms[0]['ProfileWindow.TabContent.AdvancedOptions.PrioritizationList.SelectedListBox'].className="LstDis";
            } else {
                var checkInterval = setInterval('checkForChange()',500);
            }

            document.ProfileForm.action="../manager/ProfileWindow?ProfileWindow.TabContent.AdvancedOptions.SaveButton=APOC.profilewnd.buttons.save";

            updateButtonsArea();
        // -->
        </script> 

    </jato:containerView>
</jato:pagelet>
