$(document).ready(function()
{
	/**
	*	DISABLE HREF
	*/
	$('a[rel="modal"]').click(function(e)
	{
    	e.preventDefault();
	});
	
	/**
	*	MODAL
	*/
	$("a[rel='modal']").each(function(i)
	{
		var name = $(this).attr('title');
		$(this).qtip(
		{
			content: {
				title: {
					text: name,
					button: 'Close'
				},
				url: $(this).attr('href')
			},
			position: {
				target: $(document.body),
				corner: 'center'
			},
			show: {
				when: 'click',
				solo: true
			},
			hide: false,
			style: {
				width: { min: 500, max: 500 },
				padding: '14px',
				border: {
					width: 9,
					radius: 9,
					color: '#0d5891',
					opacity: 0.5
				},
				title: {
					color: '#ffffff',
					background: '#4a85cf'
				},
				color: 'black',
				background: '#ffffff'
			},
			api: {
				beforeShow: function()
				{
					$('#blanket').fadeIn(this.options.show.effect.length);
				},
				beforeHide: function()
				{
					$('#blanket').fadeOut(this.options.hide.effect.length);
				}
			}
		});
	});
	 $('<div id="blanket">').css(
	 {
         position: 'absolute',
         top: $(document).scrollTop(),
         left: 0,
         height: $(document).height(),
         width: '100%',

         opacity: 0.4,
         backgroundColor: 'white',
         zIndex: 5000
      })
      .appendTo(document.body)
      .hide();
	
	/**
	*	MENU
	*/
	$('#main-menu > li').hover(function()
	{
		$(this).find('ul:hidden').slideDown('fast');
	}, function()
	{
		$(this).find('ul').slideUp('fast');
	});


	/**
	*  SCROLL CITATIONS / TESTIMONIES
	*/
	 $('#quotations').cycle({
		fx: 'scrollUp',
		speed: 1000,
		timeout: 4500,
		pause: true
	});

	
	/**
	*  SCROLL SPONSORS
	*/  
	  $('.scroll').cycle({
		fx: 'scrollLeft',
		speed: 1000,
		timeout: 3000,
		pause: true
	}); 
	 
	 
	  /**
	 *	CYCLE IMAGE HOMEPAGE
	 */
	 $('#img_homepage').cycle();
	 
	 
	 
	 /**
	 *  POPUP FANCYBOX	 
	 */
	 
	$(".biographie").colorbox({
		scrolling		:	'no',
		autoDimensions	:	true,
		width			:	'50%'
		
	});
	
	/**
	* DOCK PRESENTATION	
	*/
	
	$('#dock_presentation').jqDock({
		align	:	'middle',
		size	:	100,
		distance:	200,
		coefficient :1
	});
	
	/**
	* RESA CONF COCKTAIL
	*/
	if ($("#hidden").css("display") == "block")
	{
		$("#guest_civility, #guest_first_name, #guest_last_name, #guest_position").addClass("validate[required]");
		$("#guest_email").addClass("validate[required,custom[email]]");
	}
	
	$("#affording").change(function()
	{
		$.validationEngine.closePrompt(".formError",true); 
		
		$("#hidden").slideToggle();
		
		if ($("#hidden").css("display") == "none")
		{
			$("#guest_civility").val("");
			$("#guest_first_name,#guest_last_name,#guest_position,#guest_email").attr("value", "");
			
			$("#guest_civility, #guest_first_name, #guest_last_name, #guest_position").removeClass();
			$("#guest_email").removeClass();
		}
		else
		{
			$("#guest_civility, #guest_first_name, #guest_last_name, #guest_position").addClass("validate[required]");
			$("#guest_email").addClass("validate[required,custom[email]]");
		}
	});
	
	$("#form_conf_cocktail").validationEngine(
	{		
		inlineValidation: false,
		unbindEngine: false
	});
	
	/**
	* INSCRITS
	*/
	$('#inscrits').dataTable(
	{
		"bSortClasses": false,
		"sPaginationType": "full_numbers",
		"iDisplayLength": 25
	});
	
});
