Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1865)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1866)
@@ -696,5 +696,63 @@
 			
 };
-		
+	
+function findValueValue(e) {
+	var i = $('.focused','#searchclauselist').closest('.sc-i').attr("id");
+	var j = $('.focused','#searchclauselist').closest('.sc-j').attr("id");
+	//alert(i+ ',' + j + sValue);
+	var termsetitem = $('#' + 'sc' +  i + '-' + j).find('.value-input').data('item');
+	var termset = "";
+	if (termsetitem != null) termset = termsetitem.key;
+	searchclauseset.searchclauses[i][j].value = e.value;
+	
+}
+ 
+function selectItemValue(li) {
+	findValueValue(li);
+}
+
+function initValueAutocomplete(i,j,index, term_index){
+	
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').autocomplete({
+		source: element_autocomplete[index].data[term_index].values,
+		autoFill:true,
+		width:150,
+		minLength: 0,
+		matchContains:true,
+		delay: 0,
+		select: function( event, ui ) {
+			$(this).data("item", ui.item);
+			selectItemValue(ui.item);
+		}
+	}).data( "autocomplete" )._renderItem = function( ul, item ) { 
+		var t, re;
+		if (this.term == ""){
+			t = item.value;
+		} else {
+			re = new RegExp(this.term + "+") ; 
+		    t = item.value.replace(re,"<span style='font-weight:bold;color:Blue;'>" +  
+		            this.term +  
+		            "</span>"); 
+		}
+		
+	    return $( "<li></li>" ) 
+	        .data( "item.autocomplete", item ) 
+	        .append( "<a>" + t + "</a>" ) 
+	        .appendTo( ul ); 
+	};
+
+	
+	// reset the index value
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').val("");
+	searchclauseset.searchclauses[i][j].value = "";
+	$('#' + 'sc' +  i + '-' + j).find('.value-input').show();
+	$('body').find('.ac_results').css({'z-index' : '1000'});
+	
+	
+	$('.focused','#searchclauselist').find('.value-input').focus();
+
+	
+};
+
 function findValueTerm(e) {
 			
@@ -709,5 +767,31 @@
 			searchclauseset.searchclauses[i][j].index = termset + ":" +  e.value;
 			
-			//handleTermsSelection(i,j,sValue);		
+			//handleTermsSelection(i,j,sValue);	
+			//find element value
+			var index;
+			$.each(element_autocomplete,function(i, item){
+				if (this.key == elem.key){
+					index = i;
+					return;
+				}
+			});
+			var term_index;
+			$.each(element_autocomplete[index],function(i, item){
+				if (this.key == e.key){
+					term_index = i;
+					return;
+				}
+			});
+			if (element_autocomplete[index].data[term_index].values.length == 0){
+			jQuery.get(link('fcs','?operation=scan&scanClause=' + e.value),function(data){
+				$(data).find('sru:term').each(function(i){
+					element_autocomplete[index].data[term_index].values[i] = {label:$(this).find('sru:value').text()};
+				});
+				initValueAutocomplete(i,j, index, term_index);
+				});
+			} else {
+				initValueAutocomplete(i,j, index, term_index);
+			}
+			
 			
 }
@@ -716,5 +800,4 @@
 			findValueTerm(li);
 		}
-
 
 function initTermsetAutocomplete(i,j,index){
@@ -752,5 +835,5 @@
 	        .append( "<a>" + t + "</a>" ) 
 	        .appendTo( ul ); 
-};
+	};
 
 	
@@ -805,5 +888,5 @@
 		jQuery.get(link('smc','list/?context=' + element_autocomplete[index].key),function(data){
 			$(data).find('Term').each(function(i){
-				element_autocomplete[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).attr("concept-id") };
+				element_autocomplete[index].data[i] = {label:$(this).text(), value:$(this).text(), id:$(this).attr("concept-id"),values:[] };
 			});
 			initTermsetAutocomplete(i,j, index);
Index: MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/FCSAction.java
===================================================================
--- MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/FCSAction.java	(revision 1865)
+++ MDService2/branches/MDService_simple3/src/eu/clarin/cmdi/mdservice/action/FCSAction.java	(revision 1866)
@@ -35,4 +35,5 @@
 import eu.clarin.cmdi.mdservice.model.WorkspaceProfile;
 import eu.clarin.cmdi.mdservice.proxy.FCSProxy;
+import eu.clarin.cmdi.mdservice.proxy.LocalProxy;
 import eu.clarin.cmdi.mdservice.proxy.MDRepoProxy;
 import eu.clarin.cmdi.mdservice.proxy.Pz2Proxy;
@@ -93,5 +94,9 @@
 
 	@Override
-	public String getFullFormat() {		
+	public String getFullFormat() {	
+		//TODO how to get around ??
+		if (getActionkey().equals("static")){
+			return getActionkey() +  "2" + getFormat(); 
+		}
 		return getActionkey() + getOperation() + "2" + getFormat();
 	}
@@ -142,4 +147,12 @@
 		// set defaults
 		
+		if ((getParam("operation").equals("")) && (getParam("query").equals(""))){
+			addParam("operation","explain");
+		}
+		if ( (getParam("operation").equals("explain")) && (getParam("query").equals(""))){
+			addParam("q", "explain");
+			//TODO how to get around ?
+			this.setActionkey("static");
+		}
 			if (params.get("x-context") != null){
 				
@@ -195,7 +208,14 @@
 		//TODO case scan,explain
 		
-		if ((getRepository().equals("")) && (getParam("operation").equals("scan"))){
-			setTargetProxy(new WorkspaceProxy());
-	    	return;
+		if (getRepository().equals("")){
+			if ((getParam("operation").equals("scan")) && (getParam("scanClause").equals("fcs.resource"))){
+				setTargetProxy(new WorkspaceProxy());
+		    	return;
+			}
+			if (getParam("operation").equals("explain")){
+				setTargetProxy(new LocalProxy());
+		    	return;
+			}
+		
 		}
 		
