
var optionShadow = {
  x:      1, 
  y:      1, 
  radius: 2,
  color:  "#D6D6D6"
}

// Vérifier l'état de projet (pour le submenu projet)
if (typeof projetStatus == 'undefined') {
  projetStatus = false;
}

function hideSubMenu() {
    $("#submenu").fadeOut("slow");
}

$(document).ready(function(){
    if (!projetStatus){
       $("#projet").click(function (event) {
            event.preventDefault();      
            $("#submenu").slideToggle("fast");
            //setInterval('hideSubMenu()', 5000);
       });
   } else {
        $("#submenu").show();
   }
   // Rollover   
   $(".shadow1").hover(
       function () {
            $(this).textShadow(optionShadow);
       }, 
       function () {
            $(this).textShadowRemove(); 
          }
    );   
   $(".shadow2").hover(
       function () {
            //$(this).dropShadow(optionShadow);
            //$(this).css({"fontWeight":"bold"});
            $(this).textShadow(optionShadow);
       }, 
       function () {
            //$(this).css({"fontWeight":"normal"});
            $(this).textShadowRemove(); 
          }
    );
    
});


// SLIDE
var wrapNumber;
var pictureContent;
var picOffset ;
var picX = 0 ;
var picY = 110;
// Vérifier l'état de home (pour le submenu projet)
if (typeof homeStatus == 'undefined') {
  homeStatus = false;
}
$('#listeProjet a').mouseenter(function() {
    // Récupérer le id
    wrapNumber = $(this).attr("pId");
    //alert('wrapNumber = '+wrapNumber);
    // Lancer le loader        
    $('#loader').css({'visibility':'visible'});
    $('#loader').show();
    //lancer le fadeout
    $("#pictureContent").fadeOut("fast", function(){
            // charger l'image                               
            pictureContent = '<img src="data/projets/'+wrapNumber+'.jpg" id="pic" />';
            //$("#pictureContent").empty().html(pictureContent);
            $("#pictureContent").empty().html(pictureContent);
            $(pictureContent).load(function(){
                //alert(('chargé'));
                $('#loader').hide();
                $("#pictureContent").fadeIn("fast");
                if (!homeStatus){
                    picOffset = $("#pic").offset();
                    var picW = $("#pic").width();
                    picX = picOffset.left + (720-picW);
                    picY = picOffset.top;                
                   // alert('w'+picW);
                    $("#pic").offset({top:picY, left:picX});
                }
            });
        });
    
});

// Param jscorllbar
$(function()
{
	// this initialises the demo scollpanes on the page.
	$('#pane1').jScrollPane({
	       showArrows:true, 
           scrollbarWidth: 17,
          });
});
