function invisible()
{
	//setTimeout('document.getElementById("id_visible").style.visibility="hidden"',3000);
}
function mise_jour_page(){}
function quelle_touche(evenement)
{
	var touche = window.event ? evenement.keyCode : evenement.which;
	var ancienne_id = document.getElementById('onDrop').value;
	var max = document.getElementById('countTabs').value;
	if(touche==37)
	{
		if(ancienne_id>1)
		{
			afficherLOnglet();
		}
	}
	else if(touche==39)
	{
		if(ancienne_id<max)
		{
			afficherROnglet();
		}
	}
}
function sendComment(){
	$.ajax({
   		type: "POST",
   		url: "comments.php",
   		cache: false,
   		data: "nbNews=" + $("#nbNews").val() + 
			  "&name=" + escape($("#name").val()) +
			  "&courieail=" + escape($("#courieail").val()) +
			  "&comment=" + escape($("#comment").val()) +
			  "&captcha=" + escape($("#capt").val()),
   		success: function(msg){
			if(msg == "captcha") {
				alert("Captcha non valide, recommencez");
			} else {
				$("#aRemplirAJAX").html("<p>Commentaire envoy&eacute;. L'administrateur du site a choisi de valider chaque commentaire. Votre commentaire appara&icirc;tra sur le site apr&egrave;s validation.<p>");
			}
		}
	});
}

$(document).ready(function(){
	$('.slider_news').BasicSlider({
		speed : 8000,
		nbslide : 1,
		auto : true,
		autodelay : 0,
		mode : 'horizontal',
		navigation : false,
		showtitle : false,
		fixtitle : false,
		pagination : false,
		limit : false,
		fadereturn : true
	});
	$("#texte1").css("display", "block");
});

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
    target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
    target.style.MozUserSelect="none"
else //All other route (ie: Opera)
    target.onmousedown=function(){return false}
}

$(document).ready(function(){
	disableSelection(document.getElementById("cadreTexte"));
});

/**
 *
 * @access public
 * @return void
 **/
function changeHeightDroppable(){
	var divHeight;
	var obj = document.getElementById('cadreTexte');
	if(obj.offsetHeight)          {divHeight=obj.offsetHeight;}
	else if(obj.style.pixelHeight){divHeight=obj.style.pixelHeight;}

	divHeight = divHeight + 50;
	heightD = divHeight.toString() + "px";
	document.getElementById("leftD").style.height = heightD;
	document.getElementById("rightD").style.height = heightD;
}


$(function() {
	$("#macaron").hover(
		function(){
			$("#macaron").effect("pulsate", {times : 1}, 400);
		},
		function(){
		}
	);
});

/**
 *
 * @access public
 * @return void
 **/
function galleryShowHide(etat){
	if(etat == 'open') {
		$("#cadreTexte").animate({
			marginTop:"-630px"}, 500, function(){ $("#cadrePhotoJava").css("display", "none"); });
		$("#gallerySH").attr("onClick", "galleryShowHide('closed')");
		$("#gallerySH").attr("src", "img/down.png");
	}
	if(etat == 'closed') {
		$("#cadreTexte").animate({
			marginTop:"-475px"}, 500);
		$("#cadrePhotoJava").css("display", "inline");
		$("#gallerySH").attr("onClick", "galleryShowHide('open')");
		$("#gallerySH").attr("src", "img/up.png");
	}
}

$(function() {
            $('#menu > li').hover(
                function () {
                    var $this = $(this);
                    $('a',$this).stop(true,true).animate({
                            'bottom':'-45px'
                        }, 300);
                    $('i',$this).stop(true,true).animate({
                            'top':'-40px'
                        }, 400);
                },
                function () {
                    var $this = $(this);
                    $('a',$this).stop(true,true).animate({
                            'bottom':'-110px'
                        }, 300);
                    $('i',$this).stop(true,true).animate({
                            'top':'40px'
                        }, 400);
                }
            );
        });

/*
 * AfficherXOnglet(): c'est ici quie l'id de page est changée
 */
function afficherLOnglet() {
	var id = $("#onDrop").attr("value");
	id = parseInt(id);
	var cadreTexteAff = "#texte" + (id-1);
	var cadreTexteAct = "#texte" + id;
	$("#cadreTexte").hide("drop",{ direction: "right" }, function() {
		$(cadreTexteAct).hide();
		if((id-1) == 1) {
			$("#rightD").css("display", "none");
			$("#onDrop").attr("value",(id-1));
		} else {
			$("#onDrop").attr("value",(id-1));
		}
		if($("#leftD").css("display") == "none") {
			$("#leftD").css("display", "inline");
		}
		$(cadreTexteAff).show();
		$("#cadreTexte").show("drop", function(){
			changeHeightDroppable();
		});
		mise_jour_page();
	});
	return false;
}

function afficherROnglet() {
	var id = $("#onDrop").attr("value");
	id = parseInt(id);
	var cadreTexteAff = "#texte" + (id+1);
	var cadreTexteAct = "#texte" + id;
	$("#cadreTexte").hide("drop", { direction: "left" }, function() {
		$(cadreTexteAct).hide();
		if((id+1) == $("#countTabs").attr("value")) {
			$("#leftD").css("display", "none");
			$("#onDrop").attr("value",(id+1));
		} else {
			$("#onDrop").attr("value",(id+1));
		}
		if($("#rightD").css("display") == "none") {
			$("#rightD").css("display", "inline");
		}
		$(cadreTexteAff).show();
		$("#cadreTexte").show("drop", { direction: "right" }, function(){
			changeHeightDroppable();
		});
		mise_jour_page();
	});
	return false;
}

$(function() {
	$("#cadreTexte").draggable({ axis: 'x', revert: true });
	$("#rightD").droppable({
		greedy: true,
		tolerance: 'touch',
		over: function(event, ui){
			afficherLOnglet();
		}
	});
	$("#leftD").droppable({
		tolerance: 'touch',
		greedy: true,
		over: function(event, ui){
			afficherROnglet();
		}
	});
});

$(document).ready(function(){
	/* The following code is executed once the DOM is loaded */

	$('.sponsorFlip').bind("click",function(){

		// $(this) point to the clicked .sponsorFlip element (caching it in elem for speed):

		var elem = $(this);

		// data('flipped') is a flag we set when we flip the element:

		if(elem.data('flipped'))
		{
			// If the element has already been flipped, use the revertFlip method
			// defined by the plug-in to revert to the default state automatically:

			elem.revertFlip();

			// Unsetting the flag:
			elem.data('flipped',false)
		}
		else
		{
			// Using the flip method defined by the plugin:

			elem.flip({
				direction:'lr',
				speed: 350,
				onBefore: function(){
					// Insert the contents of the .sponsorData div (hidden from view with display:none)
					// into the clicked .sponsorFlip div before the flipping animation starts:

					elem.html(elem.siblings('.sponsorData').html());
				}
			});

			// Setting the flag:
			elem.data('flipped',true);
		}
	});

});



