function animate_button(button)
{
	$(".button").mouseenter(function(){
                $("#"+$(this).attr('id')+" img")
        });
}

function open_overlay()
{
	$(".pilote_infos").overlay({
		expose: '#1f1f1f',
		effect: 'apple',
		onBeforeLoad: function() {
			// grab wrapper element inside content
			var wrap = this.getOverlay().find(".contentWrap");
			// load the page specified in the trigger
			wrap.load(this.getTrigger().attr("href"));
		}
	});
}
/*jQuery.fn.toggleText = function(a, b) {
  return this.each(function() {
    jQuery(this).text(jQuery(this).text() == a ? b : a);
});
};*/

$(document).ready(function(){
open_overlay() ;

$('#menu_bg').mousemove(function(e){
	    var x = e.pageX - this.offsetLeft;
        var y = e.pageY - this.offsetTop;
        var CenterOffset = (2000-x/6);
	$('#canvas').animate({
		    left: '-'+CenterOffset
	  }, 0, function() {
    // Animation complete.
  });

});

/*  $('.scroll160_content img').each(function() {
    var maxWidth = 50; // Max width for the image
    var maxHeight = 50;    // Max height for the image
    var ratio = 0;  // Used for aspect ratio
    var width = $(this).width();    // Current image width
    var height = $(this).height();  // Current image height

    // Check if the current width is larger than the max
    if(width > maxWidth){
        ratio = maxWidth / width;   // get ratio for scaling image
        $(this).css("width", maxWidth); // Set new width
        $(this).css("height", height * ratio);  // Scale height based on ratio
        height = height * ratio;    // Reset height to match scaled image
    }

    // Check if current height is larger than max
    if(height > maxHeight){
        ratio = maxHeight / height; // get ratio for scaling image
        $(this).css("height", maxHeight);   // Set new height
        $(this).css("width", width * ratio);    // Scale width based on ratio
        width = width * ratio;    // Reset width to match scaled image
    }
});*/

  /* $(".scroll160").scrollable({ circular: true }).click(function() {
	$(this).data("scrollable").next();		
   });*/
 
   $("#member_login_link").click(function(event){
     	$('#member_login_box').delay(200).slideToggle('slow');
   });
   $("#member_login_link_close").click(function(event){
     	$('#member_login_box').slideUp('fast',function(){$('#member_login_box_menu').delay(200).slideDown('slow');});
   });

   $("#member_toolbox_link").click(function(event) {
	$('#member_toolbox_box_menu').slideUp('fast',function(){$('#member_toolbox_box').delay(200).slideDown('slow');});
   }) ;
   
   $("#member_toolbox_link_close").click(function(event){
     	$('#member_toolbox_box').slideUp('fast',function(){$('#member_toolbox_box_menu').delay(200).slideDown('slow');});
   });

   /*$("#close_chat").click(function(event){


	$('#chat_express_div').slideToggle('fast',function(){
	$('#close_chat').toggleText('Open Chat express','Close Chat express');
	$('#main_content').animate({
		width:'890'
	},100);
	$('#menu_content1').animate({
		height:'20'
	},1);
	$('#menu_content').animate({
		height:'20'
	},1);
   });
});*/

/*   $("#zoom_in").click(function(event){
	$('#div_chat_msg').css("font-size","14px");
	$('#div_chat_msg').css("height","450px");
	$('#div_chat_msg').css("width","600px");
	$('#div_chat_login').css("font-size","14px");
	$('#div_chat_login').css("width","600px");
	$('#div_chat_titre').css("width","612px");
	$('#div_chat_add_msg').css("width","600px");
	$('#zoom_in').css("display","none");
	$('#zoom_out').css("display","block");
   });
   $("#zoom_out").click(function(event){
	$('#div_chat_msg').css("font-size","11px");
	$('#div_chat_msg').css("height","200px");
	$('#div_chat_msg').css("width","220px");
	$('#div_chat_login').css("font-size","12px");
	$('#div_chat_login').css("width","220px");
	$('#div_chat_titre').css("width","232px");
	$('#div_chat_add_msg').css("width","220px");
	$('#zoom_in').css("display","block");
	$('#zoom_out').css("display","none");
   });*/
/*   $('#template_color').colorPicker();
   $('#template_color').change(function(){
		update_template();
   });
*/

  });

