var Recherche = {

	fill: function(e) {
		var obj = Event.element(e);
		var paren = $($(obj).parentNode);
	
		while(paren && paren.tagName != "FORM")
			paren = $(paren.parentNode)
			
		childs = paren.descendants();
		for(q=0;q<childs.length;q++)
		{
			if(childs[q].tagName == "INPUT" && childs[q].name.indexOf("recherche_") != -1)
			{
				childs[q].value = '^' + obj.value;
				paren.submit();
				break;
			}
		}	
	},
	
	buttonBGoff: function(e) {
		var obj = Event.element(e);
		obj.setStyle({	
				backgroundPosition: '0px 0px',
				color: '#727272'
			});
	},
	
	buttonBGon: function(e) {
	
		var obj = Event.element(e);
		obj.setStyle({	
				backgroundPosition: '0px -14px',
				color: '#FFFFFF'
			});
	},
	
	formsEvent: function() {
		var forms = document.getElementsByTagName("FORM");
		var c = forms.length;
		var text = ""
		for(p=0;p<c;p++)
		{	
			input = null;		
			if(forms[p].parentNode.className.indexOf("recherche_input") != -1)
			{
				childs = forms[p].childNodes;
				for(q=0;q<childs.length;q++)
				{
					if(childs[q].tagName == "INPUT" && childs[q].name.indexOf("recherche_") != -1)
					{
						input = childs[q];
						
						next = input.nextSibling;
						
						while(next && (next.tagName != "DIV" || next.className != "touches"))
							next = next.nextSibling;					
						
						touches = next.childNodes;
						c2 = touches.length;
						
						for(r=0;r<c2;r++)
						{
							if(touches[r].tagName == "INPUT" && touches[r].className == "touche")
							{								
								$(touches[r]).observe('click', Recherche.fill.bindAsEventListener(Recherche));
								$(touches[r]).observe('mouseover', Recherche.buttonBGon.bindAsEventListener(Recherche));
								$(touches[r]).observe('mouseout', Recherche.buttonBGoff.bindAsEventListener(Recherche));					
							}
						}
						
					}
				}
			}			
		}	
	}


};

Event.observe(window, 'load',Recherche.formsEvent); 
