// Fade In Rappel
//======================================================================================================================
$(document).ready(function(){
	$(".btn_rappel").hover(
	function() {
	$(this).stop().animate({"opacity": "0"}, "slow");
	},
	function() {
	$(this).stop().animate({"opacity": "1"}, "slow");
	})
});


// Custom Scrollbar
//======================================================================================================================
$(window).load(function() {
	mCustomScrollbars();
});

function mCustomScrollbars(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#mcs_container").mCustomScrollbar("vertical",300,"easeOutCirc",1.05,"auto","yes","yes",15); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#"+id+" .customScrollBox .content").load(file,function(){
		mCustomScrollbars();
	});
}


// Fancybox
//======================================================================================================================
$(document).ready(function() {
	$("#rappel_fancybox").fancybox({
		'width'				: 400,
		'height'			: 170,
		'autoScale'			: false,
		'transitionIn'	    : 'elastic',
		'transitionOut'	    : 'elastic',
		'type'				: 'iframe'
	});
});


// Carousel Partenaires
//======================================================================================================================
$(document).ready(function()
{
	$('#carousel').elastislide({
	imageW  : 150,
	minItems : 4,
	current     : 0,
	margin : 20
	});
});


// Zebra table
//======================================================================================================================
$(document).ready(function()
{
	$(".zebra tr").mouseover(function(){$(this).addClass("over");}).mouseout(function(){$(this).removeClass("over");});
	$(".zebra tr:even").addClass("alt");
});


// Tabs
//======================================================================================================================
$(document).ready(function()
{
	$("#tabs").tabs();
});


// Qtip
//======================================================================================================================
$(document).ready(function()
{
   // Match all <A/> links with a title tag and use it as the content (default).
   $('a[title]').qtip({style: {classes: 'ui-tooltip-green ui-tooltip-shadow'},position: {my: 'left center'}});
   $('img[title]').qtip({style: {classes: 'ui-tooltip-tipsy ui-tooltip-shadow'},position: {my: 'right center',at: 'left center'}});
   $('.tooltip').qtip({style: {classes: 'ui-tooltip-green ui-tooltip-shadow'},position: {my: 'left center',at: 'right center'}});
});


 // Agrandissement auto textarea
 //======================================================================================================================
$(document).ready(function()
{
	$('textarea').elastic();
});
