window.addEvent('domready', function(){

    $('SearchForm_SearchForm_Search').addEvents({
	    'focus': function(){ 
	        if (this.value == 'rechercher' ) 
	            this.value = '';
	        }, 
	    'blur': function(){
	        if (!this.value)
	            this.value = '';
	        }
	    //'keydown': function(event){ if (event.key == 'enter') submitLogin() }
    }); 

  var accordion = new Accordion('h4.atStart', 'div.atStart', {
    opacity: true,
    display : -1,
    onActive: function(toggler, element){
	    toggler.setStyle('color', '#ffffff');
    },

    onBackground: function(toggler, element){
	    toggler.setStyle('color', '#ffffff');
    }
  }, $('accordion'));
  var current_index = -1;
	$$('h4.atStart').each(function(element, index){
		
		element.addEvent('mouseover',function(){
			accordion.display(index);
		});
	});

      $$('div.atStart').each(function(element, index){
			
			element.getElements('a').each(function(el){
			       
			    if (el.hasClass('current'))
			    {
			        current_index = index;
			        element.addClass('current_category');
			    }
			    else
			    {
			        if(element.hasClass('current_category'))
			        {
			            current_index = index;
			        }
			    }
			});
		});
    if(current_index > -1)
    {        	
    	accordion.display(current_index);
    }    
});

//depliage news   
function news(id, div)
{
 if ($(id).style.display=='none')
 {
    $(id).setStyle('display', 'block');
    $(div).setStyle('background','#F9F9F9 url(caplarge/images/deplier.gif) no-repeat center left');
 }
 else
 {
   if ($(id).style.display=='')
   {
    $(id).setStyle('display', 'block');
    $(div).setStyle('background','#F9F9F9 url(caplarge/images/fleche.gif) no-repeat center left');
   }
   else
   {
    $(id).setStyle('display', 'none');    		        
    $(div).setStyle('background','#F9F9F9 url(caplarge/images/fleche.gif) no-repeat center left');
   }
 }
}
