function search() {

	testo = document.getElementById("searchField").value.replace(/^\s+|\s+$/g,"");
	
	if( testo.length < 3) {
	
		alert("Attenzione inserire almeno una parola di 3 caratteri");
		return false;	
	}
	
	re = /'/gi;
	//'
	
	vecStr = testo.split(' ');
	newText = '';
	
	temp = '';
	oldKey = '';

	for( i = 0; i < vecStr.length; i++) {
	
		cond = true;

		if( vecStr[i] == 'and') {
			if( oldKey == 'and' || oldKey == 'or' || oldKey == 'not')
				cond = false;
			else 
				cond = true;
		}

		if( vecStr[i] == 'or') {
			if( oldKey == 'and' || oldKey == 'or' || oldKey == 'not')
				cond = false;
			else 
				cond = true;
		}

		if( vecStr[i] == 'not') {
			if( oldKey == 'or' || oldKey == 'not')
				cond = false;
			else 
				cond = true;
		}
	
		if( cond) {
		
		  if( vecStr[i] == 'and' || vecStr[i] == 'or' || vecStr[i] == 'not') {
		  
		  	if( temp.length > 0) {
		  	  if(  vecStr[i] == 'not' && oldKey != 'and')
			       newText += '"' + temp + '" and ' + vecStr[i] + ' ';
			    else
			       newText += '"' + temp + '" ' + vecStr[i] + ' ';
			  }
			  else
			    newText += vecStr[i] + ' ';

			  temp = '';
		  }
		   else {
		   
			    temp += vecStr[i] + ' ' ;
			 }

		  oldKey = vecStr[i];
		}
	}

	if( temp.length > 0)
		newText += '" ' + temp + ' "';	
		
	document.getElementById("searchText").value = newText;
	document.getElementById("orignalText").value = testo;
	document.getElementById("searchForm").action = '/client/ricerca.aspx?r=1&amp;_search_=' + document.getElementById("searchField").value;
	//document.getElementById("searchForm").action = '/client/ricerca.aspx?r=1&amp;_search_=' + newText;
	document.getElementById("searchForm").submit();
	
}