window.addEvent('domready', function(){
	
	var showme = [];
	var showme_height = [];
	var clickShow = [];
	var clickShow_el = [];
	$$('.showme').each(function(el,i){
		
	showme_height[i]=el.getStyle('height').toInt();	
	
	if(el.hasClass('current'))
	showme[i] = new Fx.Styles(el, {duration:300, wait:false}).set({'margin-top':-5});
	else
	showme[i] = new Fx.Styles(el, {duration:300, wait:false}).set({'height':0,'opacity':0,'margin-top':-10});
	
	el.addEvent('mouseenter',function(){
				clickShow[i].start({'opacity':0,'height':0});
				showme[i].start({'height':showme_height[i],'opacity':1});						
	});
	
	el.addEvent('mouseleave',function(){
	
				clickShow[i].start({'opacity':1,'height':40});
				showme[i].start({'height':0,'opacity':0});							
			});	
	
});
	
	
	$$('.clickShow').each(function(el,i){

	if(el.hasClass('current'))
	clickShow[i]=new Fx.Styles(el, {duration:100, wait:false}).set({'opacity':0,'height':0});	
	else
	clickShow[i]=new Fx.Styles(el, {duration:100, wait:false}).set({'margin-top':10});
	
	el.addEvent('mouseenter',function(){
	
				clickShow[i].start({'opacity':0,'height':0});
				showme[i].start({'height':showme_height[i],'opacity':1});
			});
	el.addEvent('mouseleave',function(){
	
				clickShow[i].start({'opacity':1,'height':40});
				showme[i].start({'height':0,'opacity':0});							
			});
			
});

if($('tracking_url'))
{
	/*alert($('tracking_url').value);*/
	 /* window.opener.focus($('tracking_url'));*/
	/* window.open($('tracking_url').value,'_blank') */
	   	popunder = window.open($('tracking_url').value);	
	popunder.blur()

}	
if($('recherche_onglet'))
{
	var myreq = new Ajax;
	
	var jx_response = new Fx.Styles('jx_response', {duration:200, wait:false}).set({'opacity':1,'left':($('recherche_onglet').getLeft()-40),'top':$('recherche_onglet').getTop()});
	var searchtime;
	
	$('recherche_onglet').addEvent("keyup",function(e){
		clearTimeout(searchtime);
		myreq.cancel();
		
		if($('recherche_onglet').hasClass("promo"))
			var item_search="promo";
		else
			var item_search="marchand";
		
	
		jx_response.start({'opacity':0});
		 
		
		searchtime = setTimeout(function(){
			
			var element=[];
			
			var args = Object.toQueryString({ajax:"true",type_search:item_search,search:$('recherche_onglet').value});
			
			
			if($('recherche_onglet').value!="")
			myreq = new Ajax("/ajax_server.php", {	method: 'post',postBody: args,	update: $('jx_response'),onCancel:function(){ clearTimeout(searchtime) }, 
			onComplete:function(){
				  
				jx_response.start({'opacity':1});
				var timer=0;
				$$('#jx_response ul li').each(function(el,i){
				element[i]= new Fx.Styles(el, {duration:200, wait:false}).set({'opacity':0,'padding-left':10,'margin-left':5});
					timer+=100;
					fx = function(){element[i].start({'opacity':0.9,'margin-left':0,'padding-left':5})}.delay(timer);
					el.addEvent("mouseenter",function(e){element[i].start({'margin-left':5,'padding-left':10,'color':'ffffff','background-color':'dce2e4','opacity':1})  });
					el.addEvent("mouseleave",function(e){element[i].start({'margin-left':0,'padding-left':5,'color':'55190b','background-color':'ffffff','opacity':0.9})  });
					
					});
				
				
				}
			
			}).request();
			
		
			  },600);

	});
	
	
	
}


/*
var menulink = [];

$$('.rose ul li').each(function(el,i){
	
		menulink[i] = new Fx.Styles(el, {duration:200, wait:false});

		el.addEvent('mouseenter',function(){
	
				
				menulink[i].start({'background-color':'e76afa'});
			});
	el.addEvent('mouseleave',function(){
	
				menulink[i].start({'background-color':'004251'});
			});
	
});
*/







/* domready*/
});