window.addEvent("domready", function(){			
	if(Browser.Engine.trident){
		$$(".textfield").each(function(el){
			el.removeClass("rounded");
		});
	}
	DD_roundies.addRule('.resbtn', 10, true);		
	DD_roundies.addRule('.rounded', 5, true);		
	if(!Browser.Engine.trident ){
		DD_roundies.addRule('fieldset', 5, true);
		DD_roundies.addRule('.small-rounded-top', '3 3 0 0', true);		
	}
	else{		
		DD_roundies.addRule('.top_zone', '3 3 0 0', true);	
	}	
	DD_roundies.addRule('.rounded-top', '5 5 0 0', true);
	DD_roundies.addRule('.rounded-bottom', '0 0 5 5', true);	
	DD_roundies.addRule('.small-rounded-bottom', '0 0 3 3', true);	
	
	if($('tooltip')){
		var myTips = new Tips($('tooltip'),{
			className :"tooltip"
		});
		$('tooltip').store('tip:title', 'Vous êtes client ou un professionnel,'); 
		$('tooltip').store('tip:text', 'connectez-vous maintenant grâce à ce formulaire.');
	
		myTips.addEvent('onShow', function(tip){
			if(!tip.hasClass("rounded"))
				tip.addClass("rounded");
			tip.fade('in');
		});
		myTips.addEvent('onHide', function(tip){
			tip.fade('out');
		});
	}
	if(Browser.Engine.trident){
		Cufon.now();	
	}
	Cufon.replace('h1.eras'); 	
	Cufon.replace('h2.eras');
	Cufon.replace('h3.eras');
	Cufon.replace('h4.eras');
	Cufon.replace('h5.eras');
	Cufon.replace('h6.eras');
	Cufon.replace('span.eras');
	
	if($("mask")){
		var columns = $$('div.step');
		var max_height = 0;	
		columns.each(function(item){ 
			max_height = Math.max(max_height, item.getSize().y); 
		});	
		columns.setStyle('height', max_height);
		$("mask").setStyle("height",max_height);
	}	
	if($('banners-top') && $$('div#banners-top div.banner').length > 1){
		var topSlide = new SlideItMoo({
			itemsVisible:1,
			showControls:0,
			autoSlide:delay,
			currentElement: 0,
			thumbs:'div#banners-top div.banner',
			transition: Fx.Transitions.Expo.easeOut,
			thumbsContainer: 'banners-top',
			elementScrolled: 'banner-container-top',
			overallContainer: 'banners-container-top'
		});
	}
	if($('banners-bottom') && $$('div#banners-bottom div.banner').length > 1){
		var topSlide = new SlideItMoo({
			itemsVisible:1,
			showControls:0,
			autoSlide:delay,
			useAnchors:false,
			currentElement: 0,
			transition: Fx.Transitions.Expo.easeOut,
			thumbs:'div#banners-bottom div.banner',
			thumbsContainer: 'banners-bottom',
			elementScrolled: 'banner-container-bottom',
			overallContainer: 'banners-container-bottom'
		});
	}
	if($('banners-right') && $$('div#banners-right div.banner').length > 1){
		var topSlide = new SlideItMoo({
			itemsVisible:1,
			showControls:0,
			autoSlide:delay,
			useAnchors:false,
			currentElement: 0,
			transition: Fx.Transitions.Expo.easeOut,
			thumbs:'div#banners-right div.banner',
			thumbsContainer: 'banners-right',
			elementScrolled: 'banner-container-right',
			overallContainer: 'banners-container-right'
		});
	}
	
	if($("login-form")){
		new FormCheck("login-form");
	}
	if($("newsletter-form")){
		var nform = new FormCheckGroup("newsletter-form");
		$('nlbtn').addEvent("click", function(e){		
			new Event(e).stop();
			var isValid = nform.checkGroup('nl',e);			
			if(isValid){
				var xhr = new Request.HTML({
					url:$("newsletter-form").getProperty("action"),
					update :$('response'),
					onSuccess:function(){
						$('nl-mask').setStyles({display:'none'});
					},
					onRequest:function(){				
						$('nl-mask').setStyles({
							display:'block',
							opacity:0.6
						});				
					}
				}).post($('newsletter-form'));
			}
		});
	}
	if($("contact-form")){
		new FormCheck("contact-form");					
	}	
	if($("backend-form")){
		new FormCheck("backend-form");					
	}		
	if($("friend_form")){
		new FormCheck("friend_form");					
	}
	
	if($('form-container')){
		$('form-container').addEvent("click",function(){
			if($("dlg")){
				$("dlg").dispose();
			}
		});				
	}
	
});


