 $(function(){

// Mail newsletter inscription
$("#nl_mail").focus(function () {
		if( $.trim($(this).val()) == 'Inscription newsletter' ){ $(this).val(''); }	
});
$("#nl_mail").blur(function () {
		if( $.trim($(this).val()) == '' ){ $(this).val('Inscription newsletter'); }
});

// Rollover / out vignettes
 $(".img_projet").mouseover(function () {
      $(this).fadeTo("fast", 0.50);
    });
  $(".img_projet").mouseout(function () {
      $(this).fadeTo("fast", 1);
    });  
  $('a[rel=external]').attr('target','_blank');

/* Récupérer position d'un élément*/
jQuery.fn.extend({
   findPos : function() {
       obj = jQuery(this).get(0);
       var curleft = obj.offsetLeft || 0;
       var curtop = obj.offsetTop || 0;
       while (obj = obj.offsetParent) {
                curleft += obj.offsetLeft
                curtop += obj.offsetTop
       }
       return {x:curleft,y:curtop};
   } 
});
/* Placer le menu axe x */
   pos = $('#contenu').findPos();
   $('#new_menu').css('margin-left',''+(pos.x-200)+'px');
    $('#menu_new').fadeIn("slow");
	

/* Placer menu au resize... tant qu'a faire ... */  
$(window).bind("resize", resizeWindow);

function resizeWindow( e ) {
   pos = $('#contenu').findPos();
   $('#new_menu').css('margin-left',''+(pos.x-200)+'px');
    $('#menu_new').fadeIn("slow");
	
}

//Détection nav, si Opéra pas de scrollFollow vu qu'il ne comprends pas tout... sinon scrollFollow
if($.browser.opera) { $( function() { 
								  
								  
} ); }else{
 $( '#new_menu' ).scrollFollow( {
		container: 'contenu',
		speed: '0'

  } );
}

/*rollover*/
$('.item_menu').mouseover(function(){
$('#picto_menu').css('display','block');
temp_class = $(this).attr("class").split(" ");
if(temp_class[0] == "active"){
	compare = temp_class[2];
}else{
	compare = temp_class[1];
}
switch(compare){ 
case 'accueil_item': $('#picto_menu').css('margin-top','0px'); break; 
case 'presentation_item': $('#picto_menu').css('margin-top','20px'); break; 
case 'services_item': $('#picto_menu').css('margin-top','40px'); break; 
case 'awards_item': $('#picto_menu').css('margin-top','62px'); break; 
case 'blog_item': $('#picto_menu').css('margin-top','84px'); break; 
case 'contact_item': $('#picto_menu').css('margin-top','106px'); break; 
default :; 
}  	
});

/*rollout*/
$('.item_menu').mouseout(function(){
$('#picto_menu').css('display','none');
});

}
)