function display()
{
	
	this.updateMain = function(p5service, parameters)
	{
		updateDivContent('main_content', p5service, parameters);
	}
	
	this.hello = function()
	{
		this.updateMain('display', 'action=hello');
	}
	
	this.addFilter = function(filter, filterBy, documentID)
	{
		this.updateMain('display', 'action=addFilter&filter='+filter+'&filterBy='+filterBy+'&documentID='+documentID);
	}
	
	this.addSelectorFilter = function(filterLine, documentID)
	{
		this.updateMain('display', 'action=addFilter'+filterLine+'&documentID='+documentID);
	}
	
	this.checkMail = function(mail)
	{
		updateDivContent('emailCheck', 'display', 'action=checkMail&mail='+mail);
		
	}
  
  this.resetFilter = function(documentID)
  {
    this.updateMain('display', 'action=addFilter&reset_filter=1&documentID='+documentID);
  }
	
}

ObjDisplay = new display();

// menu functions
function wfover(el){
	// get the first next ul
	var u = el.getElementsByTagName('ul');
	if(u.length == 0) return;
	u = u[0];
	// set the display of the ul to block;
	u.style.display = 'block';
}

function wfout(el){
	// get the first next ul
	var u = el.getElementsByTagName('ul');
	if(u.length == 0) return;
	u = u[0];
	// set the display of the ul to none;
	u.style.display = 'none';

}

var searchTimeout;

function searchWhileTyping(){
	clearTimeout(searchTimeout);
	var text = $('searchInput').value;

	/*if(text.length == 0){
		hideSearch();
		return false;	
	}*/

	if(text.length < 2){
		hideSearch();
		return false;
	}
		
	searchTimeout = setTimeout(searchGO, 200);
}

function searchGO(){

	var text = $('searchInput').value;

	if(text.length < 2){
		hideSearch();
		return false;
	}
	updateDivContent('searchResults', 'display', '&action=search&searchText='+text);


//	submitForm("searchForm", "searchResults", "afficheArticle", "&action=search");
	showSearch();
	return false;
}
function showSearch(){
	$('searchResultsContainer').style.display = 'block';
}

function hideSearch(){
		$('searchResultsContainer').style.display = 'none';
}