/**
 * Fichier : bonus.js
 * Description : fonctions JS spécifiques aux bonus
 * Auteur : Hamza Iqbal - hiqbal[at]actualys.com
 * Copyright: Actualys
 ******************************************/

/**
 * Initialisation
 ******************************************/
$(document).ready( function()
{
	if($('#toutes_recettes').size())
	{
		carrouselListeRecettes();
		//switchRecette();
	}

        if($('#liste_jeux_full').size()) rolloverJeux();

        //if($('#liste_exclus_full') && !$('#liste_exclus_full').hasClass('exclu_big')) rolloverExclus();
        //if($('#liste_exclus_full') && $('#liste_exclus_full').hasClass('exclu_big')) rolloverExclusBig();

});

/**
 * Carrousel liste de recettes
 ******************************************/
var carrouselListeRecettes = function()
{
	$('#liste_recettes').jcarousel({scroll: 1});
}

/**
 * Changement de recette en AJAX
 ******************************************/
var switchRecette = function()
{
	var recettes = $('#liste_recettes li a');
	
	recettes.click(function()
	{
		var id_recette = $(this).next().attr('value');
		
		//Traîtement AJAX pour rechargement recette
		//alert("Recette n° "+id_recette);
		
		return false;
	});
}

/**
 * Rollover jeux
 ******************************************/
var rolloverJeux = function()
{
	var jeux = $('#liste_jeux_full .jeu');

	var largeur_init = jeux.css("width");
	var top_init = jeux.css("top");

	var largeur_fin = "217px";
	var top_fin = "0px";

	jeux.hover
	(
		function () { $(this).animate({ width: largeur_fin, top : top_fin }, 300 ); },
		function () { $(this).animate({ width: largeur_init, top : top_init }, 300 ); }
	);
}

/**
 * Rollover exclus
 ******************************************/
var rolloverExclus = function()
{
	var exclus = $('#liste_exclus_full .exclu');

	var largeur_init = exclus.css("width");
	var top_init = exclus.css("top");

	var largeur_fin = "272px";
	var top_fin = "15px";

	exclus.hover
	(
		function () { $(this).animate({ width: largeur_fin, top : top_fin }, 300 ); },
		function () { $(this).animate({ width: largeur_init, top : top_init }, 300 ); }
	);
}

var rolloverExclusBig = function()
{
	var exclus = $('#liste_exclus_full .exclu');

	var largeur_init = exclus.css("width");
	var top_init = exclus.css("top");

	var largeur_fin = "400px";
	var top_fin = "18px";

	exclus.hover
	(
		function () { $(this).animate({ width: largeur_fin, top : top_fin }, 300 ); },
		function () { $(this).animate({ width: largeur_init, top : top_init }, 300 ); }
	);
}