$(document).ready(function(){
	$('#lang').hover(
		function(e){
			$('ul',this).slideDown('fast');
		},
		function(e){
			$('ul',this).hide();
		}
	);
	
	$('li[id|="btnSection"]').live('click',function(){
		var tonotdis = whichdisplay();
		var secwished = $(this).attr('id').substr(11,15);
		var position = $('#section-'+secwished).position();
		if(position.left!=0){
			$('#section-'+tonotdis).fadeOut('slow');
			$('#section-'+secwished).animate(
				{left: '-=580'},
				700,
				function(){
					$('#section-'+tonotdis).css('left','580px').css('z-index','2').show();
					$('#section-'+secwished).css('z-index','1')
				}
			);
			$('#btnSection-'+secwished).addClass('active');
			$('#btnSection-'+tonotdis).removeClass('active');
		
			
		}else{
			
		}
	});
	
	$('#email').focus(function(){
		if($(this).attr('value') == this.defaultValue) $(this).attr('value', '');
		}).blur(function(){
		if($.trim(this.value) == '') this.value = (this.defaultValue ? this.defaultValue : '');
		});	

	var country=window.location.pathname.substring(1,3);
	if(country!='us' && country!='fr' && country!='pt'){
		var url=window.location.pathname.substring(1,50);
		
	}else{
	var url=window.location.pathname.substring(4,50);
	}
	$('#lang a').each(function(){
		var oldhref=$(this).attr('href');
		var newhref=oldhref+url;
		$(this).attr('href',oldhref+url);
	});
	

});// JavaScript Document

function whichdisplay(){
	var thepost = $('#section-business').position();
	if(thepost.left==0){
		return 'business';
	}
	var thepost = $('#section-famille').position();
	if(thepost.left==0){
		return 'famille';
	}
	var thepost = $('#section-assistance').position();
	if(thepost.left==0){
		return 'assistance';
	}
	var thepost = $('#section-event').position();
	if(thepost.left==0){
		return 'event';
	}
	var thepost = $('#section-formation').position();
	if(thepost.left==0){
		return 'formation';
	}
	
}

