
$(document).ready(function() {

               /*effect on login_area*/
    if ($('.login_area span.error').length) {
      $('.login_area').css({width:"803", display:"block"});
    } else {
      $('.login_area').css({width:"0", display:"none"});
    }

	$('#menu-haut-espace-exposants').click(function(e) {
            if ($('#menu-haut-espace-exposants a').attr('href') == '/') {
                e.preventDefault();
		$('.login_area').animate({width: "803px"}, { queue:false, duration:1000 });
            }
	});

	$('.login_area .disconnect a').click(function(e) {
                e.preventDefault();
		$('.login_area').animate({width: "0"}, {
                  complete: function(){
                    jQuery(this).css({ display: 'none' });
                  }
                })
         });










	/*effect on menu */
	
	$('.page .menu li').mouseenter(function() {
		if ($(this).attr('class') == 'first') {
			$(this).children('ul').animate({height:"80px"}, { queue:false, duration:500 });
			$(this).children('a').css('border-right', '0');
		}
		else if($(this).attr('class') == 'second' || $(this).attr('class') == 'third') {
			$(this).children('ul').animate({height:"80px"}, { queue:false, duration:500 });
			$(this).children('a.main').css('border-right', '0');
			$('.page .menu li.first a.main').css('border-right', '0');

		}
		else if($(this).attr('class') == 'last') {
			$(this).children('ul').animate({height:"80px"}, { queue:false, duration:500 });
			$('.page .menu li.second a.main').css('border-right', '0');
		}
	
	$('.page .menu ul li ul li:nth-child(4)').css('border-right', '0px');
	$('.page .menu ul li ul li:nth-child(7)').css('border-right', '0px');
	
    });	
		
	$('.page .menu li.first').mouseleave(function() {	 
			$('.page .menu li.first ul').animate({height:"0px"}, { queue:false, duration:500 });
			$(this).children('a.main').css('border-right', '1px solid #e0f176');
	});
	$('.page .menu li.second').mouseleave(function() {	 
			$(this).children('ul').animate({height:"0px"}, { queue:false, duration:500 });
			$(this).children('a.main').css('border-right', '1px solid #e0f176');
			$('.page .menu li.first a.main').css('border-right', '1px solid #e0f176');

	});
        $('.page .menu li.third').mouseleave(function() {
			$(this).children('ul').animate({height:"0px"}, { queue:false, duration:500 });
			$(this).children('a.main').css('border-right', '1px solid #e0f176');
			$('.page .menu li.first a.main').css('border-right', '1px solid #e0f176');

	});
	$('.page .menu li.last').mouseleave(function() {	 
			$(this).children('ul').animate({height:"0px"}, { queue:false, duration:500 });
			$('.page .menu li.second a.main').css('border-right', '1px solid #e0f176');

	});

	
	/*effect on search form*/
	
	$('#submit').mouseenter(function() {
			$('.form').animate({width: "144px"}, { queue:false, duration:500 });
			$('.arrow_search').css({display: "block"});
			
    });	
		
		$('.search form').mouseleave(function() {	 
			$('.form').animate({width: "0"}, { queue:false, duration:500 });
			$('.arrow_search').css({display: "none"});
		});
		
		$('.arrow_search').mouseenter(function() {
			$('.form').animate({width: "0"}, { queue:false, duration:500 });
			
    });
	
	
	
		/*same height between left_content and right_content*/
	
		var sLeftHeight = parseInt($('.content .left_content').height());
		var sRightHeight = parseInt($('.content .right_content').height());
		
		var sBlockVisit = parseInt($('.content .visit').height() + 25); // 25px for padding-top/bottom .bg_left
		
		if($('.content .block_flash').length)	
			var sElementsRight = (parseInt($('.content .block_flash').height()) + parseInt($('.content .footer').height()));	
		else	
			var sElementsRight = parseInt($('.content .footer').height());
		
		
		
		if ((sLeftHeight < sRightHeight)) {
			$('.content .bg_left').css('height', (sRightHeight - sBlockVisit)+'px');  // -blockVisit for blockVisit's height
		}
		
		if ((sRightHeight < sLeftHeight)){
			$('.right_content .main_content').css('height', (sLeftHeight - sElementsRight - 127)+'px');  // -127 for element's padding-top/bottom 
		}
/* fancybox */
		$(".fancybox").fancybox({
	});

	



           

});


