    if (jQuery.browser.msie) {
       if (parseInt(jQuery.browser.version) == 6){
               
               if (document.all && document.styleSheets && document.styleSheets[0] &&
                 document.styleSheets[0].addRule)
                {
                 
                 document.styleSheets[0].addRule('img', 'behavior: url(../iepngfix.htc)');
                 document.styleSheets[0].addRule('div', 'behavior: url(../iepngfix.htc)');
                 document.styleSheets[0].addRule('a', 'behavior: url(../iepngfix.htc)');
                }
       }
    }

// Effets juteux et sucrés rendus possibles grâce à jQuery
//jQuery.easing.def = "easeOutBounce";

$(function(){
   
   //Alignement centré verticalement
   var height = $(document).height();
   var contentHeight = $('#main').height() + 86;

   
   $('#main').css({top : height/2 - contentHeight/2});
   
   if ($(document).getUrlParam("x")) {
      x = $(document).getUrlParam("x") + "px";
      
   }
   else {
      x = "43px";
   }
   

   $('a.new-window').click(function(){
      window.open(this.href);
      return false;
   });
   
   
   
   $('img#barre-bleue').animate({'left' : x}, {easing: "easeOutBounce", duration: 1000});
   $('#noms img').css({opacity: '0'}).hide();
   
   
   //Ahah!
   if ($(document).getUrlParam("yo")) {
      yo = $(document).getUrlParam("yo");
      if (yo == "ericdagenais") {
         $("#web-services").attr("src", "images/services-ben.jpg");
         
      }
      
   }  
   
   
   
   //Boites de descriptions des services
   $('.details-servs').css({opacity: '0', marginTop: '-250px'});
   
   $('#c-visuelle').click(function(){
      $('.details-servs').animate({opacity: '0', marginTop: '-250px'});
      $('.visuel').animate({opacity: '1', marginTop: '0px'});
   });
   
   $('#c-web').click(function(){
      $('.details-servs').animate({opacity: '0', marginTop: '-250px'});
      $('.web').animate({opacity: '1', marginTop: '0px'});
   });
   
   $('#c-pub').click(function(){
      $('.details-servs').animate({opacity: '0', marginTop: '-250px'});
      $('.promo').animate({opacity: '1', marginTop: '0px'});
   });
   
   $('#c-photographie').click(function(){
      $('.details-servs').animate({opacity: '0', marginTop: '-250px'});
      $('.photo').animate({opacity: '1', marginTop: '0px'});
   });
   
   $("#email, #name").focus(function() {
	if( this.value == this.defaultValue ) {
		this.value = "";
	}
}).blur(function() {
	if( !this.value.length ) {
		this.value = this.defaultValue;
	}
});
   
    $('.kwicks').kwicks({  
         max : 80,  
         spacing : 0  
     });  
   $('a.lite').lightBox();    
   
   $('#btn-profil').click(function(){
      $('img#barre-bleue').animate({'left' : '43px'}, {easing: "easeOutBounce", duration: 600});
      x = "43px";
      $('#wrap-wrap-global').animate({'left' : '0px'}, {duration: 1200});
      });
   
   $('#btn-profil').hover(function(){
         $('img#barre-bleue').stop().animate({'left' : '43px'}, {easing: "easeOutBounce", duration: 600});
      }, function(){
         
         
         $('img#barre-bleue').stop().animate({'left' : x}, {easing: "easeOutBounce", duration: 600});
      });
   
   $('#btn-services').click(function(){
      $('img#barre-bleue').animate({'left' : '187px'}, {easing: "easeOutBounce", duration: 1000});
      x = "187px";
      $('#wrap-wrap-global').animate({'left' : '-2358px'}, {duration: 1200});
      });
   
   $('#btn-services').hover(function(){
         $('img#barre-bleue').stop().animate({'left' : '187px'}, {easing: "easeOutBounce", duration: 1000});
      }, function(){
         
         
         $('img#barre-bleue').stop().animate({'left' : x}, {easing: "easeOutBounce", duration: 600});
      });  
   
   
   $('#btn-equipe').click(function(){
      $('img#barre-bleue').animate({'left' : '330px'}, {easing: "easeOutBounce", duration: 1000});
      x = "330px";
      
      $('#wrap-wrap-global').animate({'left' : '-4716px'}, {duration: 1200});
      });   
   $('#btn-equipe').hover(function(){
         $('img#barre-bleue').stop().animate({'left' : '330px'}, {easing: "easeOutBounce", duration: 1000});
      }, function(){         
         $('img#barre-bleue').stop().animate({'left' : x}, {easing: "easeOutBounce", duration: 600});
      });
   
   $('#btn-portfolio').click(function(){
      $('img#barre-bleue').animate({'left' : '473px'}, {easing: "easeOutBounce", duration: 1000});
      x = "473px";
      
      $('#wrap-wrap-global').animate({'left' : '-7074px'}, {duration: 1200});
      });   
   $('#btn-portfolio').hover(function(){
         $('img#barre-bleue').stop().animate({'left' : '473px'}, {easing: "easeOutBounce", duration: 1000});
      }, function(){         
         $('img#barre-bleue').stop().animate({'left' : x}, {easing: "easeOutBounce", duration: 600});
      });
   
   $('#btn-contact').click(function(){
      $('img#barre-bleue').animate({'left' : '616px'}, {easing: "easeOutBounce", duration: 1000});
      x = "616px";
      $('#wrap-wrap-global').animate({'left' : '-9432px'}, {duration: 1200});
      });   
   $('#btn-contact').hover(function(){
         $('img#barre-bleue').stop().animate({'left' : '616px'}, {easing: "easeOutBounce", duration: 1000});
      }, function(){         
         $('img#barre-bleue').stop().animate({'left' : x}, {easing: "easeOutBounce", duration: 600});
      });
   
   $('#btn-precedent').click(function(){
      switch(x)
      {
      case "43px":
         break;
      case "187px":
        $("#btn-profil").click();
        break;
      case "330px":
        $("#btn-services").click();
        break;
      case "473px":
        $("#btn-equipe").click();
        break;
      case "616px":
        $("#btn-portfolio").click();
        break;
      }      
      });
   
   $('#btn-suivant').click(function(){
      switch(x)
      {
      case "43px":
         $("#btn-services").click();
         break;
      case "187px":
        $("#btn-equipe").click();
        break;
      case "330px":
         $("#btn-portfolio").click();

        break;
      case "473px":
        $("#btn-contact").click();
        break;
      case "616px":

        break;
      }      
      });
   
   
   $('.equipe-change, #nom-alex').hover(function(){
      
      $('#nom-alex').stop().show().fadeTo(200, 1);
      }, function(){
      $('#nom-alex').stop().fadeTo(200, 0).hide();   
      });
   
   $('.equipe-change2, #nom-sam').hover(function(){
      $('#nom-sam').stop().show().fadeTo(200, 1);
      }, function(){
      $('#nom-sam').stop().fadeTo(200, 0).hide();   
      });
   
   $('.equipe-change3, #nom-charles').hover(function(){
      $('#nom-charles').stop().show().fadeTo(200, 1);
      }, function(){
      $('#nom-charles').stop().fadeTo(200, 0).hide();   
      });
   
   $('.equipe-change4, #nom-seb').hover(function(){
      $('#nom-seb').stop().show().fadeTo(200, 1);
      }, function(){
      $('#nom-seb').stop().fadeTo(200, 0).hide();   
      });
   
   $('.equipe-change5, #nom-jo').hover(function(){
      $('#nom-jo').stop().show().fadeTo(200, 1);
      }, function(){
      $('#nom-jo').stop().fadeTo(200, 0).hide();   
      });
   
   // Effet boutons services
   
   $('.btn-service').hover(function(){
         $(this).animate({opacity : '0.4'}, 100, function(){
            $(this).animate({opacity : '1'});
            });
      }, function(){
         
      });
   
   //Transitions d'image
   $('#profil').cycle({
      timeout:    7000
      });

   
   
   // Bouton facebook
    setTimeout('$("#facebook").animate({"left" : "750px"}, {easing: "easeOutBounce", duration: 400})', 4000);
        
    $('#facebook').hover(function(){
      $("#facebook").stop().animate({"left" : "800px"}, {easing: "easeOutBounce", duration: 400});
      }, function(){
      $("#facebook").stop().animate({"left" : "750px"}, {easing: "easeOutBounce", duration: 200});   
      });

   // Lazzzzy
   
   $("#boite-folio img").lazyload({
        event : "sporty"
    });
   
   $(window).bind("load", function() { 
    var timeout = setTimeout(function() {$("img").trigger("sporty")}, 1);
   });
   
   
   /*****************
    *****************
    *****************
    *****************
    *****************
    *****************
    *****************
    *****************
    *****************
    ********Form*****/
   
   $("button").click(function(){

         $(".formError").hide();

	});

	var use_ajax=true;
	$.validationEngine.settings={};

	$("#contact-form").validationEngine({
		inlineValidation: false,
		
		success :  function(){use_ajax=true},
		failure : function(){use_ajax=false;}
	 })

	$("#contact-form").submit(function(e){
               var a = $("#name").attr("value");
               
               if(a == "Nom")
                  {
                     $.validationEngine.buildPrompt("#name","* Vous devez entrer votre nom","error");
                     use_ajax=false;
                  }
               
			if(use_ajax)
			{
				$('#loading').css('visibility','visible');
				$.post('submit.php',$(this).serialize()+'&ajax=1',                                       
                                       
					function(data){
						if(parseInt(data)==-1)
							$.validationEngine.buildPrompt("#captcha","* Wrong verification number!","error");
							
						else
						{
							$("#contact-form").hide('slow').after('<h1>Merci!<br /><small>Nous vous répondrons très bientôt</small></h1>');
                                                        x = "616px";
						}
						
						$('#loading').css('visibility','hidden');
					}
				
				);
			}
			e.preventDefault();
	})



  


});
