Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js	(revision 1559)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_model.js	(revision 1561)
@@ -206,10 +206,10 @@
 @class Represents a Query. 
 */ 
-function Query(collection, columns, query , squery) {
+function Query(collection, columns, query) {
 	this.id = 0;
 	this.collection = collection;   // []
 	this.columns = columns;         // string
 	this.query = query;	         //sctext
-	this.squery = squery;
+	//this.squery = squery;
 	this.listid = "";
 	this.container = {};
@@ -313,4 +313,5 @@
 		this.query = json["querystring"];	
 	}
+	/*
 	if (json["squerystring"] == "[NULL]"){
 		this.squery = null;
@@ -318,4 +319,5 @@
 		this.squery = json["squerystring"];	
 	}
+	*/
 	this.columns = columns_text;
 	
@@ -444,6 +446,6 @@
 	//	params = params + "q=" + escape(this.query) + "&";
 	//}
-	if (this.squery != null) {
-		escaped_sq =escape(this.squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;
+	if (this.query != null) {
+		escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;
 		escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B"); 
 		//params = params + "squery=" + escaped_sq + "&";
@@ -463,14 +465,16 @@
 	var params = "?operation=searchRetrieve&version=1.2&";
 	var q = "";
+	/*
 	if (this.query != null) {
 		q = "( "  + escape(this.query) + " )";
 	}
-	if (this.squery != null) {
-		escaped_sq =escape(this.squery).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;
+	*/
+	if (this.query != null) {
+		escaped_sq =escape(this.query).replace(/%20/g,"%2520").replace(/\%2[27]/g,"%2522") ;
 		escaped_sq = escaped_sq.replace(/%7C/g,"%257C").replace(/\+/g,"%2B"); 
-		if (q.length > 0){
+		/*if (q.length > 0){
 			q = q + " and ";
-		}
-		q = q + escaped_sq;
+		}*/
+		q =  escaped_sq;
 	}
 	params = params + "query=" + q + "&x-cmd-collections=" + this.getcollectiontext("index") + 
@@ -483,5 +487,5 @@
 	var str = "";
 	var coll = (this.getcollectiontext("name") != "" ) ? " in " + this.getcollectiontext("name") : "";
-	str = Query.queryliststring(this.squery, this.query) + coll + " @" + this.repository.toString();
+	str = Query.simplequerystring(this.query) + coll + " @" + this.repository.toString();
 	return str;
 };
@@ -551,5 +555,5 @@
 	var jsonq = {"id":this.id,
 				 "name":"",
-			     "squerystring":this.squery, 
+			     //"squerystring":this.squery, 
 				 "querystring":this.query,	
 				 "searchclauses":"null" ,
@@ -643,17 +647,19 @@
 Query.fullformatstring = function (json) {
 	var qs = json.querystring;
-	var sqs = json.squerystring;
+	//var sqs = json.squerystring;
 	
 	if (qs == "[NULL]") {
 		qs = null;
 	}
+	/*
 	if (sqs == "[NULL]") {
 		sqs = null;
 	}
+	*/
 	var collection_text = Query.collectiontext(json);
 	
 	var full_str = "";
 	var len = formatquerystring_len;
-	
+	/*
 	if (sqs != null) {
 		if (sqs.length > len){
@@ -664,4 +670,5 @@
 		}
 	}
+	*/
 	if (qs != null) {
 		qs = Query.simplequerystring(qs);
@@ -681,5 +688,5 @@
 	return full_str;
 };
-
+/*
 Query.queryliststring = function(squery, query) {
 	var s_squery = "";
@@ -702,5 +709,5 @@
 	return str;
 };
-
+*/
 Query.simplequerystring = function (querystring) {
 
@@ -831,5 +838,6 @@
 		}
 	 */
-	 	var jsonq = {"squerystring":this.squery, "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
+	 	//var jsonq = {"squerystring":this.squery, "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
+	 var jsonq = { "querystring":this.query, "searchclauses":"null" , "collections" : this.json_coll, "columns" : this.json_cols};
 
 		var uri = "?query=" + JSON.stringify(jsonq) + "&startItem=" + this.startItem + "&maximumItems=" + this.maximumItems;
@@ -1062,5 +1070,5 @@
 		
 	},
-
+/*
 	getsquery: function(qid) {
 		var qstring = "";
@@ -1076,4 +1084,5 @@
 		return qstring;
 	},
+	*/
 	getquerystring: function(qid) {
 		var qstring = "";
Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1559)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_searchclause.js	(revision 1561)
@@ -522,5 +522,5 @@
 				var n;
 				var scarr;
-				var rel;
+				var rel = "";
 				n = scstr.indexOf("=");
 				if (n > 0){
@@ -556,6 +556,7 @@
 				if (j > 0) {screl = "or";}
 				//notifyUser("scarr:" + scarr[0] + scarr[1],'debug');
+				
 				if (scarr == undefined) {
-					sc = new SearchClause('','','');
+					sc = new SearchClause('*','any',scstr);//sc = new SearchClause('','','');
 				} else {
 					sc = new SearchClause(scarr[0],rel,scarr[1]);
@@ -569,4 +570,8 @@
 	
 	// from searchclauses to querystring
+	simplequerytext: function(){
+		this.buildsctext();
+		return sctext.replace('* any ','');
+	},
 	buildsctext: function(){
 	   var uncompletequery = false;
@@ -580,8 +585,8 @@
 			for (var i = 0; i < this.searchclauses.length; i++) {
 				if ( i>0) this.sctext = this.sctext + " and ";
-				this.sctext = this.sctext + " ( ";
+				if (this.searchclauses.length> 1) this.sctext = this.sctext + " ( ";
 				for (var j = 0; j < this.searchclauses[i].length; j++) {
 					if ( j>0) this.sctext = this.sctext + " or ";
-					this.sctext = this.sctext + " ( ";
+					if (this.searchclauses[i].length > 1) this.sctext = this.sctext + " ( ";
 					ptext = this.searchclauses[i][j].PlainText();
 					if (ptext.length == 0){
@@ -589,7 +594,7 @@
 					}
 					this.sctext = this.sctext + ptext;
-					this.sctext = this.sctext + " ) ";
-				}
-				this.sctext = this.sctext + " ) ";
+					if (this.searchclauses[i].length > 1) this.sctext = this.sctext + " ) ";
+				}
+				if (this.searchclauses.length> 1) this.sctext = this.sctext + " ) ";
 			}
 			
Index: MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js	(revision 1559)
+++ MDService2/branches/MDService_simple3/WebContent/scripts/mdservice_ui.js	(revision 1561)
@@ -65,5 +65,5 @@
 		// autocomplete correction
 		searchclauseset.addsearchclause(new SearchClause("","",""),"",0,0);
-		createInfos();
+		//createInfos();
 		
 		detailcaller.calldetail(undefined, "info");
@@ -91,5 +91,10 @@
 
 }
-
+function getInputMode(){
+	if ($('#searchclauselist').is(":visible")){
+		return 'complex';
+	}
+	return 'simple';
+}
 /**
  * This function is called during the initialization sequence and binds event-handlers to events of ui-elements.
@@ -97,4 +102,20 @@
  */
 function addFunctionality(){
+	//TODO query-input action not valid (solve in html_snippets.xsl ?)
+	//$('#query-input').children("form").attr("id","searchretrieve");
+	
+	//switch the input simple query vs complex query
+	//$('#searchclauselist').hide();
+	$('#switch-input').live('click',function(){
+		$('#searchclauselist').toggle();
+		$('#input-simplequery').toggle();
+		if (getInputMode() == 'complex'){
+			searchclauseset.sctext = $('#input-simplequery').attr("value");
+			searchclauseset.buildfromquerystring();
+		} else {
+			$('#input-simplequery').attr("value",searchclauseset.simplequerytext());
+		}
+	});
+	
 	// DEL COMMAND
 	/*
@@ -253,11 +274,16 @@
 		event.preventDefault();
 		//hideWelcomeMessage();
-		searchclauseset.buildsctext();
-		notifyUser(searchclauseset.sctext,'debug');
-					
-		//submit_query (columns_widget.getColumnsListText(),searchclauseset.sctext, $('#input-simplequery').attr("value"), $('#input-withsummary').attr("checked"));
-		
-		var query = searchclauseset.sctext;
-		var squery = $('#input-simplequery').attr("value");
+		var query;
+		if (getInputMode() == 'complex'){
+			searchclauseset.buildsctext();
+			query = searchclauseset.sctext;
+		} else {
+			query = $('#input-simplequery').attr("value");
+		}
+		//searchclauseset.buildsctext();
+		//notifyUser(searchclauseset.sctext,'debug');				
+		//submit_query (columns_widget.getColumnsListText(),searchclauseset.sctext, $('#input-simplequery').attr("value"), $('#input-withsummary').attr("checked"));	
+		//var query = searchclauseset.sctext;
+		//var squery = $('#input-simplequery').attr("value");
 		// TODO we dont use columns-widget
 		var columns = "";//columns_widget.getColumnsListText();
@@ -270,9 +296,5 @@
 			query = null;
 		}
-		if (jQuery.trim(squery).length == 0){
-			squery = null;
-		}
-		
-		var q = new Query(collections, columns, query, squery); //actions.collections.current, query );
+		var q = new Query(collections, columns, query); //actions.collections.current, query );
 		q.repository = getSelectedRepository();
 		//if (ws) {
@@ -1045,19 +1067,26 @@
 	//TODO new params
 	var q = url["q"];
-	var squery = url["query"];//url["squery"];
+	if (url["query"] == undefined){
+		q = url["q"];
+	}
+	else {
+		q = url["query"];
+	}
+
+	//var squery = url["query"];//url["squery"];
 	var collection = url["collection"];
-	var startItem = url["startItem"];
-	var maximumItems = url["maximumItems"];
+	var startItem = url["startRecord"];
+	var maximumItems = url["maximumRecords"];
 	var repository = url["repository"];
 	var columns = url["columns"];
-	if ((q != undefined) || (squery != undefined) || (collection != undefined)) {
+	if ((q != undefined) || (collection != undefined)) {
 		if (q == undefined) {
 			q = "";
 		} else {
 			q = Url.decode(q);
-		}
+		}/*
 		if (squery == undefined) {
 			squery = "";
-		} 
+		} */
 		if (columns == undefined) {
 			columns = "";
@@ -1086,5 +1115,5 @@
 		}
 		
-		var query = new Query(collections, columns, q, squery);
+		var query = new Query(collections, columns, q);
 		query.startItem = startItem;
 		query.maximumItems = maximumItems;
Index: MDService2/branches/MDService_simple3/WebContent/style/cmds-ui.css
===================================================================
--- MDService2/branches/MDService_simple3/WebContent/style/cmds-ui.css	(revision 1559)
+++ MDService2/branches/MDService_simple3/WebContent/style/cmds-ui.css	(revision 1561)
@@ -112,5 +112,5 @@
 #input-simplequery { width: 85%; margin: 12px 0px 6px 0px; font-size: 1.2em;}
 #submit-query { font-size: 1.2em; font-weight: bold;}
-#searchclauselist {margin: 0px;}
+#searchclauselist {margin: 0px; display:none;}
 .searchclause {  }
 .and_level {border-top: 1px solid #9999cc; margin: 2px 0px;}
@@ -153,4 +153,6 @@
 
 .info div.example {border: 1px dashed #014172; background-color: #fafaff; font-family: "Courier New", monospaced; margin: 0.8em 0; padding: 4px; line-height: 1.2em}
+
+
 
 /* ************* */
Index: MDService2/branches/MDService_simple3/src/xsl/html_snippets.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/html_snippets.xsl	(revision 1559)
+++ MDService2/branches/MDService_simple3/src/xsl/html_snippets.xsl	(revision 1561)
@@ -20,5 +20,5 @@
 	<link href="{$base_dir}/style/cmds-ui.css" type="text/css" rel="stylesheet"></link>
 
-	<xsl:if test="contains($format,'jspage')">
+	<xsl:if test="contains($format,'htmljspage')">
 		<link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" />
 		<link href="{$base_dir}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link>
@@ -62,5 +62,13 @@
 		<div id="top-menu">
 				<div id="user">
-						<a href="{my:formURLparams($base_js_url, $q, $repository_name, $startRecord, $maximumRecords)}" > js </a>
+						<xsl:choose>
+						<xsl:when test="contains($format,'htmljspage')">
+							<a href="{my:formURLparams($base_url, $q, $repository_name, $startRecord, $maximumRecords)}" > none js </a>
+						</xsl:when>
+						<xsl:otherwise>
+							<a href="{my:formURLparams($base_js_url, $q, $repository_name, $startRecord, $maximumRecords)}" > js </a>
+						</xsl:otherwise>
+						</xsl:choose>
+						
 						<xsl:choose>
 							<xsl:when test="$user = ''" > 
@@ -88,7 +96,12 @@
 	 	<div class="header ui-widget-header ui-state-default ui-corner-top" ><span>Search</span></div>
 	 	<div class="content" id="query-input" >   	
-		 	<form action="{my:formURL('search', 'htmlpage','')}" method="get">							
-				<input type="text" id="input-simplequery" name="query" value="{$q}" />
-				<input type="submit"  value="submit" id="submit-query"/>
+		 	<form id="searchretrieve" action="{my:formURL('search', 'htmlpage','')}" method="get">	
+		 	<table class="cmds-ui-elem-stretch">
+		 	<tr>
+		 	<td><input type="text" id="input-simplequery" name="query" value="{$q}" class="queryinput active"/>
+				<div id="searchclauselist" class="queryinput inactive"/></td>
+		 	<td><input type="submit"  value="submit" id="submit-query"/></td>
+		 	</tr>
+		 	</table>
 				
 				<div> 
@@ -110,6 +123,6 @@
 					</td>
 					<td valign="top">
-						<label>Complex query</label><span name='detail_index' class='cmd cmd_detail'></span><br/>
-						<div id="searchclauselist"></div>							
+						<label>Complex query</label><span id="switch-input" name='detail_index' class='cmd'></span><br/>
+						<!--  <div id="searchclauselist"></div>-->							
 						<!--<input type="checkbox" checked="false" id="input-withsummary" name="WS"/><label>with Summary</label> 
 						 -->
Index: MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl
===================================================================
--- MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl	(revision 1559)
+++ MDService2/branches/MDService_simple3/src/xsl/mdset2view.xsl	(revision 1561)
@@ -86,5 +86,8 @@
 		<xsl:call-template name="header" />
 	</xsl:if>
- 	<xsl:call-template name="query-input" />
+	<xsl:if test="contains($format, 'page')">
+		<xsl:call-template name="query-input" />
+	</xsl:if>
+ 	
 	
 	<xsl:choose>
