 $(function(){
	 $("img").lazyload({
     effect: "fadeIn",
	 placeholder : "http://www.militaryheritage.com/charts/GREY.GIF",
	 threshold : 0
 });
	 // select #flowplanes and make it scrollable. use circular and navigator plugins
	
  $('#container').masonry({
    // options
    itemSelector : '.item',
	 columnWidth: 240
  
  });
  $.fn.jqrotate = function(degrees, options)
{
	var options = $.extend({ 
				animate : false // not yet implemented
				}, options);
			    
			    return this.each(function()
			    {
			        var $this = $(this);
			  
			      var oObj = $this[0];
			      var deg2radians = Math.PI * 2 / 360;
			      
			      var rad = degrees * deg2radians;
			      var costheta = Math.cos(rad);
			      var sintheta = Math.sin(rad);
			      
			      a = parseFloat(costheta).toFixed(8);
			      b = parseFloat(-sintheta).toFixed(8);
			      c = parseFloat(sintheta).toFixed(8);
			      d = parseFloat(costheta).toFixed(8);
			      
			      $this.css( {	'-ms-filter' : 'progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + b + ', M21=' + c + ', M22=' + d + ',sizingMethod=\'auto expand\')',
			    	  			'filter' : 'progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + b + ', M21=' + c + ', M22=' + d + ',sizingMethod=\'auto expand\')',
			    	  			'-moz-transform' :  "matrix(" + a + ", " + c + ", " + b + ", " + d + ", 0, 0)",
			    	  			'-webkit-transform' :  "matrix(" + a + ", " + c + ", " + b + ", " + d + ", 0, 0)",
			    	  			'-o-transform' :  "matrix(" + a + ", " + c + ", " + b + ", " + d + ", 0, 0)"
			      });
			        
			        
			    });  
			};
  $("a:first").click(function() {
	  $(this).text($(this).text() == '[x] Show' ? '[x] Hide' : '[x] Show');
	  
  $("#infossurben").fadeToggle("fast", "linear");
});


 $(window).scroll(function() {
	
	  $('#triangle').rotate($(this).scrollTop()/4);
    $('#triangle').css('top', ($(this).scrollTop()/2) + "px");
	
});
$('.scrollPage').click(function() {

   var elementClicked = $(this).attr("href");
   
   var destination = $(elementClicked).offset().top;
   var depart=$('.scrollPage').offset().top;
   var difference=Math.abs(destination-depart);
     $("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 2500, function() {
   
  });
   return false;

});	/*
$('.item').hover(function() {
         $('.vignette').fadeToggle();
    });

$('.vignette').mouseover(function() {

 $(this).animate({
  opacity: 'hide'
 }, "fast");


});
$('.vignette').mouseout(function() {

 $('.this').animate({opacity: 'show'
 }, "fast");


});
*/
var mouseover = function() {	
		$(this).find('.infopro').fadeOut(200);
		
		/*for (var i=1;i<=20;i++){
			if ($('#item'+i)!=	$(this)){
				$('#item'+i).find('.cache').fadeIn(200);
			}
			}*/
	};
	
	var mouseout = function() {
		$(this).find('.infopro').fadeIn(200);	
		
	};
	
	$('.item a').hover(mouseover, mouseout);
});

	$(document).ready(function() {
		
	    if(!$.fontAvailable('Ma police exotique')) {
	      Cufon.replace('h1');
		   Cufon.replace('h2');
		   Cufon.replace('.italique');
	    }
	});
	
/*	window.onscroll = function()
{
    if( window.XMLHttpRequest ) {
        if (document.documentElement.scrollTop > 1000 || self.pageYOffset > 1000) {
            $('#infos').css('position','fixed');
            $('#infos').css('top','0');
        } else if (document.documentElement.scrollTop < 1800 || self.pageYOffset < 1000) {
            $('#infos').css('position','absolute');
            $('#infos').css('top','0px');
        }
    }
}
*/
