// Espace adhérents
//======================================================================================================================
$(function() {

	$( "#dialog_adherents" ).dialog({
		autoOpen: false,
		height: 220,
		width: 370,
		modal: true,
		resizable: false
	});

	$( "#dialog_adherents_link" ).click(function() {
		$( "#dialog_adherents" ).dialog( "open" );
		return false;
	});
});

// Fix big draggable object IE9
//======================================================================================================================
(function($){var a=$.ui.mouse.prototype._mouseMove;$.ui.mouse.prototype._mouseMove=function(b){b.button=1;a.apply(this,[b]);}}(jQuery));


// Coda Slider
//======================================================================================================================
$(document).ready(function(){
	$('#coda-slider').codaSlider({
	autoSlide: true,
    autoSlideInterval: 7000,
	firstPanelToLoad: 1,
	dynamicArrows: false
	});
});


// Navigation menu
//======================================================================================================================
$(document).ready(function()
{
	$('ul#navigation').superfish({
		delay:       1000,
		animation:   {opacity:'show',height:'show'},
		speed:       'fast',
		autoArrows:  true,
		dropShadows: false
	});

	$('ul#navigation li').hover(function(){
		$(this).addClass('sfHover2');
	},
	function(){
		$(this).removeClass('sfHover2');
	});
});


// Dashboard
//======================================================================================================================
$(document).ready(function() {

	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");

	});

	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");
	});

	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});

});

// Moteur de recherche
//======================================================================================================================
$(function() {

	$( "#dialog_search" ).dialog({
		autoOpen: false,
		height: 100,
		width: 370,
		modal: true,
		resizable: false
	});

	$( "#dialog_search_link" ).click(function() {
		$( "#dialog_search" ).dialog( "open" );
		return false;
	});
});


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

 // Preview
 //======================================================================================================================
$(document).ready(function()
{
	$(".preview").thumbPopup();
});


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


 // Afficher une partie des mailto dans les tables
 //======================================================================================================================
$(document).ready(function()
{
	$("#corps_part_gauche table a[href^='mailto:']").addClass("mailto");
});


// Fleche Newsletter
//======================================================================================================================
$(document).ready(function(){
	$('#newsletter input[type=submit]')				
	.mouseover(function()
	{
		$(this).stop().animate({backgroundPosition:"(35px 0px)"},{duration:200})
	})
	.mouseout(function()
	{
		$(this).stop().animate({backgroundPosition:"(0px 0px)"},{duration:200})
	})
});


// 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-blue ui-tooltip-shadow'},position: {my: 'left center',at: 'bottom right'}});
   $('span[title]').qtip();
   $('input[type=checkbox].[title]').qtip();
});

// Fix taille Content & Sidebar + Fix taille #conteneur_page
//======================================================================================================================
$(document).ready( function () {
	$(".content").css("min-height", function(){ return $(".sidebar").height() });
} );


// Stars Vote
//======================================================================================================================
$(document).ready( function () {
	$("#stars").stars({
	captionEl: $("#stars-cap")
	});
} );

