Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/ExpansionState.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/ExpansionState.java	(revision 4601)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/pojo/ExpansionState.java	(revision 4601)
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2014 CLARIN
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package eu.clarin.cmdi.vlo.pojo;
+
+/**
+ *
+ * @author twagoo
+ */
+public enum ExpansionState {
+
+    EXPANDED,
+    COLLAPSED
+}
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.html
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.html	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.html	(revision 4601)
@@ -24,4 +24,6 @@
     <body>
         <wicket:panel>
+            <a wicket:id="expand" class="expandfacet"><span>expand</span></a>
+            <a wicket:id="collapse" class="collapsefacet"><span>collapse</span></a>
             <wicket:container wicket:id="facetValues" />
             <wicket:container wicket:id="facetSelection" />
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.java	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetPanel.java	(revision 4601)
@@ -17,4 +17,5 @@
 package eu.clarin.cmdi.vlo.wicket.components;
 
+import eu.clarin.cmdi.vlo.pojo.ExpansionState;
 import eu.clarin.cmdi.vlo.pojo.FacetSelection;
 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
@@ -22,7 +23,12 @@
 import java.util.HashSet;
 import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.wicket.AttributeModifier;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
+import org.apache.wicket.markup.html.link.Link;
 import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.AbstractReadOnlyModel;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
 import org.apache.wicket.model.PropertyModel;
 
@@ -41,8 +47,10 @@
     private final SelectedFacetPanel selectedFacetPanel;
     private final FacetValuesPanel facetValuesPanel;
+    private final IModel<ExpansionState> expansionStateModel;
 
-    public FacetPanel(String id, IModel<FacetSelection> model) {
+    public FacetPanel(String id, IModel<FacetSelection> model, IModel<ExpansionState> expansionState) {
         super(id, model);
         this.model = model;
+        this.expansionStateModel = expansionState;
 
         // panel showing values for selection
@@ -53,4 +61,50 @@
         selectedFacetPanel = createSelectedFacetPanel("facetSelection");
         add(selectedFacetPanel);
+
+        addExpansionComponents();
+    }
+
+    private void addExpansionComponents() {
+
+        // class modifier to apply correct class depending on state
+        add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() {
+
+            @Override
+            public String getObject() {
+                switch (expansionStateModel.getObject()) {
+                    case COLLAPSED:
+                        return "facet collapsedfacet";
+                    case EXPANDED:
+                        return "facet expandedfacet";
+                    default:
+                        return "facet";
+                }
+            }
+        }));
+
+        // add expansion link
+        add(new AjaxFallbackLink("expand") {
+
+            @Override
+            public void onClick(AjaxRequestTarget target) {
+                expansionStateModel.setObject(ExpansionState.EXPANDED);
+                if (target != null) {
+                    target.add(FacetPanel.this);
+                }
+            }
+        });
+
+        // add collapse link
+        add(new AjaxFallbackLink("collapse") {
+
+            @Override
+            public void onClick(AjaxRequestTarget target) {
+                expansionStateModel.setObject(ExpansionState.COLLAPSED);
+                if (target != null) {
+                    target.add(FacetPanel.this);
+                }
+            }
+        });
+        setOutputMarkupId(true);
     }
 
@@ -68,7 +122,8 @@
             @Override
             public void onValuesSelected(String facet, Collection<String> value, AjaxRequestTarget target) {
-                // A value has been selected on this facet's panel,
-                // update the model!
+                // A value has been selected on this facet's panel, update the model!
                 model.getObject().getSelection().selectValues(facet, value);
+                // collapse after selection
+                expansionStateModel.setObject(ExpansionState.COLLAPSED);
                 if (target != null) {
                     // reload entire page for now
@@ -90,4 +145,6 @@
                 // Update model
                 selection.selectValues(facet, newSelection);
+                // collapse after removal
+                expansionStateModel.setObject(ExpansionState.COLLAPSED);
                 if (target != null) {
                     // reload entire page for now
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetValuesPanel.html
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetValuesPanel.html	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetValuesPanel.html	(revision 4601)
@@ -24,6 +24,4 @@
     <body>
         <wicket:panel>
-            <a href="#" class="expandfacet"><span>expand</span></a>
-            <a href="#" class="collapsefacet"><span>collapse</span></a>
             <h1><a href="#"><wicket:container wicket:id="name">[TITLE]</wicket:container></a></h1>
             <a href class="filtertoggle"><span>filter</span></a>
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.html
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.html	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.html	(revision 4601)
@@ -32,5 +32,5 @@
                 </p>
                 <wicket:container wicket:id="facets">
-                    <div class="facet collapsedfacet" wicket:id="facet">[facet]</div>
+                    <div wicket:id="facet">[facet]</div>
                 </wicket:container>
                 <!-- rounded corners - bottom **** -->
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.java	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/FacetsPanel.java	(revision 4601)
@@ -17,7 +17,11 @@
 package eu.clarin.cmdi.vlo.wicket.components;
 
+import eu.clarin.cmdi.vlo.pojo.ExpansionState;
 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
+import eu.clarin.cmdi.vlo.wicket.model.FacetExpansionStateModel;
 import eu.clarin.cmdi.vlo.wicket.model.FacetSelectionModel;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import org.apache.solr.client.solrj.response.FacetField;
 import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -26,4 +30,5 @@
 import org.apache.wicket.markup.html.panel.Panel;
 import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.util.MapModel;
 
 /**
@@ -47,12 +52,17 @@
     public FacetsPanel(final String id, final IModel<List<FacetField>> facetsModel, final IModel<QueryFacetsSelection> selectionModel) {
         super(id, selectionModel);
-
+        
+        final Map<String, ExpansionState> expansionStateMap = new HashMap<String, ExpansionState>();
+        final MapModel<String, ExpansionState> expansionModel = new MapModel<String, ExpansionState>(expansionStateMap);
+        
         add(new ListView<FacetField>("facets", facetsModel) {
-
+            
             @Override
             protected void populateItem(ListItem<FacetField> item) {
                 item.add(
-                        new FacetPanel("facet", new FacetSelectionModel(item.getModel(), selectionModel)) {
-
+                        new FacetPanel("facet",
+                                new FacetSelectionModel(item.getModel(), selectionModel),
+                                new FacetExpansionStateModel(item.getModel(), expansionModel)) {
+                            
                             @Override
                             protected void selectionChanged(AjaxRequestTarget target) {
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SelectedFacetPanel.html
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SelectedFacetPanel.html	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/components/SelectedFacetPanel.html	(revision 4601)
@@ -24,6 +24,4 @@
     <body>
         <wicket:panel>
-            <a href="#" class="expandfacet"><span>expand</span></a>
-            <a href="#" class="collapsefacet"><span>collapse</span></a>
             <h1><a href="#"><wicket:container wicket:id="facet">[TITLE]</wicket:container></a></h1>
             <div wicket:id="facetValueRemover" class="selectedvaluelabel">
@@ -35,6 +33,6 @@
             <div class="sbilinks facetvalues">
                 <ul>
-                    <li><span class="selectedfacetvalue">Dutch</span><a class="unselectfacetvalue" title="unselect value" href="index2.html"><span>[unselect]</span></a></li>
-                    <li><span class="facetvalue">English</span></li>
+                    <li><span class="selectedfacetvalue">ITEM</span><a class="unselectfacetvalue" title="unselect value" href="index2.html"><span>[unselect]</span></a></li>
+<!--                    <li><span class="facetvalue">English</span></li>
                     <li><span class="facetvalue">German</span></li>
                     <li><span class="facetvalue">French</span></li>
@@ -43,5 +41,5 @@
                     <li><span class="facetvalue">Japanese</span></li>
                     <li><span class="facetvalue">Turkish</span></li>
-                    <li><span class="facetvalue">Chinese</span></li>
+                    <li><span class="facetvalue">Chinese</span></li>-->
                     <!--<li class="more-link"><a href="#">more...</a></li>-->
                 </ul>
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/FacetExpansionStateModel.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/FacetExpansionStateModel.java	(revision 4601)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/model/FacetExpansionStateModel.java	(revision 4601)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2014 CLARIN
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package eu.clarin.cmdi.vlo.wicket.model;
+
+import eu.clarin.cmdi.vlo.pojo.ExpansionState;
+import java.util.Map;
+import org.apache.solr.client.solrj.response.FacetField;
+import org.apache.wicket.model.IModel;
+
+/**
+ * Expansion state model that looks up expansion state in a map with facet
+ * name as key
+ *
+ * @author twagoo
+ */
+public class FacetExpansionStateModel implements IModel<ExpansionState> {
+
+    private final IModel<FacetField> facetModel;
+    private final IModel<Map<String, ExpansionState>> expansionStateMapModel;
+
+    /**
+     * 
+     * @param facetModel model that holds the current facet
+     * @param expansionStateMapModel model that holds the map of expansion states
+     */
+    public FacetExpansionStateModel(IModel<FacetField> facetModel, IModel<Map<String, ExpansionState>> expansionStateMapModel) {
+        this.facetModel = facetModel;
+        this.expansionStateMapModel = expansionStateMapModel;
+    }
+
+    @Override
+    public ExpansionState getObject() {
+        final String facet = facetModel.getObject().getName();
+        final ExpansionState state = expansionStateMapModel.getObject().get(facet);
+        if (state == null) {
+            return ExpansionState.COLLAPSED;
+        } else {
+            return state;
+        }
+    }
+
+    @Override
+    public void setObject(ExpansionState object) {
+        final String facet = facetModel.getObject().getName();
+        final ExpansionState state = expansionStateMapModel.getObject().put(facet, object);
+    }
+
+    @Override
+    public void detach() {
+    }
+
+}
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.html
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.html	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.html	(revision 4601)
@@ -62,5 +62,5 @@
             </div>
 
-            <div class="facet collapsedfacet topbar" id="collections">
+            <div class="topbar" id="collections">
                 <div class="rtop"><div class="r1"></div><div class="r2"></div><div class="r3"></div><div class="r4"></div></div>
                 <div wicket:id="collectionsFacet">[COLLECTIONS]</div>
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.java
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.java	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/java/eu/clarin/cmdi/vlo/wicket/pages/FacetedSearchPage.java	(revision 4601)
@@ -2,4 +2,5 @@
 
 import eu.clarin.cmdi.vlo.config.VloConfig;
+import eu.clarin.cmdi.vlo.pojo.ExpansionState;
 import eu.clarin.cmdi.vlo.wicket.components.FacetsPanel;
 import eu.clarin.cmdi.vlo.pojo.QueryFacetsSelection;
@@ -63,5 +64,5 @@
         final FacetFieldModel collectionFacetFieldModel = new FacetFieldModel(facetFieldsService, vloConfig.getCollectionFacet(), queryModel);
         final FacetSelectionModel collectionSelectionModel = new FacetSelectionModel(collectionFacetFieldModel, queryModel);
-        final FacetPanel panel = new FacetPanel(id, collectionSelectionModel) {
+        final FacetPanel panel = new FacetPanel(id, collectionSelectionModel, new Model<ExpansionState>(ExpansionState.COLLAPSED)) {
 
             @Override
Index: /vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/js/vlo-facets.js
===================================================================
--- /vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/js/vlo-facets.js	(revision 4600)
+++ /vlo/branches/vlo-3.0/vlo-web-app/src/main/webapp/js/vlo-facets.js	(revision 4601)
@@ -16,89 +16,89 @@
  */
 
-function expandFacet(p) {
-    p.find(".facetvalues").show(200);
-    p.addClass("expandedfacet");
-    p.removeClass("collapsedfacet");
-    p.find(".filterform input").focus();
-}
-
-function collapseFacet(p) {
-    p.find(".facetvalues").hide(200);
-    p.addClass("collapsedfacet");
-    p.removeClass("expandedfacet");
-}
-
-$(document).ready(function() {
-    /* facet collapse/expand */
-    $("a.expandfacet, a#showvalues").click(function(event) {
-        event.preventDefault();
-        var p = $(this).parents(".collapsedfacet");
-        expandFacet(p);
-    });
-    $("a.collapsefacet").click(function(event) {
-        event.preventDefault();
-        var p = $(this).parents(".expandedfacet");
-        collapseFacet(p);
-    });
-
-    $(".facet h1 a").click(function(event) {
-        event.preventDefault();
-        if ($(this).parents(".expandedfacet").length === 1) {
-            var p = $(this).parents(".expandedfacet");
-            collapseFacet(p);
-        } else {
-            var p = $(this).parents(".collapsedfacet");
-            expandFacet(p);
-        }
-    });
-
-    /* facet filter */
-//    $(".filterform").hide();
+//function expandFacet(p) {
+//    p.find(".facetvalues").show(200);
+//    p.addClass("expandedfacet");
+//    p.removeClass("collapsedfacet");
+//    p.find(".filterform input").focus();
+//}
 //
-//    $("a.filtertoggle").click(function(event) {
-//        // toggle link clicked, show or hide filter box and focus on input
+//function collapseFacet(p) {
+//    p.find(".facetvalues").hide(200);
+//    p.addClass("collapsedfacet");
+//    p.removeClass("expandedfacet");
+//}
+//
+//$(document).ready(function() {
+//    /* facet collapse/expand */
+//    $("a.expandfacet, a#showvalues").click(function(event) {
 //        event.preventDefault();
-//        var form = $(this).parent(".facet").find(".filterform");
-//        form.siblings(".facetvalues").find("li").show();
-//        expandFacet($(this).parent(".collapsedfacet"));
-//        form.toggle(100, function(event) {
-//            var input = form.children("input");
-//            input.val('');
-//            input.focus();
-//        });
+//        var p = $(this).parents(".collapsedfacet");
+//        expandFacet(p);
 //    });
-
-    var filterHandler = function(event) {
-        // filter text entered, update result list
-        var links = $(this).parents(".filterform").siblings(".facetvalues").find("li");
-        var match = $(this).val().toUpperCase();
-        if (match.length === 0) {
-            links.show();
-        } else {
-            // hide all results
-            links.hide();
-            // show all matching results
-            links.filter(function(index) {
-                // case insensitive match
-                return links[index].textContent.toUpperCase().indexOf(match) >= 0;
-            }).show();
-        }
-    };
-
-    $(".filterform input").on('input', filterHandler);
-
-    /* Facet values popup */
-
-    $(".more-link").click(function(event) {
-        event.preventDefault();
-        $("#facetvalues").toggle();
-        var name = $(this).parents(".facet").find("h1").text();
-        $("#facetvalues h2").text(name);
-        $(window).scrollTop($('#facetvalues').position().top);
-    });
-
-    $("#facetvalues a").click(function(event) {
-        event.preventDefault();
-        $("#facetvalues").toggle();
-    });
-});
+//    $("a.collapsefacet").click(function(event) {
+//        event.preventDefault();
+//        var p = $(this).parents(".expandedfacet");
+//        collapseFacet(p);
+//    });
+//
+//    $(".facet h1 a").click(function(event) {
+//        event.preventDefault();
+//        if ($(this).parents(".expandedfacet").length === 1) {
+//            var p = $(this).parents(".expandedfacet");
+//            collapseFacet(p);
+//        } else {
+//            var p = $(this).parents(".collapsedfacet");
+//            expandFacet(p);
+//        }
+//    });
+//
+//    /* facet filter */
+////    $(".filterform").hide();
+////
+////    $("a.filtertoggle").click(function(event) {
+////        // toggle link clicked, show or hide filter box and focus on input
+////        event.preventDefault();
+////        var form = $(this).parent(".facet").find(".filterform");
+////        form.siblings(".facetvalues").find("li").show();
+////        expandFacet($(this).parent(".collapsedfacet"));
+////        form.toggle(100, function(event) {
+////            var input = form.children("input");
+////            input.val('');
+////            input.focus();
+////        });
+////    });
+//
+//    var filterHandler = function(event) {
+//        // filter text entered, update result list
+//        var links = $(this).parents(".filterform").siblings(".facetvalues").find("li");
+//        var match = $(this).val().toUpperCase();
+//        if (match.length === 0) {
+//            links.show();
+//        } else {
+//            // hide all results
+//            links.hide();
+//            // show all matching results
+//            links.filter(function(index) {
+//                // case insensitive match
+//                return links[index].textContent.toUpperCase().indexOf(match) >= 0;
+//            }).show();
+//        }
+//    };
+//
+//    $(".filterform input").on('input', filterHandler);
+//
+//    /* Facet values popup */
+//
+//    $(".more-link").click(function(event) {
+//        event.preventDefault();
+//        $("#facetvalues").toggle();
+//        var name = $(this).parents(".facet").find("h1").text();
+//        $("#facetvalues h2").text(name);
+//        $(window).scrollTop($('#facetvalues').position().top);
+//    });
+//
+//    $("#facetvalues a").click(function(event) {
+//        event.preventDefault();
+//        $("#facetvalues").toggle();
+//    });
+//});
